Help:Remove circles outside the surface boundary

Hello, I have written a program in C# script in Grasshopper that divides a surface into multiple small rectangles and draws circles with their centers at the midpoint of these rectangles. However, I am facing an issue where I do not want circles that intersect with the boundary of the surface. Could you please suggest how I can modify my program to achieve this? Attached is my Grasshopper file. Thank you.
Snipaste_2023-07-03_14-55-49

test1.gh (6.2 KB)

Hi @nori_nori,

how about something like this? You can cull them considering the distance of the projection of the centers of the small circles to the curve that determines the big surface. If the distance is smaller than the radius of the small circles, then they are intersecting with the big surface.

test1_Suggestion.gh (9.2 KB)

Hi @fcegnam ,
thank you so much for your help. This has perfectly solved my problem. :face_holding_back_tears:

Hi @fcegnam
I’m sorry to bother you again, but I have found some issues. When I use the component on surfaces other than circles, I still find some circles that do not meet the requirements. Could you please help me take a look again? Thank you very much. :smiling_face_with_tear:
Snipaste_2023-07-03_15-49-51

Hi,

The distance appraoch is not restrictive enough.
You can use Offset Curve to create an inner offset of your exterior contour by the radius of your circles.
Then use Point in Curve component to test the inclusion of the center in that offset.
This will give you a True/False value you can use to filter the circles with Cull Pattern.

1 Like

Hi @nori_nori ,

that is correct, I was too fast with the answer and it is not restrictive enough as @magicteddy pointed. My mistake :sweat_smile:.

Here you have a new version. First I get rid off all the circles whose origin is outside the shape (any shape will work). And then I apply the same logic as before to the remaining circles whose origin is inside the big shape. By the way, if you change this to a different shape other than the small circles as the small shapes, you will need to check for the intersection and this logic will not work.

test1_Suggestion_2.gh (10.0 KB)

Let me know if you still need more help!

2 Likes

Hi @fcegnam ,
The new one is working now. Thank you for your generous help. I really appreciate it. :laughing:

Hi @magicteddy ,
Thank you so much for your advice. it was really helpful and I found it very constructive.