skspatial.objects.LineSegment.contains_point

LineSegment.contains_point(point: Union[numpy.ndarray, Sequence], **kwargs) bool[source]

Check if a point is on the line segment.

Parameters
pointarray_like
Returns
bool

True if the point is on the line segment; false otherwise.

Examples

>>> from skspatial.objects import LineSegment
>>> segment = LineSegment([0, 0], [1, 0])
>>> segment.contains_point([0, 0])
True
>>> segment.contains_point([0.5, 0])
True
>>> segment.contains_point([2, 0])
False
>>> segment.contains_point([0, 1])
False