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

only single interaction with vertical segment is reported #16

Open smichr opened 6 years ago

smichr commented 6 years ago

The pts in V and V2 describe the same sort of shape, but the first has a vertical line while the 2nd does not. Only 2 of the 3 segments that involve an intersection are reported for the first.

>>> V = [(0, 1), (2, 1), (2, 3), (1, 2), (3, 0)]  # has vertical
>>> isect_polygon_include_segments(V)
[((2, 1), [((1, 2), (3, 0)), ((0, 1), (2, 1))])]
## should include ((2, 1), (2, 3)), too

>>> V2 = [(0, 2), (2, 1), (4, 4), (1, 3), (3, -1)]
>>> isect_polygon_include_segments(V2) # no vertical and all 3 segments reported
[((2, 1), [((1, 3), (3, -1)), ((0, 2), (2, 1)), ((2, 1), (4, 4))])]