• Returns the distance squared from the point to the line segment.

    Behavior is undefined if the the closest distance is outside the line segment.

    Parameters

    • px: number

      The X position of point (px, py).

    • py: number

      The Y position of point (px, py)

    • ax: number

      The X position of the line segment's vertex A.

    • ay: number

      The Y position of the line segment's vertex A.

    • bx: number

      The X position of the line segment's vertex B.

    • by: number

      The Y position of the line segment's vertex B.

    Returns number

    The distance squared from the point (px, py) to line segment AB.