Do this first with a two-dimensional array:
0 1 ... W-1
W W+1 ... 2*W-1
2*W 2*W+1 ... 3*W-1
. . . .
. . . .
. . . .
(H-1)*W (H-1)*W+1 ... H*W-1
So you will access this with
unsigned char* array = new unsigned char[H*W];
for(int r=0;r<H;r++)
for (int c=0; c<H; c++)
array[r*w+c]=...;
i*WIDTH*3 + j*3 + k
sizeof(float) , , , , Mike DeSimone.