Hello everybody!

I am trying to work on a grasshopper developer of styrofoam cuts for architectural models. So I am now facing quite a problem when it comes to partitioning flat polygons in smaller and optimized rectangles.

i) At this point in the script, I have all these (all the time) different polygons subdivided into smaller rectangles (see image 1). The idea would be to merge some rectangles in order to obtain bigger, optimal rectangles, always by avoiding flat long pieces (which would be really problematic to realize in foam) (see image 2). Has someone by any chance a hint on how to achieve this?

ii) By the way, I do not know if the strategy of dividing in smaller rectangles and then merging them into bigger ones is a good one. I found some references on the subject of “covering an orthogonal polygon”, which presents some computational algorithms on the matter; and “partitioning rectilinear polygon” with python+mathplotlib: it seems that it is definitely possible to solve the question through an iterative process, but I was wondering if it there was a way to achieve the same result with Grasshopper.

Thank you so much in advance!

Andrea

190915_PartitionRectanglesPolygon.gh (14.0 KB)