-
damn arrays
Hi everyone,
Can anyone tell me how I would turn a 64x64 array into a 3x4096 array. The first column needs to contain the x co-ord of the element the second column contains the y co-ord of the element and the third column needs to contain contain the value of that element.
Any help would be great!
Thanks.
-
Something like
Code:
for ( r = 0 ; r < 64 ; r++ ) {
for ( c = 0 ; c < 64 ; c++ ) {
pos = r * 64 + c;
new[pos][0] = r;
new[pos][1] = c;
new[pos][2] = old[r][c];
}
}
-
Thanks for that Salem but could you possibly explain whats going on there.
cheers
-
> The first column needs to contain the x co-ord
Is this line....
new[pos][0] = r;
-
ah ok, thats excellent.
Thanks