Reputation: 2029
Given a set of arbitrarily placed, non-overlapping rectangles; how could I find a polygon that represents a natural border around the points that make up the rectangles? To illustrate:
How can I find either the green or blue line? I have tried, but not succeeded, with the following:
I'm unsure if I'm missing something obvious or if this is actually a harder problem than I initially expected.
Upvotes: 1
Views: 78
Reputation: 4406
Here is a heuristic. Compute the hull H1 of the rectangles. Now compute the hull H2 of the rectangle corners not on H1. So now you have two nested convex hulls. Consider moving an edge e of H1 to a vertex v of H2. Some such moves can be excluded because the two new edges cross a rectangle. Choose to accept the smallest altitudes of the triangle formed by e and v, as suggested in the image below.
Upvotes: 1