# Intersecting Curves after random growth

Hi guys,

I am relatively new about Anemon and growth processes in Grasshopper. I have created a growth process and would like to add more conditions to it. In this case, it is pentagons that are randomly mirrored randomly on one side of the pentagon. However, they intersect. I’ve tried a collision component but i have no clue how to fix this.
Do you have any idea how I can get it to be an arbitrarily growing pattern, with the pentagons neither overlapping nor crossing?

Best regards.

Curve intersec.gh (8.7 KB)

Other than intersecting you have also a lot of overlapping polygons (duplicates)…
Let’s find a solution that solve both problems at the same time.

For example, by making the polygon a surface, and joining the surface to a total main polysurface, you can then use only naked edges where to try to add a new polygon (surface) … (internal edges are not suitable for a new surface origin)

2 Likes

Curve intersec_re.gh (13.7 KB)

Like this.

Interesting/cute pattern…
In this solution new element is added only if it touch main polysurface on just one side.
It could fit in some other places, but it is discarded anyway.

2 Likes

Looks great, would love to see it. Do you mind posting a more readable version of your code so I can replace these missing R6 bits to make it work in R5? Mass Multiplication?

Funny thing is that the code appears to work, except for detecting overlaps.

Curve intersec_re_V2.gh (15.5 KB)

Ok, small edit and different result.
As wanted!

Still, the method to check if to discard a new surface is incomplete, it could fail (and will).
(it is only checking vertexes of new polygon on main polysurface, mid-segment intersection could happen… always check results)

1 Like

The V2 is just the 0.9999 scaling part, you can skip it to have “V1” version…

Thanks, but no joy in R5. Can’t seem to make V1 work.

Aha! Modified to your V2 and it appeared to work at first but some overlaps happen eventually?

Curve intersec_re_V2_R5.gh (15.8 KB)

Thank you so much for the explanation Riccardo, thats what i was aiming for

Seems like my brep closest point test is completely failing on R5.
I’m finishing another version, I’ll post it compatible with R5.

I removed Cull i and now it appears to work in R5?

Curve intersec_re_V2b_R5.gh (16.7 KB)

For large element count the loop would exponentially waste attempts on non-suitable edges (and that would have a growing fail rate over time), so I added a point list to store there failed attempts (by saving edge mid-point, as index is unusable in this situation), so it can avoid attempt again from the same edge.

In pic, point are old failed attempts.
Further check should be done in big count, as this method still leave “attempt-able” a lot of edges that are clearly not suitable…

Up to V2 new elements could still intersect in some way with main polysurface, added a reverse test (inverse as previous method) that work in parallel.

Sorry for the messy descriptions…

Curve intersec_re_V3.gh (22.3 KB)
Curve intersec_re_V3_RH5.gh (22.9 KB)
RH5 convert surface to curve (and opposite) in different ways, so vertex index of surface id different from RH6.

3 Likes