I have a (not necessarily convex) polygon. I’d like to find a set of rectangles that take up all space in the world bounds ((0,0) to (100,100)) without taking up any space inside the polygon. What’s the easiest way to find these polygons? Are there algorithms for this sort of thing?
Thanks!
For example, the polygon
__ __
| |__| |
|________|
could be broken in to the following five rectangles:
aaabbbbbbbbbbeee
aaa| |cc| |eee
aaa|________|eee
aaaddddddddddeee
or, alternatively, the following six rectangles:
aaaaaaabbccccccc
eee| |bb| |ddd
eee|________|ddd
ffffffffffffffff
Is there an easy way to break a polygon into the rectangles between the polygon and the world boundaries?
All that I can glean: It’s possible but impractical (especially if your polygon has slanted lines). I don’t need this answer any more, but I guess that the algorithm would look something like the following: