boostorg / boostorg/geometry

Polygon does not cover itself when rescaling is disabled

Open
#1,053 3 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
C++
Stars
517
Forks
232
PR merge metrics
No merged PRs in 30d

Description

Boost 1.79

I am trying to evaluate relations between some polygons and multi-polygons. I found that sometimes `covered_by` returns `false` when both arguments are the same shape.

Example 1:
```
g = "POLYGON((0.3 0.3, 0.5 0.75, 0.6 0.4, 0.3 0.3))";
covered_by(g, g) -> false
within(g, g) -> false
```

but

Example 2:
```
g = "POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))";
covered_by(g, g) -> true
within(g, g) -> true
```

Example 3:
```
g = "MULTIPOLYGON(((0 0, 0.0 1.0, 1.0 1.0, 1.0 0.0, 0 0), (0.1 0.1, 0.9 0.1, 0.9 0.9, 0.1 0.9, 0.1 0.1)), ((0.3 0.3, 0.5 0.75, 0.6 0.4, 0.3 0.3)), ((1.3 0.5, 1.5 1.25, 2.0 0.4, 1.5 0.1, 1.3 0.5)))";
covered_by(g, g) -> false
within(g, g) -> false
```

This behavior only happens when rescaling is disabled, which is the default in 1.79. And enabling rescaling causes the issue in the `is_valid()` that I have reported before in #1026.

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.