skspatial.objects.Line.distance_point¶
- Line.distance_point(point: Union[ndarray, Sequence]) float64 [source]¶
Return the distance from a point to the line.
This is the distance from the point to its projection on the line.
- Parameters:
- pointarray_like
Input point.
- Returns:
- np.float64
Distance from the point to the line.
Examples
>>> from skspatial.objects import Line
>>> line = Line([0, 0], [1, 0]) >>> line.distance_point([0, 0]) 0.0 >>> line.distance_point([5, 0]) 0.0 >>> line.distance_point([5, -5]) 5.0
>>> line = Line([5, 2, -3], [3, 8, 2]) >>> line.distance_point([5, -5, 3]).round(3) 7.737