@@ -1209,21 +1209,15 @@ def _recompute_path(self):
1209
1209
# followed by a reversed and scaled inner ring
1210
1210
v1 = arc .vertices
1211
1211
v2 = arc .vertices [::- 1 ] * (self .r - self .width ) / self .r
1212
- v = np .concatenate ([v1 , v2 , [v1 [0 , :], (0 , 0 )]])
1213
- c = np .concatenate ([
1214
- arc .codes , arc .codes , [connector , Path .CLOSEPOLY ]])
1215
- c [len (arc .codes )] = connector
1212
+ v = np .concatenate ([v1 , v2 , [(0 , 0 )]])
1213
+ c = [* arc .codes , connector , * arc .codes [1 :], Path .CLOSEPOLY ]
1216
1214
else :
1217
1215
# Wedge doesn't need an inner ring
1218
- v = np .concatenate ([
1219
- arc .vertices , [(0 , 0 ), arc .vertices [0 , :], (0 , 0 )]])
1220
- c = np .concatenate ([
1221
- arc .codes , [connector , connector , Path .CLOSEPOLY ]])
1216
+ v = np .concatenate ([arc .vertices , [(0 , 0 ), (0 , 0 )]])
1217
+ c = [* arc .codes , connector , Path .CLOSEPOLY ]
1222
1218
1223
1219
# Shift and scale the wedge to the final location.
1224
- v *= self .r
1225
- v += np .asarray (self .center )
1226
- self ._path = Path (v , c )
1220
+ self ._path = Path (v * self .r + self .center , c )
1227
1221
1228
1222
def set_center (self , center ):
1229
1223
self ._path = None
@@ -2480,9 +2474,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2480
2474
Path .CURVE3 , Path .CURVE3 ,
2481
2475
Path .CLOSEPOLY ]
2482
2476
2483
- path = Path (cp , com )
2484
-
2485
- return path
2477
+ return Path (cp , com )
2486
2478
2487
2479
@_register_style (_style_list )
2488
2480
class Round4 :
@@ -2531,9 +2523,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2531
2523
Path .CURVE4 , Path .CURVE4 , Path .CURVE4 ,
2532
2524
Path .CLOSEPOLY ]
2533
2525
2534
- path = Path (cp , com )
2535
-
2536
- return path
2526
+ return Path (cp , com )
2537
2527
2538
2528
@_register_style (_style_list )
2539
2529
class Sawtooth :
@@ -2628,8 +2618,7 @@ def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size):
2628
2618
def __call__ (self , x0 , y0 , width , height , mutation_size ):
2629
2619
saw_vertices = self ._get_sawtooth_vertices (x0 , y0 , width ,
2630
2620
height , mutation_size )
2631
- path = Path (saw_vertices , closed = True )
2632
- return path
2621
+ return Path (saw_vertices , closed = True )
2633
2622
2634
2623
@_register_style (_style_list )
2635
2624
class Roundtooth (Sawtooth ):
@@ -3419,22 +3408,20 @@ def transmute(self, path, mutation_size, linewidth):
3419
3408
3420
3409
# This simple code will not work if ddx, ddy is greater than the
3421
3410
# separation between vertices.
3422
- _path = [Path (np .concatenate ([[(x0 + ddxA , y0 + ddyA )],
3411
+ paths = [Path (np .concatenate ([[(x0 + ddxA , y0 + ddyA )],
3423
3412
path .vertices [1 :- 1 ],
3424
3413
[(x3 + ddxB , y3 + ddyB )]]),
3425
3414
path .codes )]
3426
- _fillable = [False ]
3415
+ fills = [False ]
3427
3416
3428
3417
if has_begin_arrow :
3429
3418
if self .fillbegin :
3430
- p = np .concatenate ([verticesA , [verticesA [0 ],
3431
- verticesA [0 ]], ])
3432
- c = np .concatenate ([codesA , [Path .LINETO , Path .CLOSEPOLY ]])
3433
- _path .append (Path (p , c ))
3434
- _fillable .append (True )
3419
+ paths .append (
3420
+ Path ([* verticesA , (0 , 0 )], [* codesA , Path .CLOSEPOLY ]))
3421
+ fills .append (True )
3435
3422
else :
3436
- _path .append (Path (verticesA , codesA ))
3437
- _fillable .append (False )
3423
+ paths .append (Path (verticesA , codesA ))
3424
+ fills .append (False )
3438
3425
elif self ._beginarrow_bracket :
3439
3426
x0 , y0 = path .vertices [0 ]
3440
3427
x1 , y1 = path .vertices [1 ]
@@ -3443,19 +3430,17 @@ def transmute(self, path, mutation_size, linewidth):
3443
3430
self .lengthA * scaleA ,
3444
3431
self .angleA )
3445
3432
3446
- _path .append (Path (verticesA , codesA ))
3447
- _fillable .append (False )
3433
+ paths .append (Path (verticesA , codesA ))
3434
+ fills .append (False )
3448
3435
3449
3436
if has_end_arrow :
3450
3437
if self .fillend :
3451
- _fillable .append (True )
3452
- p = np .concatenate ([verticesB , [verticesB [0 ],
3453
- verticesB [0 ]], ])
3454
- c = np .concatenate ([codesB , [Path .LINETO , Path .CLOSEPOLY ]])
3455
- _path .append (Path (p , c ))
3438
+ fills .append (True )
3439
+ paths .append (
3440
+ Path ([* verticesB , (0 , 0 )], [* codesB , Path .CLOSEPOLY ]))
3456
3441
else :
3457
- _fillable .append (False )
3458
- _path .append (Path (verticesB , codesB ))
3442
+ fills .append (False )
3443
+ paths .append (Path (verticesB , codesB ))
3459
3444
elif self ._endarrow_bracket :
3460
3445
x0 , y0 = path .vertices [- 1 ]
3461
3446
x1 , y1 = path .vertices [- 2 ]
@@ -3464,10 +3449,10 @@ def transmute(self, path, mutation_size, linewidth):
3464
3449
self .lengthB * scaleB ,
3465
3450
self .angleB )
3466
3451
3467
- _path .append (Path (verticesB , codesB ))
3468
- _fillable .append (False )
3452
+ paths .append (Path (verticesB , codesB ))
3453
+ fills .append (False )
3469
3454
3470
- return _path , _fillable
3455
+ return paths , fills
3471
3456
3472
3457
@_register_style (_style_list , name = "-" )
3473
3458
class Curve (_Curve ):
@@ -3662,8 +3647,7 @@ def transmute(self, path, mutation_size, linewidth):
3662
3647
3663
3648
try :
3664
3649
arrow_out , arrow_in = \
3665
- split_bezier_intersecting_with_closedpath (
3666
- arrow_path , in_f , tolerance = 0.01 )
3650
+ split_bezier_intersecting_with_closedpath (arrow_path , in_f )
3667
3651
except NonIntersectingPathException :
3668
3652
# if this happens, make a straight line of the head_length
3669
3653
# long.
@@ -3743,7 +3727,7 @@ def transmute(self, path, mutation_size, linewidth):
3743
3727
in_f = inside_circle (x2 , y2 , head_length )
3744
3728
try :
3745
3729
path_out , path_in = split_bezier_intersecting_with_closedpath (
3746
- arrow_path , in_f , tolerance = 0.01 )
3730
+ arrow_path , in_f )
3747
3731
except NonIntersectingPathException :
3748
3732
# if this happens, make a straight line of the head_length
3749
3733
# long.
@@ -3757,7 +3741,7 @@ def transmute(self, path, mutation_size, linewidth):
3757
3741
# path for head
3758
3742
in_f = inside_circle (x2 , y2 , head_length * .8 )
3759
3743
path_out , path_in = split_bezier_intersecting_with_closedpath (
3760
- arrow_path , in_f , tolerance = 0.01 )
3744
+ arrow_path , in_f )
3761
3745
path_tail = path_out
3762
3746
3763
3747
# head
@@ -3775,7 +3759,7 @@ def transmute(self, path, mutation_size, linewidth):
3775
3759
# path for head
3776
3760
in_f = inside_circle (x0 , y0 , tail_width * .3 )
3777
3761
path_in , path_out = split_bezier_intersecting_with_closedpath (
3778
- arrow_path , in_f , tolerance = 0.01 )
3762
+ arrow_path , in_f )
3779
3763
tail_start = path_in [- 1 ]
3780
3764
3781
3765
head_right , head_left = head_r , head_l
0 commit comments