@@ -1210,16 +1210,12 @@ def _recompute_path(self):
1210
1210
# followed by a reversed and scaled inner ring
1211
1211
v1 = arc .vertices
1212
1212
v2 = arc .vertices [::- 1 ] * (self .r - self .width ) / self .r
1213
- v = np .concatenate ([v1 , v2 , [v1 [0 , :], (0 , 0 )]])
1214
- c = np .concatenate ([
1215
- arc .codes , arc .codes , [connector , Path .CLOSEPOLY ]])
1216
- c [len (arc .codes )] = connector
1213
+ v = np .concatenate ([v1 , v2 , [(0 , 0 )]])
1214
+ c = [* arc .codes , connector , * arc .codes [1 :], Path .CLOSEPOLY ]
1217
1215
else :
1218
1216
# Wedge doesn't need an inner ring
1219
- v = np .concatenate ([
1220
- arc .vertices , [(0 , 0 ), arc .vertices [0 , :], (0 , 0 )]])
1221
- c = np .concatenate ([
1222
- arc .codes , [connector , connector , Path .CLOSEPOLY ]])
1217
+ v = np .concatenate ([arc .vertices , [(0 , 0 ), (0 , 0 )]])
1218
+ c = [* arc .codes , connector , Path .CLOSEPOLY ]
1223
1219
1224
1220
# Shift and scale the wedge to the final location.
1225
1221
self ._path = Path (v * self .r + self .center , c )
@@ -2478,9 +2474,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2478
2474
Path .CURVE3 , Path .CURVE3 ,
2479
2475
Path .CLOSEPOLY ]
2480
2476
2481
- path = Path (cp , com )
2482
-
2483
- return path
2477
+ return Path (cp , com )
2484
2478
2485
2479
@_register_style (_style_list )
2486
2480
class Round4 :
@@ -2529,9 +2523,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2529
2523
Path .CURVE4 , Path .CURVE4 , Path .CURVE4 ,
2530
2524
Path .CLOSEPOLY ]
2531
2525
2532
- path = Path (cp , com )
2533
-
2534
- return path
2526
+ return Path (cp , com )
2535
2527
2536
2528
@_register_style (_style_list )
2537
2529
class Sawtooth :
@@ -2626,8 +2618,7 @@ def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size):
2626
2618
def __call__ (self , x0 , y0 , width , height , mutation_size ):
2627
2619
saw_vertices = self ._get_sawtooth_vertices (x0 , y0 , width ,
2628
2620
height , mutation_size )
2629
- path = Path (saw_vertices , closed = True )
2630
- return path
2621
+ return Path (saw_vertices , closed = True )
2631
2622
2632
2623
@_register_style (_style_list )
2633
2624
class Roundtooth (Sawtooth ):
@@ -3383,22 +3374,20 @@ def transmute(self, path, mutation_size, linewidth):
3383
3374
3384
3375
# This simple code will not work if ddx, ddy is greater than the
3385
3376
# separation between vertices.
3386
- _path = [Path (np .concatenate ([[(x0 + ddxA , y0 + ddyA )],
3377
+ paths = [Path (np .concatenate ([[(x0 + ddxA , y0 + ddyA )],
3387
3378
path .vertices [1 :- 1 ],
3388
3379
[(x3 + ddxB , y3 + ddyB )]]),
3389
3380
path .codes )]
3390
- _fillable = [False ]
3381
+ fills = [False ]
3391
3382
3392
3383
if has_begin_arrow :
3393
3384
if self .fillbegin :
3394
- p = np .concatenate ([verticesA , [verticesA [0 ],
3395
- verticesA [0 ]], ])
3396
- c = np .concatenate ([codesA , [Path .LINETO , Path .CLOSEPOLY ]])
3397
- _path .append (Path (p , c ))
3398
- _fillable .append (True )
3385
+ paths .append (
3386
+ Path ([* verticesA , (0 , 0 )], [* codesA , Path .CLOSEPOLY ]))
3387
+ fills .append (True )
3399
3388
else :
3400
- _path .append (Path (verticesA , codesA ))
3401
- _fillable .append (False )
3389
+ paths .append (Path (verticesA , codesA ))
3390
+ fills .append (False )
3402
3391
elif self ._beginarrow_bracket :
3403
3392
x0 , y0 = path .vertices [0 ]
3404
3393
x1 , y1 = path .vertices [1 ]
@@ -3407,19 +3396,17 @@ def transmute(self, path, mutation_size, linewidth):
3407
3396
self .lengthA * scaleA ,
3408
3397
self .angleA )
3409
3398
3410
- _path .append (Path (verticesA , codesA ))
3411
- _fillable .append (False )
3399
+ paths .append (Path (verticesA , codesA ))
3400
+ fills .append (False )
3412
3401
3413
3402
if has_end_arrow :
3414
3403
if self .fillend :
3415
- _fillable .append (True )
3416
- p = np .concatenate ([verticesB , [verticesB [0 ],
3417
- verticesB [0 ]], ])
3418
- c = np .concatenate ([codesB , [Path .LINETO , Path .CLOSEPOLY ]])
3419
- _path .append (Path (p , c ))
3404
+ fills .append (True )
3405
+ paths .append (
3406
+ Path ([* verticesB , (0 , 0 )], [* codesB , Path .CLOSEPOLY ]))
3420
3407
else :
3421
- _fillable .append (False )
3422
- _path .append (Path (verticesB , codesB ))
3408
+ fills .append (False )
3409
+ paths .append (Path (verticesB , codesB ))
3423
3410
elif self ._endarrow_bracket :
3424
3411
x0 , y0 = path .vertices [- 1 ]
3425
3412
x1 , y1 = path .vertices [- 2 ]
@@ -3428,10 +3415,10 @@ def transmute(self, path, mutation_size, linewidth):
3428
3415
self .lengthB * scaleB ,
3429
3416
self .angleB )
3430
3417
3431
- _path .append (Path (verticesB , codesB ))
3432
- _fillable .append (False )
3418
+ paths .append (Path (verticesB , codesB ))
3419
+ fills .append (False )
3433
3420
3434
- return _path , _fillable
3421
+ return paths , fills
3435
3422
3436
3423
@_register_style (_style_list , name = "-" )
3437
3424
class Curve (_Curve ):
@@ -3626,8 +3613,7 @@ def transmute(self, path, mutation_size, linewidth):
3626
3613
3627
3614
try :
3628
3615
arrow_out , arrow_in = \
3629
- split_bezier_intersecting_with_closedpath (
3630
- arrow_path , in_f , tolerance = 0.01 )
3616
+ split_bezier_intersecting_with_closedpath (arrow_path , in_f )
3631
3617
except NonIntersectingPathException :
3632
3618
# if this happens, make a straight line of the head_length
3633
3619
# long.
@@ -3707,7 +3693,7 @@ def transmute(self, path, mutation_size, linewidth):
3707
3693
in_f = inside_circle (x2 , y2 , head_length )
3708
3694
try :
3709
3695
path_out , path_in = split_bezier_intersecting_with_closedpath (
3710
- arrow_path , in_f , tolerance = 0.01 )
3696
+ arrow_path , in_f )
3711
3697
except NonIntersectingPathException :
3712
3698
# if this happens, make a straight line of the head_length
3713
3699
# long.
@@ -3721,7 +3707,7 @@ def transmute(self, path, mutation_size, linewidth):
3721
3707
# path for head
3722
3708
in_f = inside_circle (x2 , y2 , head_length * .8 )
3723
3709
path_out , path_in = split_bezier_intersecting_with_closedpath (
3724
- arrow_path , in_f , tolerance = 0.01 )
3710
+ arrow_path , in_f )
3725
3711
path_tail = path_out
3726
3712
3727
3713
# head
@@ -3739,7 +3725,7 @@ def transmute(self, path, mutation_size, linewidth):
3739
3725
# path for head
3740
3726
in_f = inside_circle (x0 , y0 , tail_width * .3 )
3741
3727
path_in , path_out = split_bezier_intersecting_with_closedpath (
3742
- arrow_path , in_f , tolerance = 0.01 )
3728
+ arrow_path , in_f )
3743
3729
tail_start = path_in [- 1 ]
3744
3730
3745
3731
head_right , head_left = head_r , head_l
0 commit comments