- Take an arbitrary point.
- We delete from the general list of unparsed points, put in the output list.
- Find the point that is closest to the source. We use the usual Cartesian distance measure.
- We delete it from the list of unparsed, put it in the output list.
- If there are still unparsed points - go to p.3.
According to the comments and discussions, we assign the position :-):
The classical spline of one variable is constructed as follows: the domain of definition is divided into a finite number of segments, on each of which the spline coincides with some algebraic polynomial. The maximum degree of the polynomials used is called the degree of the spline. The difference between the degree of the spline and the resulting smoothness is called a spline defect. For example, a continuous polyline is a spline of degree 1 and defect 1.
If a simple Cartesian measure turns out to be insufficient, you can use the good old splines. Notice, I do not complicate the task ... we build a spline for combinations of 4 nearest points and choose the one for which the degree of the slide is minimal. But we must begin with one of the ends of the figure - so that we immediately begin to move along one of the lobes - the upper or lower.