c# - Coordinate calculation problem! -


i using single-dimensional array simulate two-dimensional array, due performance increase of doing so.

the formular finding index of place item following, when height of array 30 items, , width of array 20 items.

offset = x * 30 + y

given same information, how convert offset positions? know it's possible. can't think of how it.

int x = offset / 30; int y = offset % 30; 

Comments