[Boost-bugs] [Boost C++ Libraries] #8375: sym_difference of non-closed polygons returns closed polygon

Subject: [Boost-bugs] [Boost C++ Libraries] #8375: sym_difference of non-closed polygons returns closed polygon
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-03 11:48:33


#8375: sym_difference of non-closed polygons returns closed polygon
---------------------------------------------------------------------------+
 Reporter: Volker Schöch <vschoech@…> | Owner: barendgehrels
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: sym_difference, multi-polygon, polygon, closed, open, correct |
---------------------------------------------------------------------------+
 The output multi-polygon from boost::geometry::sym_difference should have
 the same orientation, closed-ness and underlying scalar data type, as the
 input (multi-)polygons. My polygon type is oriented '''counter-
 clockwise''' and '''not closed''', my point type is based on '''int'''.
 Please find below some code that results in a '''closed''' polygon.

 This is the data used as input to sym_difference:

 {{{
 _TPolygon<int> const polygonB =
         _TPolygon<int>("MULTIPOLYGON(((813 277,1341 319,1863 361,2391
 571,2913 361,3441 319,3963 277,3963 32767,813 32767)))")
         ^ _TPolygon<int>("MULTIPOLYGON(((813 277,1341 319,1863 571,2391
 571,2913 571,3441 319,3963 277,3963 32767,813 32767)))");
 }}}

 This is the resulting multi-polygon, consisting of two closed polygons:

 {{{
 polygonB: MULTIPOLYGON(((2391 571,1863 571,1341 319,1863 361,2391
 571)),((2391 571,2913 361,3441 319,2913 571,2391 571)))
 }}}

 This is my code that wraps boost::geometry to implement the operator used
 above:

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

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8375>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC