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: :
(line1, line2)
| 379 | |
| 380 | @staticmethod |
| 381 | def are_parallel(line1, line2): |
| 382 | """ |
| 383 | Determine if the two lines are parallel. |
| 384 | |
| 385 | Two lines are parallel if they have the same or opposite slopes. |
| 386 | |
| 387 | :param line1: the first line |
| 388 | :type line1: :class:`pygorithm.geometry.line2.Line2` |
| 389 | :param line2: the second line |
| 390 | :type line2: :class:`pygorithm.geometry.line2.Line2` |
| 391 | :returns: if the lines are parallel |
| 392 | :rtype: bool |
| 393 | """ |
| 394 | |
| 395 | if line1.vertical and line2.vertical: |
| 396 | return True |
| 397 | |
| 398 | return math.isclose(line1.slope, line2.slope) |
| 399 | |
| 400 | @staticmethod |
| 401 | def find_intersection(line1, line2, offset1 = None, offset2 = None): |
no outgoing calls