I can convert a Coordinate into an Index like so:
index = z + y * maxZ + x * maxY * maxZ
So for instance, I have a cube of 4x8x4... But my brain, isn't connecting how to convert it back. I want to take a given 'Index' and get 'x', 'y' and 'z'. That is in a 'quick' smart way. I know I could do it with loops and stuff.
For index = z + y * maxZ + x * maxY * maxZ
, you get (x, y, z) = (index / maxY / maxZ, (index / maxZ) % maxY, index % maxZ)
.