I have a set of points (10000 - 15000). For each point, I know the coordinates (X,Y). For any generic P point I want to determine the four points that shape a quadrilateral around P, like in figure
[
I tried to calculate the distance between P and the other points and pick up the nearest ones, but this method doesn't work everytime because the points haven't a regular dislocation. It happens something like in figure below
[