good luck my friend . make sure to find a way to get to sleep . that is my advice <| sep |> The issue is how you draw them , even if you sorted the points correctly straight lines will intersect . An example if you have points 1 , 0 , 2 , 0 , 0 , 3 , 0 , 4 you will get a shape that connects like the symbol of 4 . If you want to show this as a spiral figure you have to connect the points with arcs , some parameterized function that takes center point , startend angle and startend radius . This is why I previously suggested finding points with the largest convex angle , this would ensure no straight lines overlap sorry removed that post there was no reply so I thought I made some mistake or a solution utilizing convex hulls . If the endgoal is to generate a irregular spiral shape with no overlaps an easier approach is to generate points from center in polarcoordinates and add some small random angle and small random radius to get the next point .