def contains_point(line, point):
"""
Determine if the line contains the specified point.
The point must be defined the same way as min and max.
.. tip::
It is not possible for both returned booleans to be `True`.
:param line: the line
:type line: :class:`pygorithm.geometry.axisall.AxisAlignedLine`
:param point: the point
:type point: :class:`numbers.Number`
:returns: (if the point is an edge of the line, if the point is contained by the line)
:rtype: (bool, bool)
"""
if math.isclose(line.min, point) or math.isclose(line.max, point):
return True, False
elif point < line.min or point > line.max:
return False, False
else:
return False, True
评论列表
文章目录