Sort the point list in order

I found somewhere in this forum how to sort the point list in order, but I can’t remember.
Could you explain the contents of this algorithm?

Takes a list of points and:

  1. Generates a plane by best fit through them
  2. Pulls the origin from the plane. This should be the geometric mean of the point list.
  3. Builds a vector from the plane origin to each point.
  4. Finds the X axis and normal of the plane.
  5. Gets the angle from the X axis to the point vectors around the normal.
  6. Sorts the list of points according the the angle values.
  7. Generates a polygon from the sorted points.
1 Like