Boost logo

Geometry :

Subject: [ggl] Convert polygon with holes to polygons with no holes
From: Barend Gehrels (barend.gehrels)
Date: 2010-06-16 09:57:56

Hi Dan,

Sorry I didn't react earlier.

Macumber, Daniel wrote:
> I may be missing something simple, but I was wondering if it is possible to convert a polygon with holes to a set of polygons with no holes. An alternate solution to me would be an algorithm to traverse all of the outer and inner loops in such a way to describe a single outer loop, it is permissible to visit the same vertex more than once and also to make zero thickness cuts through the polygon provided they are closed again. Does this library provide any functionality like this
No, Boost.Geometry does not (yet) provide conversion from polygons with
holes to so-called key-holed polygons as you describe. Normally this is
necessary or useful for graphic user interfaces. The algorithm is not
that difficult, visiting the outer polygon and after that the inner
rings, while pushing the first point of the outer polygon between all
inner rings, is normally enough. This can be done by normal iterators.

Regards, Barend

Geometry list run by mateusz at