Boost C++ Libraries: Ticket #10803: union algorithm returning invalid geometry https://svn.boost.org/trac10/ticket/10803 <p> My "_intPolygon" type is actually a multi-polygon, 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">_intPolygon polygonA; boost::geometry::read_wkt("MULTIPOLYGON(((3174 1374,3174 2886,1374 2886,1374 2139,3174 1374)))", polygonA); // does not throw boost::geometry::correct(polygonA); // remove redundant closing point returned by wkt boost::geometry::is_valid(polygonA); // returns true _intPolygon polygonB; boost::geometry::read_wkt("MULTIPOLYGON(((1374 1092,1734 1092,3174 2526,3174 2886,1374 2886,1374 1092)))", polygonB); // does not throw boost::geometry::correct(polygonB); // remove redundant closing point returned by wkt boost::geometry::is_valid(polygonB); // returns true _intPolygon polygonC; boost::geometry::union_(polygonA, polygonB, polygonC); // polygonC = MULTIPOLYGON(((1374 809,1374 1092,1734 1092,3529 1718,3174 1374,3174 2526,3174 2886,1374 2886,1374 2139,1374 809))) boost::geometry::is_valid(polygonC); // returns FALSE boost::geometry::remove_spikes(polygonC); // polygonC = MULTIPOLYGON(((1374 1092,1734 1092,3529 1718,3174 1374,3174 2526,3174 2886,1374 2886,1374 2139,1374 1092))) boost::geometry::is_valid(polygonC); // still returns FALSE </pre><p> May be related to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10661" title="#10661: Bugs: difference algorithm returning invalid geometry (closed: duplicate)">#10661</a>.<br /> May be related to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9828" title="#9828: Bugs: boost::geometry::union_(...) creates redundant closing point (closed: fixed)">#9828</a>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10803 Trac 1.4.3 vschoech@… Mon, 21 Sep 2015 15:20:17 GMT <link>https://svn.boost.org/trac10/ticket/10803#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10803#comment:1</guid> <description> <p> This problem is still present in 1.59.0. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Barend Gehrels</dc:creator> <pubDate>Sun, 01 Nov 2015 11:13:22 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/10803#comment:2 https://svn.boost.org/trac10/ticket/10803#comment:2 <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">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.60.0</span> </li> </ul> <p> Checked in current code, should be fixed in 1.60. I did not modify the code but added a unit testcase for this ticket and checked validity too. </p> <p> Current output is (((1374, 2139), (1374, 1092), (1734, 1092), (2364, 1718), (3174, 1374), (3174, 2526), (3174, 2886), (1374, 2886))) </p> <p> (this is CSV (bg::dsv) - note that bg::wkt explicitly closes polygons to conform to wkt specification). The output is a bit different than in the ticket. </p> Ticket