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