Wrong result in difference of linestrings
- Dominant language
- C++
- Stars
- 517
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
The program
```cpp
#include
int main() {
using Point = boost::geometry::model::d2::point_xy;
using Polygon = boost::geometry::model::polygon;
using Linestring = boost::geometry::model::linestring;
using MultiPolygon = boost::geometry::model::multi_polygon;
using MultiLinestring = boost::geometry::model::multi_linestring;
Linestring l1;
boost::geometry::read_wkt("LINESTRING(5 -8,-7 -6,-3 6,-3 1,-5 4,-1 0,8 5,5 1,-2 3, 1 10,8 5,6 2,7 4)", l1);
MultiLinestring ml1, ml2;
boost::geometry::read_wkt("MULTILINESTRING((1.9375 1.875,1.7441860465116283 1.9302325581395348,-0.7692307692307692 2.6483516483516487,-2 3,-1.0071942446043165 5.316546762589928))", ml1);
boost::geometry::difference(l1, ml1, ml2);
std::cout << boost::geometry::wkt(ml2) << std::endl;
std::cout << boost::geometry::is_valid(l1) << std::endl;
std::cout << boost::geometry::is_valid(ml1) << std::endl;
std::cout << boost::geometry::is_valid(ml2) << std::endl;
std::cout << boost::geometry::length(l1) << std::endl;
std::cout << boost::geometry::length(ml1) << std::endl;
std::cout << boost::geometry::length(ml2) << std::endl;
}
```
returns
```
MULTILINESTRING((5 -8,-7 -6,-3 6,-3 1,-5 4,-1 0,8 5,5 1,1.9375 1.875))
1
1
1
83.7125
6.61539
57.5577
```
in boost 1.84, which is wrong.
In boost 1.77 it throws an Inconsistent Turns exception.

in figure `ml1` is red, `ml2` is green and the union of red-green-purple is `l1`
Contributor guide
Assessment
This issue has not been assessed yet.