Boost logo

Geometry :

Subject: Re: [geometry] difference algorithm produces invalid polygon?
From: Volker Schöch (vschoech_at_[hidden])
Date: 2012-02-22 06:27:53

Hi Barend,

> Thanks for all your reports!

Here we go again... It may be the same root problem as with my last report, but the polygons are of a different kind (manhattan-like) so I just submit it to your data base to offer one more test case:

A1: MULTIPOLYGON(((2083 1071,3693 1071,3693 2868,2083 2868)))
B1: MULTIPOLYGON(((2079 1968,2301 1968,2301 1968,2079 1968)))
A1-B1: MULTIPOLYGON(((2083 1968,2083 1071,3693 1071,3693 2868,2083 2868,2083 1968,2301 1968)))

A2: A1-B1
B2: MULTIPOLYGON(((2079 1968,2301 1968,2301 1968,2079 1968)))
A2-B2: Boost.Geometry Overlay invalid input exception

The problem cannot be fixed by applying boost::geometry::correct on the output from boost::geometry::difference. Actually, in the data above, "A-B" is the result of applying "difference" to A and B and applying "correct" to the result.

I am still using boost 1.48.0, my polygon type is oriented counter-clockwise and not closed, my point type is based on int.

Again, while you may need some time to come up with a fix for the root cause (and boost 1.50 is many months away), any suggestions to hot-fix or work-around this issue in the meantime would be very welcome.


Volker Schöch | vschoech_at_[hidden]
Senior Software Engineer
think-cell Software GmbH | Chausseestr. 8/E | 10115 Berlin | Germany | phone +49 30 666473-10 | US phone +1 800 891 8091
Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306
Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl

Geometry list run by mateusz at