Say there is a 2D plane (square) with some points inside it.


How to move all the points in such a way that they fill the plane as evenly as possible but every point maintains its neighbors?


In other words, I want the points to be as far from each other as possible but their locality (topology) should be preserved and they should lay in the square.


In other words, I want to kind of zoom-in in the rich-point-populated area and zoom-out in the empty areas.


PS: is there a general solution for higher-dimension spaces? Is there a direct solution or only iterative one?


**Edit**:


Now what, three great answers but I can accept only one. Thank you all!



Topological scaling (?)
The naive approach would be to write down the variance for the pairwise distances as a function of the coordinates of the points and do a gradient descent to spread them out evenly. You probably want to limit which pairwise distances you consider: it might suffice to take, for each point, its three closest neighbors. To spread things out evenly within a square, include the corners and perhaps evenly spaced points on the boundary in your calculation, but don't move them. The strategy would be the same in higher dimensions, but with more neighbors included.


