convert 2d coordinates to 1d index code example Example: how to convert a 2d coordinate to an index index = x + width * y;