Return to Snippet

Revision: 16403
at August 3, 2009 10:15 by helloworlder

Initial Code
arrayPosition = (y * numberOfColumns) + x

Initial URL

Initial Description
Convert a coordinate (x,y) into the index for a 1D array. For example, the coordinate (3,1) would be at array index 8 if there are 5 columns.

Assumption: Arrays start at 0.

Initial Title
2D array to 1D array conversion

Initial Tags

Initial Language