Boost logo

Geometry :

Subject: [ggl] Difference / xor for multi polygons
From: Barend Gehrels (barend)
Date: 2011-02-26 14:10:06


Hi Javier,

On 26-2-2011 19:56, Javier Gonzalez wrote:
> (...) else if (clipType == clip_type_difference)
> difference_inserter<polygon_2d>(subjectPoly, clipPoly,
> back_inserter(outputPoly)); // ??? does not compile
> else // xor
> sym_difference_inserter<polygon_2d>(subjectPoly, clipPoly,
> back_inserter(outputPoly)); // ??? does not compile
>
> return outputPoly;
> }
> };
>
>
> But there seems to be no multi algorithms for difference and sym
> difference (xor)

difference and sym_difference work for with multi-geometries as output,
but the inserter is missing. I noticed that this week writing their
documentation. Will be added. Thanks for the notice.

>
> PS: I'm assuming a multi_polygon is needed for example for two
> separated "donuts" (two separated polygons with an outer ring and an
> inner ring each)
> Do I really need to use multi polygons or would a simple polygon be
> able to hold both figures?

As soon as you have two separated polygons as one of the inputs, yes,
you need a multi-polygon. And they both might have zero or more interior
rings.

Regards, Barend

-- 
Barend Gehrels
http://about.me/barendgehrels

Geometry list run by mateusz at loskot.net