@@ -1340,7 +1340,7 @@ def getpoints(self, x1, y1, x2, y2, k):
13401340 line and intersects (*x2*, *y2*) and the distance from (*x2*,
13411341 *y2*) of the returned points is *k*.
13421342 """
1343- x1 ,y1 ,x2 ,y2 ,k = list ( map (float , (x1 ,y1 ,x2 ,y2 ,k ) ))
1343+ x1 ,y1 ,x2 ,y2 ,k = map (float , (x1 ,y1 ,x2 ,y2 ,k ))
13441344
13451345if y2 - y1 == 0 :
13461346return x2 ,y2 + k ,x2 ,y2 - k
@@ -1353,10 +1353,10 @@ def getpoints(self, x1, y1, x2, y2, k):
13531353b = - 2 * y2
13541354c = y2 ** 2. - k ** 2. * pm ** 2. / (1. + pm ** 2. )
13551355
1356- y3a = (- b + math .sqrt (b ** 2. - 4 * a * c ))/ (2. * a )
1356+ y3a = (- b + math .sqrt (b ** 2 - 4 * a * c ))/ (2 * a )
13571357x3a = (y3a - y2 )/ pm + x2
13581358
1359- y3b = (- b - math .sqrt (b ** 2. - 4 * a * c ))/ (2. * a )
1359+ y3b = (- b - math .sqrt (b ** 2 - 4 * a * c ))/ (2 * a )
13601360x3b = (y3b - y2 )/ pm + x2
13611361return x3a ,y3a ,x3b ,y3b
13621362
@@ -2849,10 +2849,10 @@ def connect(self, posA, posB):
28492849x1 ,y1 = posA
28502850x2 ,y2 = posB
28512851
2852- cosA , sinA = ( math .cos (self .angleA / 180. * math . pi ),
2853- math .sin (self .angleA / 180. * math . pi ))
2854- cosB , sinB = ( math .cos (self .angleB / 180. * math . pi ),
2855- math .sin (self .angleB / 180. * math . pi ))
2852+ cosA = math .cos (math . radians ( self .angleA ))
2853+ sinA = math .sin (math . radians ( self .angleA ))
2854+ cosB = math .cos (math . radians ( self .angleB ))
2855+ sinB = math .sin (math . radians ( self .angleB ))
28562856
28572857cx ,cy = get_intersection (x1 ,y1 ,cosA ,sinA ,
28582858x2 ,y2 ,cosB ,sinB )
@@ -2894,10 +2894,10 @@ def connect(self, posA, posB):
28942894x1 ,y1 = posA
28952895x2 ,y2 = posB
28962896
2897- cosA , sinA = ( math .cos (self .angleA / 180. * math . pi ),
2898- math .sin (self .angleA / 180. * math . pi ))
2899- cosB , sinB = ( math .cos (self .angleB / 180. * math . pi ),
2900- math .sin (self .angleB / 180. * math . pi ))
2897+ cosA = math .cos (math . radians ( self .angleA ))
2898+ sinA = math .sin (math . radians ( self .angleA ))
2899+ cosB = math .cos (math . radians ( self .angleB ))
2900+ sinB = math .sin (math . radians ( self .angleB ))
29012901
29022902cx ,cy = get_intersection (x1 ,y1 ,cosA ,sinA ,
29032903x2 ,y2 ,cosB ,sinB )
@@ -2970,17 +2970,17 @@ def connect(self, posA, posB):
29702970codes = [Path .MOVETO ]
29712971
29722972if self .armA :
2973- cosA = math .cos (self .angleA / 180. * math . pi )
2974- sinA = math .sin (self .angleA / 180. * math . pi )
2973+ cosA = math .cos (math . radians ( self .angleA ) )
2974+ sinA = math .sin (math . radians ( self .angleA ) )
29752975# x_armA, y_armB
29762976d = self .armA - self .rad
29772977rounded .append ((x1 + d * cosA ,y1 + d * sinA ))
29782978d = self .armA
29792979rounded .append ((x1 + d * cosA ,y1 + d * sinA ))
29802980
29812981if self .armB :
2982- cosB = math .cos (self .angleB / 180. * math . pi )
2983- sinB = math .sin (self .angleB / 180. * math . pi )
2982+ cosB = math .cos (math . radians ( self .angleB ) )
2983+ sinB = math .sin (math . radians ( self .angleB ) )
29842984x_armB ,y_armB = x2 + self .armB * cosB ,y2 + self .armB * sinB
29852985
29862986if rounded :
@@ -3067,18 +3067,10 @@ def connect(self, posA, posB):
30673067armA ,armB = self .armA ,self .armB
30683068
30693069if self .angle is not None :
3070- #angle = self.angle % 180.
3071- #if angle < 0. or angle > 180.:
3072- # angle
3073- #theta0 = (self.angle%180.)/180.*math.pi
3074- theta0 = self .angle / 180. * math .pi
3075- #theta0 = (((self.angle+90)%180.) - 90.)/180.*math.pi
3070+ theta0 = np .deg2rad (self .angle )
30763071dtheta = theta1 - theta0
30773072dl = dd * math .sin (dtheta )
3078-
30793073dL = dd * math .cos (dtheta )
3080-
3081- #x2, y2 = x2 + dl*ddy, y2 - dl*ddx
30823074x2 ,y2 = x1 + dL * math .cos (theta0 ),y1 + dL * math .sin (theta0 )
30833075
30843076armB = armB - dl
@@ -3336,8 +3328,8 @@ def _get_arrow_wedge(self, x0, y0, x1, y1,
33363328
33373329def transmute (self ,path ,mutation_size ,linewidth ):
33383330
3339- head_length , head_width = self .head_length * mutation_size , \
3340- self .head_width * mutation_size
3331+ head_length = self .head_length * mutation_size
3332+ head_width = self .head_width * mutation_size
33413333head_dist = math .sqrt (head_length ** 2 + head_width ** 2 )
33423334cos_t ,sin_t = head_length / head_dist ,head_width / head_dist
33433335
@@ -3346,8 +3338,7 @@ def transmute(self, path, mutation_size, linewidth):
33463338x1 ,y1 = path .vertices [1 ]
33473339
33483340# If there is no room for an arrow and a line, then skip the arrow
3349- has_begin_arrow = (self .beginarrow and
3350- not ((x0 == x1 )and (y0 == y1 )))
3341+ has_begin_arrow = self .beginarrow and not (x0 == x1 and y0 == y1 )
33513342if has_begin_arrow :
33523343verticesA ,codesA ,ddxA ,ddyA = \
33533344self ._get_arrow_wedge (x1 ,y1 ,x0 ,y0 ,