Split intersecting Splines. Sift and Entwine

Hi All!
I need to split some closed splines into all the segments resulting from their intersections.
I managed to make the attached solution work. But I feel the “Sifting and Entwining” is too cumbersome. Mostly because both components as they are tree based, need to have the number of branches specified and I want the definition to work regardless of that.
Any suggestion help on how to join the outputs of the intersection-multiple into a cleaner stable output of a tree with all the segments of each spline in a branch?
Thanks in advance!!

You can use a Curve Closest Point component and Collision One|Many to check which points lay on which curve.

20_05_25_multiple_curves_intersection.gh (12.8 KB)


shatter_all_MCX.gh (13.8 KB)

Here 2 solutions that use MCX’s data; gone a bit complex to add a “0” on empty branches, so shatter component retrieve the original curve when it didn’t intersect, keeping a consistent datatree.

Nice addition with the open, non-intersecting curves. The solution seems a bit complicated?

In my example, I can use the collision component to check whether there is a collision. If the Mass Addition result is ‘0’, then there is no collision. That can be used to sift the input curves and keep the data structure.

20_05_26_multiple_curves_intersection.gh (15.0 KB)

Thanks to both. Will check your solutions tonight.
But besides the splitting. Do you know if these “sift and entwine” operations can be done with a cleaner “branch amount independent” construction?

Well I took a moment to look at the intersection component again and actually all information is there. In case non-intersecting curves are involved, a collision check is required.

The iA and iB outputs show which item in the list of curves intersect. These indeces correspond to the path structure of the C input. Replace path can be used to assign the path to each timestamp tA and tB.

There’s also a component called treefrog to assign paths to assign paths to items but the solution below works with native GH components.

20_05_26_multiple_curves_intersection_mrtn.gh (33.6 KB)

1 Like

Yes, no.
Those components can change inputs/outputs amount only by user interaction … or through scripting (probably).
Entwine/sift/merge/etc are for algorithms where you know you have a fixed amount of branches/streams.
Best would be to avoid using them if you are unsure about that.

With Tree Statistics and Replace Paths you have already seen some good solutions, i hope.
Here is another one, I wasn’t able to simplify it more than this, for now.


The first green group is for just the curve that have some intersection, then the zeroes are inserted.
shatter_all_MCX_V2.gh (15.1 KB)

1 Like

Thanks A LOT to both!