[Boost-bugs] [Boost C++ Libraries] #9804: boost::geometry::intersection returns input polygon when the result should be empty.

Subject: [Boost-bugs] [Boost C++ Libraries] #9804: boost::geometry::intersection returns input polygon when the result should be empty.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-24 08:00:03


#9804: boost::geometry::intersection returns input polygon when the result should
be empty.
------------------------------+---------------------------
 Reporter: Nick <7415963@…> | Owner: barendgehrels
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------
 The result of an intersection is sometimes equal to one of the input
 polygons, when the result should be empty. For example:

 {{{
     typedef boost::geometry::model::d2::point_xy<double> Point;
     typedef boost::geometry::model::polygon<Point> Polygon;
     Polygon pg1;
     Polygon pg2;
     boost::geometry::model::multi_polygon<Polygon> result;

     boost::geometry::append(pg1, Point(-6.0, 3.2500000000000013));
     boost::geometry::append(pg1, Point(-9.0, 3.2500000000000022));
     boost::geometry::append(pg1, Point(-9.0, 6.5));
     boost::geometry::append(pg1, Point(-6.0, 6.5));
     boost::geometry::append(pg1, Point(-6.0, 3.2500000000000013));

     boost::geometry::append(pg2, Point(-3.0, 0.0));
     boost::geometry::append(pg2, Point(-6.0, 0.0));
     boost::geometry::append(pg2, Point(-6.0, 3.2500000000000013));
     boost::geometry::append(pg2, Point(-3.0, 3.2500000000000009));
     boost::geometry::append(pg2, Point(-3.0, 0.0));

     boost::geometry::intersection(pg1, pg2, result);
 }}}

 After the intersection, result contains a polygon equal to pg1. We're
 using boost 1.55 and also tried the rescale_to_integer branch, which gives
 the same results.

 The problem seems to be with boost::geometry::within. We've previously had
 problems with within that we resolved by using a different strategy.
 Changing the strategy of the within calls in the function
 update_selection_map in select_rings.hpp makes intersection return the
 correct result for this case.

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