Hi! This seems pretty simple but I have yet to see a solution for it. Basically I have building footprints (polygons) from CadMapper and I need them to be rectangles to run through my extrusion script. Is there a way to create rectangles of best fit (doesn’t need to be too accurate or fit inside the polygons completely) for each shape? See image attached. Thanks!
If I had a dollar for every thread that starts like that…
2 Likes
You probably need to specify these requirements a bit to get better answers (uploading a file helps too). But assuming the rectangles should be circumscribed, a conventional approach is to compute bounding boxes aligned with each edge of the input polygon, and then pick the one with the smallest area. I tried using only components, but snuck a small Python function in there as I couldn’t get the Item Index
component to work as (I) expected:
240717_EdgeAlignedBoundingRectangle_00.gh (11.1 KB)
And welcome on board of course
5 Likes
Thanks, this worked fantastic! Been using Rhino/GH/McNeel Forum for 6 years and never needed to start my own thread until now
1 Like