boost::geometry::intersection wrong result
- Dominant language
- C++
- Stars
- 517
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
On version 1.82 without special defines. I have found a test case that gives unexpectedly wrong results.
Here is the test case to prove the problem. The correct result is close to the float precision limit, but the actual result is almost the same as one of the input polygons and therefore very wrong. Empty or even degenerate results would be fine for our use case. Possibly related to #1201
```C++
using Point = boost::geometry::model::d2::point_xy;
using BoostPolygonType = boost::geometry::model::polygon;
using BoostMultiPolygonType = boost::geometry::model::multi_polygon;
BoostPolygonType polygon1;
boost::geometry::read_wkt("POLYGON((0.875 0.4375, 0.875 0.375, 0.9375 0.375))", polygon1);
BoostPolygonType polygon2;
boost::geometry::read_wkt("POLYGON((1. 0., 1. 0.581662834, 0.824054539 0.))", polygon2);
BoostMultiPolygonType result;
boost::geometry::intersection(polygon1, polygon2, result);
EXPECT_EQ(result.size(), 1);
EXPECT_LT(boost::geometry::area(result), 0.01);
for (auto& intersection : result)
{
EXPECT_EQ(intersection.outer().size(), 3);
}
```
polygon1-orange, polygon2-red

the result of the intersection

Contributor guide
Assessment
This issue has not been assessed yet.