boostorg / boostorg/geometry

Incorrect result of the function bg::intersection()

Open
#663 8 comments 0 reactions 1 assignee Claimed by @barendgehrels View on GitHub
bug
Dominant language
C++
Stars
517
Forks
232
PR merge metrics
No merged PRs in 30d

Description

This is my code with the define BOOST_GEOMETRY_NO_ROBUSTNESS,
It can be compiled by DEV-C + + 5.11,Boost version: 1.72.
The answer should be 0, but it's 27.
However, if I delete the "#define BOOST_GEOMETRY_NO_ROBUSTNESS",
the answer will be correct.

```
#define BOOST_GEOMETRY_NO_ROBUSTNESS
#include
#include
#include
#include
#include
#include
using namespace std;
namespace bg = boost::geometry;
int main()
{
typedef bg::model::d2::point_xy DPoint;
typedef bg::model::polygon DPolygon;
typedef bg::model::multi_polygon MPolygon;
DPolygon poly1;
DPolygon poly2;
MPolygon poly;
std::list lstOf = boost::assign::list_of
(DPoint(140.10975222826562, 135.99989776999999))
(DPoint(140.10975222826562, 126.97244753050222))
(DPoint(140.16255693232961, 135.99989776999999))
(DPoint(140.10975222826562, 135.99989776999999));
poly1.outer().assign(lstOf.begin(), lstOf.end());
lstOf = boost::assign::list_of
(DPoint(151.99995129999999, 123.99989777000000))
(DPoint(139.99994018999999, 126.99990054000000))
(DPoint(129.99995129999999, 124.99989777000000))
(DPoint(151.99995129999999, 123.99989777000000));
poly2.outer().assign(lstOf.begin(), lstOf.end());
bg::correct(poly1);
bg::correct(poly2);
bg::intersection(poly1, poly2, poly);
double Area = bg::area(poly);
cout<

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.