Boost logo

Geometry :

Subject: Re: [geometry] Bug in boost geometry 1.48: union of 2 polygons is wrong.
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-01-14 05:20:32

Hi Zachary,

Thanks for your reproduction scenario.

On 14-1-2012 2:03, Zachary Deretsky wrote:
> Union of 2 polygons in the input3.png produces incorrect polygon in
> output3.png.
> Below is the code, which reproduces it, You can actually delete
> everything below the line " // THIS IS THE SIMPLE CASE END"

You define a point with *integer *coordinates. That is allowed, of
course, it compiles and links, but it is not heavily tested with the
library. This scenario also proves that...

Using *integer* will also cause problems as soon as segments intersect
on non-integer coordinates of course.

I just noted that also SVG maps are not reproduced if integer
coordinates are used (due to transformations).

Using *double* coordinates, the result is OK, so that is my current
advice. Alternatively Boost.Polygon is specificly developed to integer
intersections, with no doubts it will handle this correctly.

But of course I will have a look what is exactly going wrong here
because I agree that this simple case should be handled correctly in
*integer *coordinates.

Thanks, Barend

Geometry list run by mateusz at