What's the fastest way to discretize continuous (x, y) or (x, y, z) coordinate data onto their nearest grid coordinates?
Said differently: what's the fastest way to turn the continuous, Euclidean position (6.778, 9.201) into a corresponding grid coordinate (7, 9) -- for example, the pixel coordinate in an image? Let's imagine I have 100 continuous (x, y) pairs and a known 150 x 150 discrete grid (e.g. 150^2 pairs of (0, 0), (1, 1), ..., etc. -- what's the fastest way to map each (x, y) pair to their nearest (grid1, grid2) coordinate?
Googling this didn't seem to give much results, but I'm sure this has been asked elsewhere, so apologies in advance if this is redundant.