#8364 closed Bugs (fixed)
"Overlay invalid input exception" (1)
Reported by: | Owned by: | Barend Gehrels | |
---|---|---|---|
Milestone: | Boost 1.55.0 | Component: | geometry |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | spikes, polygon, multi polygon, 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(((1031 1056,3232 1056,3232 2856,1031 2856)))" ); polygon -= _intPolygon( "MULTIPOLYGON(((1032 1458,1032 1212,2136 2328,3234 2220,3234 2412,2136 2646)))" ); polygon -= _intPolygon( "MULTIPOLYGON(((1032 1764,1032 1458,2136 2646,3234 2412,3234 2532,2136 2790)))" ); polygon -= _intPolygon( "MULTIPOLYGON(((1032 2130,1032 1764,2052 2712)),((3234 2580,2558 2690,3234 2532)),((2558 2690,2136 2790,2052 2712,2136 2760)))" ); polygon -= _intPolygon( "MULTIPOLYGON(((1032 2556,1032 2130,1778 2556)),((3234 2580,2136 2760,1778 2556,3234 2556)))" );
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; }
Attachments (0)
Change History (5)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
Our conversation on the geometry mailing list regarding this issue in 1.48.0: http://lists.boost.org/geometry/2012/02/1871.php
comment:3 Changed 4 years ago by
Keywords: | spikes added |
---|---|
Milestone: | To Be Determined → Boost 1.55.0 |
Status: | new → assigned |
comment:4 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [85451]) [geometry] avoid generation of spikes in overlays, this fixes ticket 8364 and 8365. Added unit tests for these tickets. These changes result in (at about 3 places) changes in the output-number-of-points, this is verified visually
comment:5 Changed 4 years ago by
I can confirm that the problem is no longer reproducible with boost 1.55.0.
Note for think-cell: RT 7459