# Intersect Multiple Trim Curves Iterative Problem

Hi everyone,

I found myself this little problem that is making my head hurt.
I have a list of curves, that I need to intersect with each other in order to trim the curve when it first meets another curves. This sounds easy, the problem lies in the fact that after a curve is trimmed, it might no longer intersect another curve.

MultipleTrim_v01.gh (15.9 KB)

I was hoping this could be solved without the need for an iterative approach… but maybe not.

after a curve is trimmed, it might no longer intersect another curve.

What you have described is a loop, iteration it shall be.

based on your tree curves, look like just need pair it.

MultipleTrim_v02.gh (28.2 KB)

Hi Thomas, thank you, but I am afraid not only the tree can change but also the length and angle of the curves…

Here an example with same tree but different curve length and angle on left side.

Try this but always the curve must sorted like each other

MultipleTrim_v02.gh (29.9 KB)

The idea is create polyline from start points and find the minimum angle and its points than the closest point than the two other closest points and separate their lines to avoid multi-intersection.
You can also try another idea if you can develop it:

You can think of an Array as a loop too: The next item is moved further from the previous one. But GH can handle that just fine.

Maybe there is an alternative logic to this too. Can we not say that each line can have only 1 intersection? And that if a line has only 1, it must evaluate the curve it has intersected with and make sure this is the first time all curves are intersecting, if one curve has mire than 1 item in the list of points, then the intersection becomes invalid, as it would mean a curve has a previous intersection that if shattered would not create the second intersection.