Convert a 1d array index to a 3d array index?
arrays, c#, multidimensional-array
Solution
Supposing you want to iterate through Z, then Y, and then X. . .
int zDirection = i % zLength;
int yDirection = (i / zLength) % yLength;
int xDirection = i / (yLength * zLength);
Problem
I've got a int that I want to convert to 3 ints for the index of a 3d array, here's an example of what I'm on about. ``` byte[,,] array = new byte[XSize, YSize, ZSize]; int i = 0; //other code array[#,#,#] = cur; //other code ``` I don't know how to get the correct numbers for the #,#,# from just i.