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

    Function closestPointOnSegment

    • Function

      closestPointOnSegment

      Parameters

      • p: Point

        The point to measure from.

      • a: Point

        Start of the segment.

      • b: Point

        End of the segment.

      Returns Point

      A new point on the segment; the arguments are left unchanged. A zero-length segment returns a itself.

      Find the point of a line segment nearest to a given point. The result is clamped to the segment, so it never lands on the infinite line beyond the endpoints.