Subject: [ggl] XOR and/or DIFFERENCE boolean polygon combination?
From: Barend Gehrels (Barend.Gehrels)
Date: 2010-02-28 16:41:37
>> If not, are any (or both) of them planned? If they are, any wild
>> estimation of when?
> A wild estimation is "this spring". All ingredients are there but the
> details have to be implemented and worked out.
The wild estimation is still this spring, but because all the
ingredients are there I thought to experiment already how it would look
like. The result is that, as expected, in cases where all rings
intersect the theory works. That means: the intersection of polygon A
with the reversed of polygon B (i.e. all its rings reversed), you will
get the difference. Because it is that easy I added this to the
headerfile "difference", so the difference is essentially there. Same
for sym_difference, but there it is done twice and the results are
A long story, the code is shorter, basically:
inline void difference(Geometry1 const& geometry1, Geometry2 geometry2,
intersection(geometry1, geometry2, output_collection);
However, I said it is "essentially" working, because for the
non-intersecting rings there is some more to do. That means that e.g. if
there is a hole in a polygon, and it does not intersect, it is not in
the result while it should be, or the other way round. So the
assemble-process (collecting rings) should be adapted to support this.
That estimation is still "this spring".
A small sample is this:
so the red stroked part is the correct difference of blue minus green.
It goes wrong with cases like this:
where the blue colored hole in the green polygon should have been
-------------- next part --------------
Skipped content of type multipart/related
Geometry list run by mateusz at loskot.net