I’m writing some code which uses Rhinocommon to sweep almost any curve its given, which includes nurbs curves which can create self-intersecting breps using single-rail sweeps.
As far as I can tell, there is no direct way using the API to obtain the self-intersection curves, let alone split the brep and trim them - so I’m wondering if anyone knows:
What’s the best algorithm for programmatically discovering self-intersections then trimming the parts of the brep off that are above the intersection curves?
I was thinking of creating a profile curve at every 1mm or so (which feels like a good sample interval in relation to the tolerance of 0.01mm), in the sections of the curve where the offset operation doesn’t produce a result, and finding intersection points with these profiles and interpolating curve(s) through them.
Once I have these curves, I can split the face then find the pieces not connected to the original rail curve and remove them.
Does anyone have a better idea?