Here’s a fun math/programming problem if anyone’s in to that, with a potential application in cleaning up VCV Rack module arrangement code.
Given two real coordinates x and y, compute its closest point (x_1, y_1) having integer coordinates, using Euclidean distance. That’s easy, just round the coordinates. Then compute the second closest point (x_2, y_2), and so on. If multiple points are a tie, the order between them doesn’t matter.
I haven’t done any research on this, but I imagine it’s possible to come up with a constant-time generator algorithm.