boost::geometry::sym_difference returns the incorrect result for polygons containing large negative values (But not for large positive values).)
- Dominant language
- C++
- Stars
- 517
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
I am using boost 1.70.0 and MSVC 2017 15.8 C++17. In the code below the result of the sym_difference is `MULTIPOLYGON(((0 0,100 -2147483648,0 -2147483648,0 0)))` when is should be `MULTIPOLYGON(((0 0,100 0,100 -2147483648,0 -2147483648,0 0)))` Note -2147483648 is INT_MIN.
```
using mypoint_t = boost::geometry::model::point;
using mypolygon_t = boost::geometry::model::polygon;
{
mypolygon_t polygonA;
boost::geometry::read_wkt("POLYGON((0 0,0 100,100 100,100 0,0 0))", polygonA);
mypolygon_t polygonB;
boost::geometry::read_wkt("POLYGON((0 -2147483648,0 100,100 100,100 -2147483648,0 -2147483648))", polygonB);
boost::geometry::model::multi_polygon polygonC;
boost::geometry::sym_difference(polygonA, polygonB, polygonC);
}
```
But when its changed to use INT_MAX the result is correct:
```
{
mypolygon_t polygonA;
boost::geometry::read_wkt("POLYGON((0 0,0 100,100 100,100 0))", polygonA);
mypolygon_t polygonB;
boost::geometry::read_wkt("POLYGON((0 0,0 2147483647,100 2147483647,100 0,0 0))", polygonB);
boost::geometry::model::multi_polygon polygonC;
boost::geometry::sym_difference(polygonA, polygonB, polygonC);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.