Dimitris Dakopoulos
Dimitris Dakopoulos

Reputation: 713

Ring-segment overlapping

How can I find if a 2D-segment overlaps (pure overlap, not abutting or touching) with a 2D-ring (convex)?

My first approaches were to use:

  1. disjoint But it did not work because touching/abutting are not not considered disjoint

  2. overlaps But it did not work because touching/abutting are considered as overlaps

I tried several other combinations (using within for example) and I can't find an easy way. By easy I mean: use a couple of boost-geometry algorithms without implementing a computational geometry algorithm.

I believe the solution is somewhere in the strategies...

I guess I can redefine the problem: How do I find abutting rings (polygons)? (note: I can create a degenerate ring from edge).

Here is a figure of what I want. Red segment should return OVERLAP, blue NO OVERLAP.

enter image description here

System: Boost_1.54, CentOS-5, gcc-4.7.2

Upvotes: 1

Views: 278

Answers (1)

Adam Wulkiewicz
Adam Wulkiewicz

Reputation: 2098

Yes, currently (1.55) touches() isn't implemented for Segment/Ring. We plan to release more variants in 1.56, probably not Segment/Ring but you should be able to use Linestring/Ring. You could test it using the development version of the library:

http://github.com/boostorg/geometry/tree/develop

Also the issue with CCW Polygons in touches() is fixed in the develop branch.

Upvotes: 1

Related Questions