Rhinocommon strategy for auto-sorting Polyline Through Points?

Problem detailed here:

"I’m converting Tetgen program 3D Voronoi diagrams faces to meshes in Python/Rhinocommon. However, unlike the Rhino Polyline Through Points command that automatically sorts the points to always give a single non-overlapping closed loop, Rhinocommon only seems to have a generic Polyline structure that fails to sort the points, so my unordered input points are giving self-overlapping curves that can’t then be converted to mesh faces.

Must I use Python to sort the points around their center using math? Or does Rhinocommon have a trick or two to do this for me? Each group of points are coplanar, albeit at various 3D angles.

I’m disappointed in Rhinocommon today since I can’t use Rhino power commands now that I sadly realize the Tetgen tetrahedral mesh generator binary is not offering ordered points, just a list of lines I have to extract endpoints from and cull duplicates.
Just a “clockwise” sorting function would do.

The Grasshopper Polyline component also fails to sort the points so I can’t use node-in-code for that. I must use several components, to fit a circle then sort points along curve, which is a lot of Grasshopper binding I may wish to avoid."

What about the Point3d.SortAndCullPointList Method ?


Will add this tip to the Grasshopper forum thread, thanks.