line2.py 文件源码

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

项目:pygorithm 作者: OmkarPathak 项目源码 文件源码
def are_parallel(line1, line2):
        """
        Determine if the two lines are parallel.

        Two lines are parallel if they have the same or opposite slopes.

        :param line1: the first line 
        :type line1: :class:`pygorithm.geometry.line2.Line2`
        :param line2: the second line
        :type line2: :class:`pygorithm.geometry.line2.Line2`
        :returns: if the lines are parallel
        :rtype: bool
        """

        if line1.vertical and line2.vertical:
            return True

        return math.isclose(line1.slope, line2.slope)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号