boostorg / boostorg/geometry

intersection returns an extra point in the output

Open
#1,235 0 comments 1 reaction 1 assignee Claimed by @vissarion View on GitHub
Dominant language
C++
Stars
517
Forks
232
PR merge metrics
No merged PRs in 30d

Description

The following program returns an extra point in 1.84 and develop while that was not the case in 1.77

```cpp
#include
#include

int main() {
using Point = boost::geometry::model::d2::point_xy;
using MultiPoint = boost::geometry::model::multi_point;
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;

Polygon p;
boost::geometry::read_wkt("POLYGON((6 7,18 14,-8 1,0 0,18 -8,6 7),(6 0,-4 3,5 3,6 0))", p);

MultiPolygon mp;
boost::geometry::read_wkt("MULTIPOLYGON(((2 3,-3 5,-10 -1,2 3)))", mp);

std::tuple result;
boost::geometry::intersection(p, mp, result);

std::cout << boost::geometry::wkt(std::get<0>(result)) << std::endl;
std::cout << boost::geometry::wkt(std::get<1>(result)) << std::endl;
std::cout << boost::geometry::wkt(std::get<2>(result)) << std::endl;

std::cout << boost::geometry::is_valid(p) << std::endl;
std::cout << boost::geometry::is_valid(mp) << std::endl;
std::cout << boost::geometry::is_valid(std::get<2>(result)) << std::endl;
}
```

In particular:

In 1.84
```
MULTIPOINT((-7.2 1.4))
MULTILINESTRING()
MULTIPOLYGON(((-5.09091 0.636364,-0.842105 2.05263,-4 3,-7.2 1.4,-7.70909 0.963636,-5.09091 0.636364)),((-1.33333 4.33333,-4 3,2 3,-1.33333 4.33333)))
```
In 1.77
```
MULTIPOINT()
MULTILINESTRING()
MULTIPOLYGON(((-5.09091 0.636364,-0.842105 2.05263,-4 3,-7.2 1.4,-7.70909 0.963636,-5.09091 0.636364)),((-1.33333 4.33333,-4 3,2 3,-1.33333 4.33333)))
```

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.