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

isect_segments_include_segments(segments) returns some segments reversed #5

Closed nedbat closed 7 years ago

nedbat commented 7 years ago

The segments returned from isect_segments_include_segments can be reversed from the values passed in. For example, I passed in:

((-2054.9947254346134, -932.6536202386079), (-2329.6450890594665, -956.6824134890552))

and got back:

((-2329.6450890594665, -956.6824134890552), (-2054.9947254346134, -932.6536202386079))

Is this avoidable? I can work around it if need be, but it would be a more natural API if the segments returned were equal to the inputs.

ideasman42 commented 7 years ago

This is useful for the algorithm that the segments are ordered this way, however that need not be exposed in the API, it just means this information needs to be stored somewhere so the original data can be returned.

nedbat commented 7 years ago

I can live with them coming back reversed :)