Cull curves based on numbers of intersections

How do I cull one list of curves, based on the number of intersections each member of that list makes with all items in a second list of curves?

My example:
I have some circles I would like to connect to each other.
I used curve proximity, now I want to dispatch any lines that intersect a circle more than a certain number of times.

I couldn’t figure out how to count the numbers of intersections, so I found a workaround (see definition below), but it prevents me from moving forward with a better version. Ideally, I would offset the lines to create rectangles, and cull any rectangle that intersects circles more than 4 times, with a 5th intersection being a check for proximity when a line passes a circle.

Definition (uses one component from Clipper Plug-in. I internalized it’s output to a curve component next to it for anyone who doesn’t have Clipper. The part visible below is what matters, further back in the definition is just generating circles. Cull Lines By Number of Intersections.gh (52.4 KB)

1 Like

You forgot internalize

Crap. Sorry.

I just internalized and edited the original post so the file attached to it is now correct.

Do you want like this?

Cull Lines By Number of Intersections_re.gh (41.3 KB)

Kind of. I think the mass addition will get me where I want to go.

I was going to use rectangles offset from lines for the collision detection, but dispatch the original lines.

Thanks. I’ll give this a try.

Ok, so your method works great with lines, but it won’t work with the rectangle offsets.

Collision One|Many only tells us IF there is any collision, not how many intersections there are.

See attached. The rectangles I want to reject have more than 4 intersection points with the circles.

Cull Lines By Number of Intersections_re_re.gh (50.2 KB)

The same way or you mean anything else?

This looks like it, except that I intended use the count of collisions of the rectangles to cull the pattern of the original lines rather than cull the pattern of the offsets.

Thank you. This solves it.

Try this maybe it is better than using curve proximity

Probably less processing time, yeah.