[Boost-bugs] [Boost C++ Libraries] #6560: The intersection of these two polygons returns an empty result

Subject: [Boost-bugs] [Boost C++ Libraries] #6560: The intersection of these two polygons returns an empty result
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-15 14:36:28


#6560: The intersection of these two polygons returns an empty result
-------------------------------------+--------------------------------------
 Reporter: anders.jel@… | Owner: ljsimons
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: polygon
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------+--------------------------------------
 This may be related to #5103.

 The following program prints a zero area for the intersection of the two
 polygons.

 {{{
 #!cpp
 #include <boost/polygon/polygon.hpp>
 #include <vector>
 #include <iostream>

 using namespace boost::polygon;
 using namespace boost::polygon::operators;

 int main()
 {
     typedef point_data<int64_t> point;

     std::vector<point> a;
     a.push_back(point( 50000000000, 50000000000));
     a.push_back(point( 12500000000, 50000000000));
     a.push_back(point( 0, 100000000000));
     a.push_back(point(-12500000000, 50000000000));
     a.push_back(point(-50000000000, 50000000000));
     a.push_back(point(-50000000000, -50000000000));
     a.push_back(point(-37500000000, -50000000000));
     a.push_back(point(-50000000000, -100000000000));
     a.push_back(point( 50000000000, -100000000000));
     a.push_back(point( 37500000000, -50000000000));
     a.push_back(point( 50000000000, -50000000000));
     a.push_back(point( 50000000000, 50000000000));

     polygon_data<int64_t> polygon_a;
     set_points(polygon_a, a.begin(), a.end());

     std::vector<point> b;
     b.push_back(point(-47702617860, 50000000000));
     b.push_back(point( 50000000000, 50000000000));
     b.push_back(point( 50000000000, -88753775284));
     b.push_back(point(-47702617860, -88753775284));

     polygon_data<int64_t> polygon_b;
     set_points(polygon_b, b.begin(), b.end());

     polygon_set_data<int64_t> intersection = polygon_a * polygon_b;
     std::cout << area(intersection) << std::endl; // Prints 0

     std::vector<polygon_data<int64_t> > polygons_in_intersection;
     intersection.get(polygons_in_intersection);
     std::cout << polygons_in_intersection.size() << std::endl; // Prints 0

     return 0;
 }
 }}}

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