Boost logo

Geometry :

Subject: Re: [geometry] "Overlay invalid input exception"
From: Volker Schöch (vschoech_at_[hidden])
Date: 2013-03-28 12:12:19


Barend,
>From the "better late than never" department... It seems that in geometry 1.52.0, some of the issues I had in 1.48.0 were fixed, but not all of them. Please find below some code that still triggers "Overlay invalid input exception" (in the last statement of each example).

Maybe you could have another look at these issues? If you prefer, I could as well file these issues in Boost Trac. If so, do you prefer one combined ticket, or a separate ticket for every code example?

As always, my polygon type is oriented counter-clockwise and not closed, my point type is based on int.
Regards
   Volker

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_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)))" );

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_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;
}

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_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;
}

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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;
}

--
Volker Schöch | vschoech_at_[hidden]<mailto:vschoech_at_[hidden]>
Senior Software Engineer
________________________________
think-cell Software GmbH        http://www.think-cell.com>
Chausseestr. 8/E        phone / fax     +49 30 666473-10 / -19
10115 Berlin, Germany   US phone / fax  +1 800 891 8091 / +1 212 504 3039
Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306
Directors: Dr. Markus Hannebauer, Dr. Arno Schödl


Geometry list run by mateusz at loskot.net