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

Function make_wedged_bezier2

lib/matplotlib/bezier.py:642–690  ·  view source on GitHub ↗

Being similar to `get_parallels`, returns control points of two quadratic Bézier lines having a width roughly parallel to given one separated by *width*.

(bezier2, width, w1=1., wm=0.5, w2=0.)

Source from the content-addressed store, hash-verified

640
641
642def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
643 """
644 Being similar to `get_parallels`, returns control points of two quadratic
645 Bézier lines having a width roughly parallel to given one separated by
646 *width*.
647 """
648
649 # c1, cm, c2
650 c1x, c1y = bezier2[0]
651 cmx, cmy = bezier2[1]
652 c3x, c3y = bezier2[2]
653
654 # t1 and t2 is the angle between c1 and cm, cm, c3.
655 # They are also an angle of the tangential line of the path at c1 and c3
656 cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
657 cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c3x, c3y)
658
659 # find c1_left, c1_right which are located along the lines
660 # through c1 and perpendicular to the tangential lines of the
661 # Bezier path at a distance of width. Same thing for c3_left and
662 # c3_right with respect to c3.
663 c1x_left, c1y_left, c1x_right, c1y_right = (
664 get_normal_points(c1x, c1y, cos_t1, sin_t1, width * w1)
665 )
666 c3x_left, c3y_left, c3x_right, c3y_right = (
667 get_normal_points(c3x, c3y, cos_t2, sin_t2, width * w2)
668 )
669
670 # find c12, c23 and c123 which are middle points of c1-cm, cm-c3 and
671 # c12-c23
672 c12x, c12y = (c1x + cmx) * .5, (c1y + cmy) * .5
673 c23x, c23y = (cmx + c3x) * .5, (cmy + c3y) * .5
674 c123x, c123y = (c12x + c23x) * .5, (c12y + c23y) * .5
675
676 # tangential angle of c123 (angle between c12 and c23)
677 cos_t123, sin_t123 = get_cos_sin(c12x, c12y, c23x, c23y)
678
679 c123x_left, c123y_left, c123x_right, c123y_right = (
680 get_normal_points(c123x, c123y, cos_t123, sin_t123, width * wm)
681 )
682
683 path_left = find_control_points(c1x_left, c1y_left,
684 c123x_left, c123y_left,
685 c3x_left, c3y_left)
686 path_right = find_control_points(c1x_right, c1y_right,
687 c123x_right, c123y_right,
688 c3x_right, c3y_right)
689
690 return path_left, path_right

Callers 3

transmuteMethod · 0.85
transmuteMethod · 0.85
transmuteMethod · 0.85

Calls 3

get_cos_sinFunction · 0.85
get_normal_pointsFunction · 0.85
find_control_pointsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…