I tried to find information about converting an index that was converted from a two-dimensional index to one. Then return one index to 2-dimensional. I don’t even know what this method is called.
for a single index
int index = x + y * width;
MyArray[index] ;
So my question is how to get it back in two dimensions?
int x = index ??? width;
int y = index ??? width;
For some reason I can't wrap my head around me.
thank
source
share