Ticket #6560: bug.cpp

File bug.cpp, 1.6 KB (added by anders.jel@…, 11 years ago)
Line 
1#include <boost/polygon/polygon.hpp>
2#include <vector>
3#include <iostream>
4
5using namespace boost::polygon;
6using namespace boost::polygon::operators;
7
8int main()
9{
10 typedef point_data<int64_t> point;
11
12 std::vector<point> a;
13 a.push_back(point( 50000000000, 50000000000));
14 a.push_back(point( 12500000000, 50000000000));
15 a.push_back(point( 0, 100000000000));
16 a.push_back(point(-12500000000, 50000000000));
17 a.push_back(point(-50000000000, 50000000000));
18 a.push_back(point(-50000000000, -50000000000));
19 a.push_back(point(-37500000000, -50000000000));
20 a.push_back(point(-50000000000, -100000000000));
21 a.push_back(point( 50000000000, -100000000000));
22 a.push_back(point( 37500000000, -50000000000));
23 a.push_back(point( 50000000000, -50000000000));
24 a.push_back(point( 50000000000, 50000000000));
25
26 polygon_data<int64_t> polygon_a;
27 set_points(polygon_a, a.begin(), a.end());
28
29 std::vector<point> b;
30 b.push_back(point(-47702617860, 50000000000));
31 b.push_back(point( 50000000000, 50000000000));
32 b.push_back(point( 50000000000, -88753775284));
33 b.push_back(point(-47702617860, -88753775284));
34
35 polygon_data<int64_t> polygon_b;
36 set_points(polygon_b, b.begin(), b.end());
37
38 polygon_set_data<int64_t> intersection = polygon_a * polygon_b;
39 std::cout << area(intersection) << std::endl; // Prints 0
40
41 std::vector<polygon_data<int64_t> > polygons_in_intersection;
42 intersection.get(polygons_in_intersection);
43 std::cout << polygons_in_intersection.size() << std::endl; // Prints 0
44
45 return 0;
46}