ideasman42 / isect_segments-bentley_ottmann

BentleyOttmann sweep-line implementation (for finding all intersections in a set of line segments)
MIT License
91 stars 40 forks source link

USE_IGNORE_SEGMENT_ENDINGS = True fails in this simple case #27

Open smldis opened 2 years ago

smldis commented 2 years ago

USE_IGNORE_SEGMENT_ENDINGS = True fails in this case with a false positive (related to handling of floating point precision)

Runnable code:

segments = [((1244.1140298175264, 880.2941002930444),(1243.2055718759748, 880.4612970469328)),
            ((1243.2055718759748, 880.4612970469328),(1244.196882082508, 880.5928419990338))]
intersections = poly_point_isect.isect_segments_include_segments(segments)

Output:

[((1243.2055718761806, 880.4612970469013),
  [((1243.2055718759748, 880.4612970469328),
    (1244.196882082508, 880.5928419990338)),
   ((1243.2055718759748, 880.4612970469328),
    (1244.1140298175264, 880.2941002930444))])]

Expected Output is []

If I change NUM_EPS = Real("1e-10") to 1e-8 it works but I have no idea if I am breaking anything from doing that.