I am about to file this as a bug report, but given the discussion here I think it makes sense to have someone review the issue first.

My “polygon” type is actually a multi-polygon. It is oriented counter-clockwise and not closed, my point type is based on int.

 

_intPolygon polygonA;

boost::geometry::read_wkt("MULTIPOLYGON(((1701 985,3501 985,3501 2785,1701 2785,1701 985)))", polygonA); // does not throw

boost::geometry::is_valid(polygonA); // returns true

 

_intPolygon polygonB;

boost::geometry::read_wkt("MULTIPOLYGON(((1698 1860,1698 1122,2598 1392,3492 1842,3492 32706,2598 2340,1698 1860)))", polygonB); // does not throw

boost::geometry::is_valid(polygonB); // returns true

 

_intPolygon polygonC;

boost::geometry::difference(polygonA, polygonB, polygonC); // does not throw

// polygonC == MULTIPOLYGON(((1701 1122,1701 985,3501 985,3501 2785,3492 1857,3492 1842,2598 1392,1701 1122)),((1701 1861,2598 2340,1669 2785,1701 2785,1701 1861)))

boost::geometry::is_valid(polygonC); // returns false!

 

_intPolygon polygonD;

boost::geometry::read_wkt("MULTIPOLYGON(((1698 2772,1698 1860,2598 2340,3492 2412,3492 32743,1698 2772)))", polygonD); // does not throw

boost::geometry::is_valid(polygonD); // returns true

 

_intPolygon polygonE;

boost::geometry::difference(polygonC, polygonD, polygonE); // throws "Boost.Geometry Overlay invalid input exception"!

 

Any suggestions or comments are greatly appreciated.

Thanks

   Volker

--
Volker Schöch | vschoech@think-cell.com
Senior Software Engineer


We are looking for C++ Developers: http://www.think-cell.com/career

think-cell Software GmbH http://www.think-cell.com
Chausseestr. 8/E phone / fax +49 30 666473-10 / -19
10115 Berlin, Germany US phone / fax +1 800 891 8091 / +1 212 504 3039
Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306
Directors: Dr. Markus Hannebauer, Dr. Arno Schödl