Theoretical Computer Science Stack Exchange is a question and answer site for theoretical computer scientists and researchers in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to cover a simple concave polygon with a minimum rectangles. My rectangles can be any length, but they have maximum widths, and the polygon will never have an acute angle.

I thought about trying to decompose my concave polygon into triangles that produce a set of minimumally overlapping rectangles minimally bounding each triangle and then merging those rectangles into larger ones. However, I don't think this will work for small notches in the edges of the polygon. The triangles created by the reflex vertices on those notches will create the wrong rectangles. I am looking for rectangles that will span/ignore notches.

I don't really know anything about computational geometry, so I'm not really sure on how to begin asking the question.

I found other posts that were similar, but not what I need:

Some examples: Black is the input. Red is the acceptable output.

enter image description here

Another exmaple: The second output is prefered. However, generating both outputs and using another factor to determine preference is probably necessary and not the responsibility of this algorithm.

enter image description here

enter image description here

Polygons that mimic curves are extremely rare. In this scenario much of the area of the rectangles is wasted. However, this is acceptable because each rectangle obeys the max width constraint.

enter image description here

Also, I found this article to be close to what I need:

Maybe a better question is "How can I identify rectangular-like portions of a concave polygon?" enter image description here

Here is an image showing the desired implementation: enter image description here

The green is the actual material usage. The red rectangles are the layouts. The blue is the MBR of the entire polygon. I am thinking I should try to get little MBRs and fill them in. The 2-3 green rectangles in the upper left corner that terminate into the middle of the polygon are expensive. That is what I want to minimize. The green rectangles have a min and max width and height, but I can use as many rows and columns necessary to cover a region. Again, I must minimize the number of rectangles that do not span across the input. I can also modify the shape of the green rectangle to fit in small places that is also very expensive. In other words, getting as many rectangles as possible to span as much as possible is ideal.

share|cite|improve this question
Your title says convex polygons, but the question talks of concave polygons. Perhaps you need to make some corrections? – Ankur Aug 22 '12 at 1:50
@JukkaSuomela, in the first two pictures, the polygon is roughly the same size, and in the first picture, I could have run three rectangles vertically as I did in the second. However, this is less desirable. I think the trick has to do with the perimeters of the rectangles. Maybe what I am trying to do is minimize the amount of boundry of rectangle that is inside of the polygon, and maximize the amount of boundry that is collinear with the edges of the polygon. However, sometimes the rectangles must spill out of the polygon to cover it fully. – Josh C. Aug 22 '12 at 14:00
@JohnMoeller, I understand. This is a problem where a human can identify the solution easily but stating the problem correctly is quite difficult. The problem is similar to laying carpet or wall paper and the actual problem is a structural/architectual one. I am trying to identify regions of rectangular layouts that later will be filled with another form of tesselation. Finding those rectangles and handling the non-rectangular regions is the problem. Let me know if I can explain more. – Josh C. Aug 22 '12 at 20:54
I think we should approach this first as a modelling question: the goal is not to come up with an algorithm that solves a well-defined optimisation problem, but the goal is to define the optimisation problem. – Jukka Suomela Aug 22 '12 at 21:01
@JoshC.: Perhaps it would be also helpful if you tried to tell us more about the real-world application. I gather from your description that, for example, cutting is fairly expensive — ideally, the rectangular pieces would require as little cutting as possible. Is this correct? – Jukka Suomela Aug 22 '12 at 21:03

This is a variant of geometric set cover. Depending on the exact settings, you might be able to do some good approximation. The problem is of course NP-Hard. The natural huersitics are to use greedy algorithm (always pick the rectangle/strip that covers the most area not covered yet. The alternative technique is to use reweighing. There are some interesting theoretical results, but frankly, nothing that should be too useful in practice. One interesting hueristic you might want to try, is to first decompose your polygon into minimal number of convex shapes (using Keil dynamic programming algorithm), and then covering each convex polygon separately...

share|cite|improve this answer
I'm not familiar with the Keil Dynamic Programming algorithm. However, I did find a method to work using a combination of the Largest-Inscribed Rectangle and Minimum-Bounding Rectangle algorithms with some variants based upon heuristics. – Josh C. Dec 4 '12 at 14:37

I think this paper may be of some help. Obviously it's not the same problem--in fact it's the reverse problem, covering a rectangle with polygons--but some of the ideas could be a starting point. In particular, this reverse problem is NP-hard and I suspect yours may be as well (though there's no obvious extension of the reduction as far as I can tell).

E. Arkin, A. Efrat, G. Hart, I. Kostitsyna, A. Kroller, J. Mitchell, and V. Polishchuk. Scandinavian Thins on Top of Cake: On the Smallest One-Size-Fits-All Box. Fun with Algorithms. pg.16-27. 2012

share|cite|improve this answer
Thank you for your suggestion. I've been working with the engineering and manufacturing departments at my company to bring more clarificaiton to this problem. I am still waiting to confirm, but I am now thinking an algorithm that would return sets of largest inscribed rectangles would work. While it does not completely cover the shape, it would give preference to the orthognal regions while leaving the non-orthogonal regions to some heuristics. The only trick is to maxamize those orthogonal regions. See my last image with the 9 lamda-like figures. – Josh C. Aug 23 '12 at 17:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.