boostorg / boostorg/geometry

Small integer multipolygon union failure case post traversal rewrite

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

Description

Here is a very small failure case for union that first fails on commit 805ff654e869030c4ba70f37fad6c3825f59c077, i.e. the traversal rewrite.

```cpp
#include

namespace bg = boost::geometry;
using point = bg::model::d2::point_xy;
using polygon = bg::model::polygon;
using multi_polygon = bg::model::multi_polygon;

int main() {
const auto geo1 = bg::from_wkt("MULTIPOLYGON(((4 6,2 6,2 4,0 4,0 8,4 8,6 8,6 6,6 4,4 4,4 6)),((2 2,2 4,4 4,4 2,2 2)),((2 2,2 0,0 0,0 2,2 2)),((4 2,6 2,6 0,4 0,4 2)))");
const auto geo2 = bg::from_wkt("MULTIPOLYGON(((2 2,2 4,4 4,4 2,2 2)))");
multi_polygon res;
bg::union_(geo1, geo2, res);
std::cout << bg::to_wkt(res) << '\n';
return 0;
}
```
Prints
```sql
MULTIPOLYGON(((2 4,0 4,0 8,4 8,6 8,6 6,6 4,4 4,4 2,2 2,2 4)),((2 2,2 0,0 0,0 2,2 2)),((4 2,6 2,6 0,4 0,4 2)))
```
should print
```sql
MULTIPOLYGON(((2 4,0 4,0 8,4 8,6 8,6 6,6 4,4 4,4 6,2 6,2 4)),((2 4,4 4,4 2,2 2,2 4)),((2 2,2 0,0 0,0 2,2 2)),((4 2,6 2,6 0,4 0,4 2)))
```

Should be unrelated to numerical issues due to use of small integer coordinates.

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.