Does Boost.Geometry support determination of straight line segment intersection? #1330
Replies: 2 comments 1 reply
-
Oops, while Geometry boost mailing list seems to be dead, the only and last posting from 2023 shows that intersection() is possible for line segments I modified the script for integer cordinates and two testcases:
The 2nd result is exactly what is needed for the graph issue.
|
Beta Was this translation helpful? Give feedback.
-
I/o using a https://github.com/boostorg/geometry/blob/develop/doc/src/examples/algorithms/intersection_segment.cpp |
Beta Was this translation helpful? Give feedback.
-
This is a followup question of
boostorg/graph#388
Straight line drawing x- and y-coordinates are std::size_t.
Internally a double argument function intersects() is called, that causes wrong answers.
There is a simple testcase in the issue.
I tried to use intersection() with LineSegments from Boost.Geometry:
boostorg/graph#388 (comment)
But the compiler error says "not implemented".
Next I tried to represent straight line segment between vertex v and w as
but the result does not determine the intersection in the example (is that a bug?).
So intersection() does not seem to work for area=0 polygons.
Is there another Boost.Geometry function that can determine intersection of straight line segments?
If yes, is it exact for integer type coordinates?
Or do I need to implement this?
https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line_segment
Since std::size_t is is 64bit on 64bit systems, and the method involves multiplication, Boost.Multiprecision seems to be needed for implementation?
Regards,
Hermann.
Beta Was this translation helpful? Give feedback.
All reactions