Boost C++ Libraries: Ticket #12753: difference algorithm returning invalid geometry https://svn.boost.org/trac10/ticket/12753 <p> My "tc::geo::polygon" type is actually a <strong>multi-polygon</strong>, using a polygon type that is based on <strong>int</strong>, oriented <strong>counter-clockwise</strong> and <strong>open</strong> (not closed). Please consider the following example: </p> <pre class="wiki">tc::geo::polygon&lt;int&gt; polygonA; boost::geometry::read_wkt("MULTIPOLYGON(((529 3217,529 998,5337 998,5337 1834,5070 2000,5337 2072,5337 3475,529 3475,529 3312,1734 2054,2934 1670,3230 1690,2934 1400,1734 1784,529 3217),(4140 2582,5071 2001,4140 1754,3231 1691,4140 2582)))", polygonA); // does not throw boost::geometry::is_valid(polygonA); // returns true tc::geo::polygon&lt;int&gt; polygonB; boost::geometry::read_wkt("MULTIPOLYGON(((528 3218,528 2498,1734 1406,2556 1522,1734 1784,528 3218)),((4610 2288,5340 1178,5340 1832,4609 2289,4140 3002,2934 1574,2555 1521,2934 1400,4140 2582,4610 2288)))", polygonB); // does not throw boost::geometry::is_valid(polygonB); // returns true tc::geo::polygon&lt;int&gt; polygonC; boost::geometry::difference(polygonA, polygonB, polygonC); // does not throw // polygonC: MULTIPOLYGON(((2553 1521,1734 1406,529 2498,529 998,5337 998,5337 1183,4839 1939,4140 1754,3231 1691,4140 2582,3230 1690,2934 1400,2555 1521,2556 1522,2553 1521)),((1734 1784,529 3217,529 3216,1734 1784)),((3020 1676,4140 3002,4609 2289,5071 2001,5337 2072,5337 3475,529 3475,529 3312,1734 2054,2934 1670,3020 1676))) boost::geometry::is_valid(polygonC); // returns false! </pre><p> The difference of two valid multi-polygons yields an invalid multi-polygon. </p> <p> May be related to tickets <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10661" title="#10661: Bugs: difference algorithm returning invalid geometry (closed: duplicate)">#10661</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11674" title="#11674: Bugs: difference algorithm returning invalid geometry (closed: duplicate)">#11674</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11676" title="#11676: Bugs: difference algorithm returning invalid geometry (closed: fixed)">#11676</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12751" title="#12751: Bugs: difference algorithm returning invalid geometry (closed: fixed)">#12751</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12752" title="#12752: Bugs: difference algorithm returning invalid geometry (regression over 1.59.0) (closed: fixed)">#12752</a>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12753 Trac 1.4.3 Barend Gehrels Sun, 26 Mar 2017 11:22:04 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12753#comment:1 https://svn.boost.org/trac10/ticket/12753#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> Identical to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11674" title="#11674: Bugs: difference algorithm returning invalid geometry (closed: duplicate)">#11674</a> Alas behavior is not yet solved (though I did work on validity for this release) </p> Ticket Volker Schöch <vschoech@…> Thu, 14 Jun 2018 10:19:47 GMT <link>https://svn.boost.org/trac10/ticket/12753#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12753#comment:2</guid> <description> <p> Still reproducible in 1.67.0. </p> </description> <category>Ticket</category> </item> </channel> </rss>