Vert sorting counterclockwise semi-working: having some issues

Hello!
Long story short: working on an open source eQuest BEM model creation in Rh/Gh project. (with all intention of moving in a direction of interoperability with LBT)

I’ve been writing some code to sort vertices:
image

and for the most part so far it is working: except, there seems to be some issue occasionally; with one or so surfaces: getting the vertices sorted counter clockwise:

Which relates to:
image

Any suggestions/ suggested rabbit holes to go down and or otherwise time and aide are greatly appreciated!

Hello Trevor,

I have solved this in the past by iterating over the surface border. Looking back at this I’m sure it could be improved but it seems to work well for my simple cases - note that I don’t care whether it is clockwise or anticlockwise, I just want the vertices in sequence:

border = rs.DuplicateSurfaceBorder(surf, type = 1)
edges = rs.ExplodeCurves(border, delete_input = True)
for edge in edges:
    rs.CurveStartPoint(edge)
1 Like

Thank you!
Having some good success with this as well

image

image

1 Like

This approach might also be relevant: