new file algorithm 3D

added a z component to get the different layers, we went from 15 lines
to 31 lines !