Inserting 64-bit rectangle into 64-bit polygon set doesn't work
- Dominant language
- C++
- Stars
- 70
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Description
[Godbolt live link](https://godbolt.org/z/of3cKqxYb)
The following program inserts a 64-bit rectangle into a 64-bit polygon set. Then it does the same thing again, but using a polygon instead of a rectangle to represent the shape. It prints out whether each polygon set is empty following the insertion of the figure.
Expected output:
pset1 empty == 0
pset2 empty == 0
Actual output:
pset1 empty == 1
pset2 empty == 0
In other words, inserting the figure as a rectangle drops it.
Note that the figure is not dropped (and you get the expected output) if you change the values of the coordinates to fit in 32 bits.
```
#include
#include
#include
#include
namespace bp = boost::polygon;
typedef int64_t Coord;
typedef bp::point_data Point;
typedef bp::polygon_data Poly;
typedef bp::rectangle_data Rect;
typedef bp::polygon_set_data PolySet;
int
main()
{
const int64_t xl = 1214688665600;
const int64_t xh = 1226223002624;
const int64_t yl = 1524039680000;
const int64_t yh = 1527821107200;
Rect r(xl, yl, xh, yh);
PolySet pset1;
pset1.insert(r);
std::cout << "pset1 empty == " << bp::empty(pset1) << "\n";
std::vector points;
points.push_back(Point(xl,yl));
points.push_back(Point(xl,yh));
points.push_back(Point(xh,yh));
points.push_back(Point(xh,yl));
Poly poly;
poly.set(points.begin(), points.end());
PolySet pset2;
pset2.insert(poly);
std::cout << "pset2 empty == " << bp::empty(pset2) << "\n";
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.