i flattened a 3D array using the following code index = x*size*size + y * size + z
but can't figure out how to build the x,y,z indices from the index
i found another stackoverflow question with this but this doesn't work out for me, the indicis are always off