MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / check_if_parallel

Function check_if_parallel

lib/matplotlib/bezier.py:528–555  ·  view source on GitHub ↗

Check if two lines are parallel. Parameters ---------- dx1, dy1, dx2, dy2 : float The gradients *dy*/*dx* of the two lines. tolerance : float The angular tolerance in radians up to which the lines are considered parallel. Returns ------- is_

(dx1, dy1, dx2, dy2, tolerance=1.e-5)

Source from the content-addressed store, hash-verified

526
527
528def check_if_parallel(dx1, dy1, dx2, dy2, tolerance=1.e-5):
529 """
530 Check if two lines are parallel.
531
532 Parameters
533 ----------
534 dx1, dy1, dx2, dy2 : float
535 The gradients *dy*/*dx* of the two lines.
536 tolerance : float
537 The angular tolerance in radians up to which the lines are considered
538 parallel.
539
540 Returns
541 -------
542 is_parallel
543 - 1 if two lines are parallel in same direction.
544 - -1 if two lines are parallel in opposite direction.
545 - False otherwise.
546 """
547 theta1 = np.arctan2(dx1, dy1)
548 theta2 = np.arctan2(dx2, dy2)
549 dtheta = abs(theta1 - theta2)
550 if dtheta < tolerance:
551 return 1
552 elif abs(dtheta - np.pi) < tolerance:
553 return -1
554 else:
555 return False
556
557
558def get_parallels(bezier2, width):

Callers 1

get_parallelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…