gis-tools-ts - v0.6.0
    Preparing search index...

    Function intersectionOfSegmentsRobust

    • 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.

      Type Parameters

      • D extends Properties = Properties

      Parameters

      • a: [VectorPoint<D>, VectorPoint<D>]

        the first segment

      • b: [VectorPoint<D>, VectorPoint<D>]

        the second segment

      • sameRing: boolean = true

        if both segments are from the same ring. By default it assumes they are

      Returns IntersectionOfSegmentsRobust<D> | undefined

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