for 2d arrays I have just been saveing it to a 1d array using the equation (arraywidth*y)-(arraywidth-x). with x and y being the 2d coordinates to store in the 1d array. To convert from 1d to 2d: y = ceil(n/arraywidth)
temp = ((ceil(n/arraywidth))-(floor(n/arraywidth)))
x = arraywidth-temp
This makes it so if you go left to right for each row, it goes
1 2 3 4 5
6 7 8 9 10...
Would using this method of converting 2d to 1d and back again be faster than the posts above?
temp = ((ceil(n/arraywidth))-(floor(n/arraywidth)))
x = arraywidth-temp
This makes it so if you go left to right for each row, it goes
1 2 3 4 5
6 7 8 9 10...
Would using this method of converting 2d to 1d and back again be faster than the posts above?