boostorg / boostorg/geometry

The result of the difference(A, B, C) intersects() with B but neither overlaps() nor touches().

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

Description

Hi,

I obtained the difference between the two rings and found that the result intersects with the original ring, but it neither overlaps nor touches it. I think in the case of intersection, `overlaps(A, B) == !touches(A, B)`.

example code:

```cpp
TEST_CASE("高精度浮点图形", "[geometry][boost]") {
using Point = bg::model::point;
using Ring = bg::model::ring;
using Polygon = bg::model::polygon;
using MultiPolygon = bg::model::multi_polygon;

const Ring ring1{{255.999985, 255.999954},
{376.0, 223.846039},
{376.0, 421.0},
{368.0, 421.0},
{368.0, 420.0},
{350.685455, 420.0}};
const Ring ring2{{437.019287, -57.5347023},
{503.276947, 189.742279},
{8.72293091, 322.257660},
{-57.5347290, 74.9806824}};

REQUIRE(bg::intersects(ring1, ring2));

MultiPolygon result;

REQUIRE_NOTHROW(bg::difference(ring1, ring2, result));
REQUIRE(bg::intersects(ring2, result));
REQUIRE_FALSE(bg::overlaps(ring2, result));
REQUIRE_FALSE(bg::equals(ring2, result));
REQUIRE_FALSE(bg::touches(ring2, result));
}
```

![image](https://github.com/boostorg/geometry/assets/74289088/ec417bdc-ad7d-49be-91b0-ea21df3e4eb4)
![image](https://github.com/boostorg/geometry/assets/74289088/9c135dd9-3c0d-4ace-a911-4d675802226e)

version: 1.85.0

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.