# An algorithms for covering a 2d polygon with a predetermined number of rectangles?

I am looking for an algorithm that is able to cover with non-overlapping rectangles in a pre-defined number and minimum area a generic 2d-polygon.

Polygons are usually free-hand draws, so they can be of really any shape and number of vertexes and having holes.

I found different articles like: https://en.wikipedia.org/wiki/Polygon_covering

but I am not sure if it is what I am looking for. Can you point me to some source code or something readable for a non-graphic guy?

• "but I am not sure if it is what I am looking for" - why do you expect that others would know what you're looking for? It's not obvious what you want from the way you formulated it. There's infinitely many ways to cover a polygon with rectangles. The simplest is to just take max and min $x,y$ vertices and create a rectangle based on that. – lightxbulb Feb 13 at 13:14
• Yes if the number of rectangle is 1. I need one algorithm that does that but choosing the number of rectangles – Randomize Feb 13 at 13:17
• For not sure what I am looking for is the high number of papers that I am not able to understand properly as non-graphic guy. – Randomize Feb 13 at 13:19
• As I said, this has infinitely many solutions. If you want n rectangles, you could just partition that 1 rectangle into however many you want. The issue here is that as you formulated your problem it's underconstrained. – lightxbulb Feb 13 at 13:20
• In that way it won’t grant me minimum area coverage. If you take a triangle and apply that how it will work? – Randomize Feb 13 at 13:22