exercise_3.py 文件源码

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

项目:learn-python-django-web 作者: kabirbaidhya 项目源码 文件源码
def get_angle(line1, line2):
    """
    Calculates the angle between two lines (in Degrees) using their
    parsed tuples each containing slope & y-intercept
    """

    (m1, c1) = line1
    (m2, c2) = line2

    denominator = 1.0 + m1 * m2

    # If this part of the expression results to zero
    # then it implies the angle between the lines is 90 degrees.
    if denominator == 0:
        return 90.0

    angle_radian = math.atan((m1 - m2) / denominator)

    return angle_radian * (180 / math.pi)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号