intersection_of_segments_robust

Function intersection_of_segments_robust 

Source
pub fn intersection_of_segments_robust<P: GetXY + PartialEq, Q: NewXY + Clone>(
    a: (&P, &P),
    b: (&P, &P),
    same_ring: bool,
) -> Option<IntersectionOfSegmentsRobust<Q>>
Expand description

Find the intersection of two segments. A more robust approach that uses predicates to ensure no false positives/negatives

NOTE: If the segments are touching at end points, they PASS in this function. However, the caviat is that if the segments are coming from the same ring, then the result will be undefined (not considered an intersection).

NOTE: The resultant vectors are displacement vectors not normalized.

§Parameters

  • a: the first segment
  • b: the second segment
  • same_ring: if both segments are from the same ring. By default it assumes they are
  • a_ring_id: the ring id of the first segment if provided
  • b_ring_id: the ring id of the second segment if provided

§Returns

A point if the segments intersect where the intersection occurs, otherwise undefined