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

Method connect

lib/matplotlib/patches.py:3097–3130  ·  view source on GitHub ↗
(self, posA, posB)

Source from the content-addressed store, hash-verified

3095 self.rad = rad
3096
3097 def connect(self, posA, posB):
3098 x1, y1 = posA
3099 x2, y2 = posB
3100
3101 cosA = math.cos(math.radians(self.angleA))
3102 sinA = math.sin(math.radians(self.angleA))
3103 cosB = math.cos(math.radians(self.angleB))
3104 sinB = math.sin(math.radians(self.angleB))
3105
3106 cx, cy = get_intersection(x1, y1, cosA, sinA,
3107 x2, y2, cosB, sinB)
3108
3109 vertices = [(x1, y1)]
3110 codes = [Path.MOVETO]
3111
3112 if self.rad == 0.:
3113 vertices.append((cx, cy))
3114 codes.append(Path.LINETO)
3115 else:
3116 dx1, dy1 = x1 - cx, y1 - cy
3117 d1 = np.hypot(dx1, dy1)
3118 f1 = self.rad / d1
3119 dx2, dy2 = x2 - cx, y2 - cy
3120 d2 = np.hypot(dx2, dy2)
3121 f2 = self.rad / d2
3122 vertices.extend([(cx + dx1 * f1, cy + dy1 * f1),
3123 (cx, cy),
3124 (cx + dx2 * f2, cy + dy2 * f2)])
3125 codes.extend([Path.LINETO, Path.CURVE3, Path.CURVE3])
3126
3127 vertices.append((x2, y2))
3128 codes.append(Path.LINETO)
3129
3130 return Path(vertices, codes)
3131
3132 @_register_style(_style_list)
3133 class Arc(_Base):

Callers

nothing calls this directly

Calls 2

get_intersectionFunction · 0.85
PathClass · 0.85

Tested by

no test coverage detected