Boost C++ Libraries: Ticket #8365: "Overlay invalid input exception" (2) https://svn.boost.org/trac10/ticket/8365 <p> Please find below some code that triggers "Overlay invalid input exception" (in the last statement of the example). I have a couple of different reproductions, and since I'm not sure if they all share the same root cause, I'm filing them in separate tickets. </p> <p> As always, my polygon type is oriented <strong>counter-clockwise</strong> and <strong>not closed</strong>, my point type is based on <strong>int</strong>. </p> <p> This is the data that triggers the exception: </p> <pre class="wiki">_intPolygon polygon( "MULTIPOLYGON(((971 1402,5395 1402,5395 3353,971 3353)))" ); { _intPolygon const polygonB = _intPolygon("MULTIPOLYGON(((966 2862,1704 3348,2442 3186,3180 2376,3912 1722,4650 1398,5388 1560,5388 32767,966 32767)))") ^ _intPolygon("MULTIPOLYGON(((966 2700,1704 3348,2442 3186,3180 2376,3912 1884,4650 1398,5388 1560,5388 32767,966 32767)))"); polygon -= polygonB; } { _intPolygon const polygonB = _intPolygon("MULTIPOLYGON(((966 2700,1704 3348,2442 3186,3180 2376,3912 1884,4650 1398,5388 1560,5388 32767,966 32767)))") ^ _intPolygon("MULTIPOLYGON(((966 2700,1704 3024,2442 3186,3180 2376,3912 1884,4650 1722,5388 1560,5388 32767,966 32767)))"); polygon -= polygonB; } { _intPolygon const polygonB = _intPolygon("MULTIPOLYGON(((966 2700,1704 3024,2442 3186,3180 2376,3912 1884,4650 1722,5388 1560,5388 32767,966 32767)))") ^ _intPolygon("MULTIPOLYGON(((966 2208,1704 3024,2442 3186,3180 2376,3912 2376,4650 1722,5388 1560,5388 32767,966 32767)))"); polygon -= polygonB; } </pre><p> This is my code that wraps boost::geometry to implement the operators used above: </p> <pre class="wiki">template&lt;typename T&gt; template&lt;typename Geometry&gt; _TPolygon&lt; T &gt; _TPolygon&lt; T &gt;::operator-(Geometry const&amp; geometry) const { // should not be necessary //if( boost::geometry::area(geometry)==0 ) return *this; _TPolygon&lt; T &gt; polygonOut; boost::geometry::difference(*this, geometry, polygonOut); // should not be necessary //boost::geometry::correct( polygonOut ); return polygonOut; } template&lt;typename T&gt; template&lt;typename Geometry&gt; _TPolygon&lt;T&gt;&amp; _TPolygon&lt; T &gt;::operator-=(Geometry const&amp; geometry) { // boost::geometry::difference cannot operate in-place // http://lists.boost.org/geometry/2012/02/1796.php *this = *this - geometry; return *this; } template&lt;typename T&gt; template&lt;typename Geometry&gt; _TPolygon&lt; T &gt; _TPolygon&lt; T &gt;::operator^(Geometry const&amp; geometry) const { _TPolygon&lt; T &gt; polygonOut; boost::geometry::sym_difference(*this, geometry, polygonOut); // should not be necessary //boost::geometry::correct( polygonOut ); return polygonOut; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8365 Trac 1.4.3 Volker Schöch <vschoech@…> Tue, 02 Apr 2013 15:54:10 GMT <link>https://svn.boost.org/trac10/ticket/8365#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8365#comment:1</guid> <description> <p> Note for think-cell: RT 7681 </p> </description> <category>Ticket</category> </item> <item> <author>Volker Schöch <vschoech@…></author> <pubDate>Wed, 03 Apr 2013 11:59:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8365#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8365#comment:2</guid> <description> <p> Our conversation on the geometry mailing list regarding this issue in 1.48.0: <a class="ext-link" href="http://lists.boost.org/geometry/2012/05/1936.php"><span class="icon">​</span>http://lists.boost.org/geometry/2012/05/1936.php</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Barend Gehrels</dc:creator> <pubDate>Sat, 24 Aug 2013 20:03:33 GMT</pubDate> <title>keywords, status, milestone changed https://svn.boost.org/trac10/ticket/8365#comment:3 https://svn.boost.org/trac10/ticket/8365#comment:3 <ul> <li><strong>keywords</strong> spikes added </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> Ticket Barend Gehrels Sat, 24 Aug 2013 22:57:15 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8365#comment:4 https://svn.boost.org/trac10/ticket/8365#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed together with 8364, added a unit-test. Root cause were the spikes generated for integer polygons, they are now avoided on generation. (The related bug 8366 is influenced by this enhancement, but not yet fixed). </p> Ticket Volker Schöch <vschoech@…> Thu, 14 Nov 2013 10:09:49 GMT <link>https://svn.boost.org/trac10/ticket/8365#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8365#comment:5</guid> <description> <p> I can confirm that this problem is no longer reproducible with boost 1.55.0. </p> </description> <category>Ticket</category> </item> </channel> </rss>