axisall.py 文件源码

python
阅读 81 收藏 0 点赞 0 评论 0

项目:pygorithm 作者: OmkarPathak 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号