Convert 1D array index to 2D array index
You can do this mathematically using modulus and integer division, given your second array is a 3x3 array the following will do.
p.y = index % 3;
p.x = index / 3;
p.x = index / 3;
p.y = index % 3;
You can do this mathematically using modulus and integer division, given your second array is a 3x3 array the following will do.
p.y = index % 3;
p.x = index / 3;
p.x = index / 3;
p.y = index % 3;