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)
exercise_3.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录