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

Subject: [Boost-bugs] [Boost C++ Libraries] #9206: intersection of non-closed polygons returns closed polygon
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-07 10:04:16


#9206: intersection of non-closed polygons returns closed polygon
-------------------------------------------------+-------------------------
 Reporter: Volker Schöch <volker@…> | Owner:
     Type: Bugs | barendgehrels
Milestone: To Be Determined | Status: new
  Version: Boost 1.52.0 | Component: geometry
 Keywords: intersection, multi-polygon, | Severity: Problem
  polygon, closed, open, correct |
-------------------------------------------------+-------------------------
 The output multi-polygon from boost::geometry::intersection 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.

 ''Note: The sym_difference and difference algorithms have the same problem
 which I filed as separate tickets #8375, #8376.''

 This is the data used as input to intersection:

 {{{
 _TPolygon<int> const polygon =
         _TPolygon<int>("MULTIPOLYGON(((1374 1092,1734 1092,3174 2526,3174
 2886,1374 2886)))")
         & _TPolygon<int>("POLYGON((2817 2449,2817 2603,3134 2603,3134
 2449,2817 2449))");
 }}}

 This is the resulting multi-polygon, with the polygon being closed:

 {{{
 MULTIPOLYGON(((3134 2486,3134 2603,2817 2603,2817 2449,3096 2449,3134
 2486)))
 }}}

 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::intersection(*this, geometry, polygonOut);

         // should not be necessary
         //boost::geometry::correct( polygonOut );

         return polygonOut;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9206>
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:14 UTC