Boost logo

Geometry :

Subject: [ggl] Difference / xor for multi polygons
From: Barend Gehrels (barend)
Date: 2011-03-07 02:55:21


On 7-3-2011 4:23, Javier Gonzalez wrote:
> Oh, before I forget, sometimes I'm getting a lot (and I mean a lot,
> like 313) polygons that are just single points (polygons like 123 123,
> 123 123) in the result vs 7 real (3 or more points) polygons.
> Right now I'm just filtering them out, is that normal?

By chance I noticed this two days ago. Didn't see it earlier, so I think
it is caused by the refactoring of the assembly phase. Those "polygons"
do have an area of 0.0 and formerly they must have been filtered out, I
will do that again now. Thanks for reporting.

> It usually happens while making unions of "tiles", this is, rectangles
> of 40x40 (for example) units, like
>
> rect from 0,0 to 40, 40 + rect from 40, 0 to 80, 40 + rect from 0,40
> to 40,80 etc and the like (I'm not implying it happens for that
> particular case however, didn't try)
> Probably you might want to make an automated test for that...

Good idea. Yes, those single-point-polygon do have an area of zero so in
the self-validating tests I'm doing, they do not count... But in the
unit tests they should trigger (because I'm counting polygons there as
well). So I'll make a unit test of that case.

Barend

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

Geometry list run by mateusz at loskot.net