Shatter producing way more results than expected

Sorry, this is an area that I just have trouble wrapping my head around.

I have a spiral and a circle. I want to intersect the two lines, shatter the spiral, and pick one of the resulting segments. I have no problems doing this when I have one circle and one spiral.

The problem is, I actually need an array of these (the circles are all of different sizes. There’s a “Curve Closest Point” component that’s supposed to be associated with a curve in Rhino).

For example, I tried this with a 3 * 3 array of circle/spiral combos. The intersection looks fine, it gives me 9 results. But instead of the expected 18 results after I shatter (inner and outer segment * 9), I get 162 results (inner and outer segment * 9 * 9).

In fact you can see that the operation is giving the correct answers, but instead of just giving the answer to the appropriate location, it gives it to all 9 locations:

Is this a tree thing? Where I’m getting a branch where I should be getting an item?

So… I tried flattening various things, I tried poking in a “shortest list” component, but I’m kind of floundering here and hope that someone can point out my dumb so I can be less dumb.

Trim (24.3 KB)

You could also use Trim with Regions

1 Like

It certainly is!

Trim (29.4 KB)

With appropriate previews disabled:

Oh wow! Thank you so much!

Aha! Thanks so much!

I see now! Thank you so much!

What does this have to do with sets? (per thread title)

Is there a rule of thumb on whether I need to flatten or graft? Or can you point me to a video?

I was just referring to the tab name in Grasshopper (it was a guess!)

No. You have to examine and understand the data trees going in and coming out of each component.

Can you edit the thread title to be more accurate? “a sets problem” is misleading.

There is a rule of thumb here which is; don’t flatten. Flatten destroys information which may make it impossible for you to keep developing the same file.

However Flatten is popular because it is easy and oftentimes you know your file will never be used for more complicated inputs.