Boost logo

Geometry :

Subject: [ggl] Polygon difference
From: Barend Gehrels (barend.gehrels)
Date: 2011-01-10 04:09:39


hi Vishnu,

On 10-1-2011 3:34, Vish wrote:
>
> I get an empty polygon list from a polygon difference calculation 'a
> NOT b'. Neither polygon 'a' nor 'b' has a hole and 'b' is completely
> inside 'a'. Polygons 'a' and 'b' are passed into an
> intersection_inserter after reversing the boundary of 'b'.
>
> I read the posting of Feb 28, 2010 titled "XOR and/or DIFFERENCE
> boolean polygon combination". In that posting, a problematic case was
> described, when rings of 'b' do not intersect rings of 'a'. It was
> mentioned that some additional work needed to be done to assemble the
> rings.
>
> Does this problematic case remain unresolved, and if so, is there a
> workaround?

This is solved last December, but you have to use the "difference"
algorithm now. So reversing beforehand is not necessary anymore. So
difference and sym_difference now work for all combinations. There is
still an issue with self-tangencies, but in "normal" cases it should
always work.

Note that because it is solved recently, you have to take a recent set,
so either Boost Trunk or 0.8.0 here:
http://svn.boost.org/svn/boost/sandbox-tags/geometry/boost-geometry-0.8.0/

Regards, Barend


Geometry list run by mateusz at loskot.net