algorithmic modeling for Rhino
I'm trying to wrap my head around how the Curve-Self intersection component (ie. Rhino.Geometry.Intersect.Intersection.CurveSelf class) deals with Polyline Curves. See images below and attached files for case reference.
As far as I can tell it works as expected when the intersection event type is a point (see Case C). However it seems to miss cases where the intersection event type is an overlap (see Case D and E). This might just be me misunderstanding how the class is supposed to work. However, I've made two additional observations that makes me think that this might not be the case:
1) Performing Curve-Curve intersections on two polylines returns the results I would have expected. That is, a single point-point intersection returns one event and the event.IsOverlap property is False (see Case A), and, a single overlap intersection returns one event and the event.IsOverlap property is True (see Case B).
2) When performing Curve-Self intersection on a polyline where overlapping edges/vertices lie on a line, only the first and last vertices are considered intersections (see Case D). When the edges/vertices are NOT on a line, all the vertices are considered intersections.
In the attached file I'm calling the intersection functions using GHPython to get the IsOverlap property, but I have also verified this behaviour using the respective GH components.
Oh snap, forgot to internalize one of the polylineCurves. Attached new file.
I got stuck quite a few times with the curve intersections in the past, and it was most of the time due to the document tolerances: if you're not using tolerances like 0.00001, the intersection results are at best wrong (intersection points not even on the initial curve(s)!!!!!!!) and sometimes simply missing, especially when overlaps are involved.
Thanks Thibault. Yes they can indeed be pretty frustrasting! I'm afraid that experimenting with different tolerances didn't result in the expected Curve-Self overlap intersection. I ended up writing a Python function which does what I was looking (i.e. find overlapping vertices/edges for a list of polylines). Seems to work and is pretty fast too: