MCPcopy Index your code
hub / github.com/OmkarPathak/pygorithm / are_parallel

Method are_parallel

pygorithm/geometry/line2.py:381–398  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 2

find_intersectionMethod · 0.80
test_are_parallelMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_are_parallelMethod · 0.64