@@ -1359,10 +1359,8 @@ def get_path(self):
13591359 xb1 , yb1 , xb2 , yb2 = self .getpoints (x1 , y1 , x2 , y2 , k1 )
13601360
13611361 # a point on the segment 20% of the distance from the tip to the base
1362- theta = math .atan2 (y2 - y1 , x2 - x1 )
1363- r = math .sqrt ((y2 - y1 ) ** 2. + (x2 - x1 ) ** 2. )
1364- xm = x1 + self .frac * r * math .cos (theta )
1365- ym = y1 + self .frac * r * math .sin (theta )
1362+ xm = x1 + self .frac * (x2 - x1 )
1363+ ym = y1 + self .frac * (y2 - y1 )
13661364 xc1 , yc1 , xc2 , yc2 = self .getpoints (x1 , y1 , xm , ym , k1 )
13671365 xd1 , yd1 , xd2 , yd2 = self .getpoints (x1 , y1 , xm , ym , k2 )
13681366
@@ -2915,10 +2913,10 @@ def connect(self, posA, posB):
29152913 codes .append (Path .LINETO )
29162914 else :
29172915 dx1 , dy1 = x1 - cx , y1 - cy
2918- d1 = (dx1 ** 2 + dy1 ** 2 ) ** .5
2916+ d1 = np . hypot (dx1 , dy1 )
29192917 f1 = self .rad / d1
29202918 dx2 , dy2 = x2 - cx , y2 - cy
2921- d2 = (dx2 ** 2 + dy2 ** 2 ) ** .5
2919+ d2 = np . hypot (dx2 , dy2 )
29222920 f2 = self .rad / d2
29232921 vertices .extend ([(cx + dx1 * f1 , cy + dy1 * f1 ),
29242922 (cx , cy ),
@@ -3302,7 +3300,7 @@ def transmute(self, path, mutation_size, linewidth):
33023300
33033301 head_length = self .head_length * mutation_size
33043302 head_width = self .head_width * mutation_size
3305- head_dist = math . sqrt (head_length ** 2 + head_width ** 2 )
3303+ head_dist = np . hypot (head_length , head_width )
33063304 cos_t , sin_t = head_length / head_dist , head_width / head_dist
33073305
33083306 # begin arrow
0 commit comments