Boost logo

Geometry :

Subject: [ggl] Problems with the difference between two polygons
From: Barend Gehrels (barend)
Date: 2011-07-17 09:05:17


Hi Enrico,

On 16-7-2011 19:32, Enrico Leoni wrote:
> Hi, in the example below I am having problems.

Thanks for the report.

> s1, the difference between pa and pb, should have three polygons (each
> with an outer ring) but one is missing (this also happens with
> ttmath).

I get different results. For me, the first result s1 is OK. However, if
I then take the other difference from p-s1, I get indeed 2 of expected
3. I will have a closer look.

> Furthermore s1 seems to be self-intersecting but it shouldn't.

Right, it considers duplicate points as self-intersecting. I will solve
that. In the meantime, if you add "unique" after the first call to
difference, they are removed and it is OK. I could have done that in the
results of the intersections, but it is the intention that duplicate
points are not generated...

Anyway, it will be solved.

> I'm using the last trunk revision and Visual Studio 2010.

It might also be good to call boost::geometry::correct to your input
polygons, because they are not closed. But that does not solve your
second problem (maybe it solves the first).

Regards, Barend


Geometry list run by mateusz at loskot.net