Placing a Rectangle Inside an Irregular Polygon

Hello Rhino and Grasshopper Community,

I’m seeking some guidance for a project I’m working on in Grasshopper. My current challenge involves placing a rectangular shape inside an irregular polygon. The key requirement is that the rectangle should stay entirely within the boundaries of the polygon, and it needs to be positioned as far away as possible from a predefined point within the polygon.

I have attempted several strategies but haven’t found a solution that meets these specific conditions. The goal is to maximize the distance of the rectangle from the defined point while ensuring it remains completely within the polygon’s limits.

If anyone has experience with similar tasks or can offer any insights, scripts, or resources to help me solve this problem, I would greatly appreciate it. Any advice or suggestions to point me in the right direction would be invaluable.

Thank you in advance for your time and assistance!
It works here:


But not when I challenge it

with less rounded shapes

The two corners of the shape have to touch the polygon

Shape inside polygon (Forum).3dm (44.8 KB)
Shape inside polygon (Forum).gh (15.8 KB)

Hello
I think you can use Minkowski difference, it is in Clipper plugin

You’ll have to place your rectangle centered on 0 on XY plane (or other if you specify)
Then plug this rectangle to A and your polygon to B.
It will output 2 curves. The second curves is the maximum polygon to place the rectangle inside your polygon. WIth that you could find the optimum position



rectangle inside polygon.gh (12.5 KB)

2 Likes

Hi Laurent,

Thank you so much for your prompt and insightful response!

1 Like