skspatial.objects.Line.side_point¶
- Line.side_point(point: Union[ndarray, Sequence]) int [source]¶
Find the side of the line where a point lies.
The line and point must be 2D.
- Parameters:
- pointarray_like
Input point.
- Returns:
- int
-1 if the point is left of the line. 0 if the point is on the line. 1 if the point is right of the line.
Examples
>>> from skspatial.objects import Line
>>> line = Line([0, 0], [1, 1])
The point is on the line.
>>> line.side_point([2, 2]) 0
The point is to the right of the line.
>>> line.side_point([5, 3]) 1
The point is to the left of the line.
>>> line.side_point([5, 10]) -1