Boost C++ Libraries: Ticket #8366: "Overlay invalid input exception" (3) https://svn.boost.org/trac10/ticket/8366 <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(((529 998,5337 998,5337 3475,529 3475)))" ); { _intPolygon const polygonB = _intPolygon("MULTIPOLYGON(((528 3314,1734 2054,2934 1670,4140 1754,5340 2072,5340 32767,528 32767)))") ^ _intPolygon("MULTIPOLYGON(((528 3218,1734 1784,2934 1400,4140 2582,5340 1832,5340 32767,528 32767)))"); polygon -= polygonB; } { _intPolygon const polygonB = _intPolygon("MULTIPOLYGON(((528 3218,1734 1784,2934 1400,4140 2582,5340 1832,5340 32767,528 32767)))") ^ _intPolygon("MULTIPOLYGON(((528 2498,1734 1406,2934 1574,4140 3002,5340 1178,5340 32767,528 32767)))"); polygon -= polygonB; } { _intPolygon const polygonB = _intPolygon("MULTIPOLYGON(((528 2498,1734 1406,2934 1574,4140 3002,5340 1178,5340 32767,528 32767)))") ^ _intPolygon("MULTIPOLYGON(((528 2420,1734 2186,2934 2378,4140 2750,5340 1250,5340 32767,528 32767)))"); polygon -= polygonB; } { _intPolygon const polygonB = _intPolygon("MULTIPOLYGON(((528 2420,1734 2186,2934 2378,4140 2750,5340 1250,5340 32767,528 32767)))") ^ _intPolygon("MULTIPOLYGON(((528 1724,1734 2552,2934 1640,4140 2396,5340 1460,5340 32767,528 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/8366 Trac 1.4.3 Volker Schöch <vschoech@…> Tue, 02 Apr 2013 15:54:42 GMT <link>https://svn.boost.org/trac10/ticket/8366#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8366#comment:1</guid> <description> <p> Note for think-cell: RT 7732 </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Barend Gehrels</dc:creator> <pubDate>Sat, 24 Aug 2013 20:02:52 GMT</pubDate> <title>keywords, status, milestone changed https://svn.boost.org/trac10/ticket/8366#comment:2 https://svn.boost.org/trac10/ticket/8366#comment:2 <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 20:53:18 GMT milestone changed https://svn.boost.org/trac10/ticket/8366#comment:3 https://svn.boost.org/trac10/ticket/8366#comment:3 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.55.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> This one generates spikes, as the samples in the other tickets do, but the method to avoid them (to be committed soon) will not solve this issue. At least not in current form. Ticket 8364/8365 will be fixed, but not yet this one. To be determined. </p> Ticket Volker Schöch <vschoech@…> Thu, 14 Nov 2013 09:23:23 GMT version changed https://svn.boost.org/trac10/ticket/8366#comment:4 https://svn.boost.org/trac10/ticket/8366#comment:4 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.52.0</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> <p> Still reproducible in boost 1.55.0. </p> Ticket Volker Schöch <vschoech@…> Wed, 19 Nov 2014 15:14:35 GMT <link>https://svn.boost.org/trac10/ticket/8366#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8366#comment:5</guid> <description> <p> May be related to 10719. </p> </description> <category>Ticket</category> </item> <item> <author>Volker Schöch <vschoech@…></author> <pubDate>Wed, 19 Nov 2014 15:14:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8366#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8366#comment:6</guid> <description> <p> Sorry... <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10719" title="#10719: Bugs: Access violation crash in difference -&gt; enrich_sort (closed: fixed)">#10719</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>