boostorg / boostorg/geometry

boost::geometry::intersection produces wrong result

Open
#511 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
517
Forks
232
PR merge metrics
No merged PRs in 30d

Description

Hi everyone again, looks like I've spotted another problem, and it doesn't look similar to https://github.com/boostorg/geometry/issues/510 so I'm creating another issue.

Also, this problem is reproducible in boost 1.55 and in latest dev branch. Didn't test any other branches.
Code to reproduce:

```
typedef d2::point_xy BoostPoint;
typedef polygon BoostPolygon;
typedef linestring BoostPolyline;

int main(void)
{
BoostPolyline polyToClip;
std::vector clippingResult;

polyToClip.push_back(BoostPoint(-21.855920181274413, -0.94793533329159096));
polyToClip.push_back(BoostPoint(-15.353896496297601, -0.94793533329159096));
polyToClip.push_back(BoostPoint(-15.144153796782220, -0.94793533329159096));
polyToClip.push_back(BoostPoint(-9.0384241485595709, -0.94793533329159096));

multi_polygon clippingRegion;
BoostPolygon curPolygon;
append(curPolygon, BoostPoint(-15.280303647629022, -0.94793533329159185));
append(curPolygon, BoostPoint(-14.5, -1));
append(curPolygon, BoostPoint(-14.157121780656512, -0.94840134008253141));
append(curPolygon, BoostPoint(-14.157452756077651, -0.94726404792587238));
append(curPolygon, BoostPoint(-14.5, -0.9));
append(curPolygon, BoostPoint(-15.280303647629022, -0.94793533329159185));
clippingRegion.push_back(curPolygon);
reverse(clippingRegion);

intersection(clippingRegion, polyToClip, clippingResult);
return 0;
}
```

Result is not correct because it leaves whole part of polyToClip from left side of clippingRegion.
![image](https://user-images.githubusercontent.com/4762581/46041127-c7312f80-c11a-11e8-85d8-034d3f7e06b6.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.