Boost logo

Geometry :

Subject: [ggl] union_inserter with ring output
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-11-28 08:46:57

Hi Lee,

Welcome to the GGL-list!

> In the case of 'ring + ring -> ring' with union_inserter is there a
> guarantee that no less and no more than one result object will be output?

No, if both rings are disjoint, both will be output, so in that case you
get two objects.
If both rings are empty (zero coordinates), you should get nothing, but
this is probably an exceptional case.

> Such that the following code is always safe:
> void unite(my_ring const& r1, my_ring const& r2, my_ring& result)
> {
> std::vector<my_ring> v;
> ggl::union_inserter<my_ring>(r1, r2, std::back_inserter(v));
> v[0].swap(result);
> }
I would check for the size of v.

Regards, Barend

Geometry list run by mateusz at