[Boost-bugs] [Boost C++ Libraries] #10661: difference algorithm returning invalid geometry

Subject: [Boost-bugs] [Boost C++ Libraries] #10661: difference algorithm returning invalid geometry
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-10-15 16:26:52


#10661: difference algorithm returning invalid geometry
-------------------------------------------------+-------------------------
 Reporter: Volker Schöch <vschoech@…> | Owner:
     Type: Bugs | barendgehrels
Milestone: To Be Determined | Status: new
  Version: Boost 1.56.0 | Component: geometry
 Keywords: difference, multi-polygon, polygon, | Severity: Regression
  self-intersection |
-------------------------------------------------+-------------------------
 My "_TPolygon" type is actually a '''multi-polygon''', using a polygon
 type that is based on '''int''', oriented '''counter-clockwise''' and
 '''open''' (not closed). Please consider the following example:
 {{{
 _TPolygon<int> 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

 _TPolygon<int> 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

 _TPolygon<int> 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!

 _TPolygon<int> 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

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

 This '''worked in boost 1.55.0'''. The result for polygonC was slightly
 different in 1.55.0, and there was a reasonable(?) result for polygonE:
 {{{
 polygonC: MULTIPOLYGON(((1701 1122,1701 985,3501 985,3501 2785,3492
 2785,3492 1842,2598 1392,1701 1122)),((1701 1861,2598 2340,2611 2785,1701
 2785,1701 1861)))
 polygonE: MULTIPOLYGON(((3492 2412,3492 1842,2598 1392,1701 1122,1701
 985,3501 985,3501 2785,3492 2785,3492 2412),(1701 1861,2598 2340,1701
 1861)))
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10661>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC