Hopefully this is a good question. I am working with a native class that represents a 2D image as a 1D array. If you want to change one pixel, for example, you need to now how to derive the index from the
x,y coordinates. And I am trying to grok, in abstract terms, how to map a multidimensional object to its underlying unidimensional representation.
So, let's say we have a 1D array
array1d like this:
array1d = [ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y ]
In the context of our program,
array1d represents a 2D grid:
a b c d e f g h i j k l m n o p q r s t u v w x y
And we want to perform operations on
array1d such as:
- Get the value at
x,ycoordinates (in this example,
- Get any sub-grid using
[l, m, q, r])
- Set the value at any
Is there a computer science-related or mathematical term for said operations, which map points/regions in 1D data to coordinates in 2D/3D/4D... objects? If so, what is it? Clearly all computers with displays solve this same issue, so what is this fundamental problem called and how is it conventionally solved?