Opened 10 years ago
Last modified 8 years ago
#8366 assigned Bugs
"Overlay invalid input exception" (3)
Reported by: | Owned by: | Barend Gehrels | |
---|---|---|---|
Milestone: | To Be Determined | Component: | geometry |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | spikes, polygon, multi polygon, difference, sym_difference | Cc: |
Description
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.
As always, my polygon type is oriented counter-clockwise and not closed, my point type is based on int.
This is the data that triggers the exception:
_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; }
This is my code that wraps boost::geometry to implement the operators used above:
template<typename T> template<typename Geometry> _TPolygon< T > _TPolygon< T >::operator-(Geometry const& geometry) const { // should not be necessary //if( boost::geometry::area(geometry)==0 ) return *this; _TPolygon< T > polygonOut; boost::geometry::difference(*this, geometry, polygonOut); // should not be necessary //boost::geometry::correct( polygonOut ); return polygonOut; } template<typename T> template<typename Geometry> _TPolygon<T>& _TPolygon< T >::operator-=(Geometry const& geometry) { // boost::geometry::difference cannot operate in-place // http://lists.boost.org/geometry/2012/02/1796.php *this = *this - geometry; return *this; } template<typename T> template<typename Geometry> _TPolygon< T > _TPolygon< T >::operator^(Geometry const& geometry) const { _TPolygon< T > polygonOut; boost::geometry::sym_difference(*this, geometry, polygonOut); // should not be necessary //boost::geometry::correct( polygonOut ); return polygonOut; }
Change History (6)
comment:1 by , 10 years ago
comment:2 by , 9 years ago
Keywords: | spikes added |
---|---|
Milestone: | To Be Determined → Boost 1.55.0 |
Status: | new → assigned |
comment:3 by , 9 years ago
Milestone: | Boost 1.55.0 → To Be Determined |
---|
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.
Note for think-cell: RT 7732