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)
评论列表
文章目录