gradum-kit - v0.1.0
    Preparing search index...

    Function segmentIntersectsPolygon

    • Function

      segmentIntersectsPolygon

      Parameters

      • a: Point

        Start of the segment.

      • b: Point

        End of the segment.

      • poly: Point[]

        The polygon's vertices, in order around its outline.

      Returns Point

      The meeting point, or null if the segment misses the polygon entirely.

      Find where a line segment first meets a polygon. A segment lying wholly inside the polygon crosses no edge, so one of its endpoints is returned instead — meaning a non-null result means "touches", not strictly "crosses an edge".