Given a 2D array sparsely filled with objects containing position and size data (X,Y,W,H) representing objects in 2D space which has been transformed into a 1D array with excess data removed(any empty spaces) is it possible to index into the one dimensional array given a starting point (X,Y) corresponding to a location in the original array using some minimal set of metadata acquired from the original array?
Essentially i'm searching for a way to represent large sets of 2D spatial data without consuming an excess of memory and computing power(a 16,000 by 16,000 array would contain 256,000,000 objects) so getting rid of potentially hundreds of millions of "empty spaces" would represent a large performance gain in both terms of memory usage and cycles wasted looping over empty space. Computations are being made in real time so keeping data in memory is preferred.
Linked is an example of what i'm trying to accomplish. Hope it makes sense. example