Vert sorting counterclockwise semi-working: having some issues

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:

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:

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:
1 Like

Thank you!
Having some good success with this as well



1 Like

This approach might also be relevant: