distance_point_to_line_segment#

distance_point_to_line_segment(point, v1, v2)#

Calculate the minimum distance from a point to a line segment.

Parameters:
pointarray_like

Coordinates of the point (1xd).

v1array_like

Coordinates of one end of the line segment (1xd).

v2array_like

Coordinates of the other end of the line segment (1xd).

Returns:
float

The minimum distance from the point to the line segment.

tuple

A tuple containing the original point and the closest point on the line segment.