@@ -409,7 +409,7 @@ def find_control_points(c1x, c1y, mmx, mmy, c2x, c2y):
409
409
410
410
def make_wedged_bezier2 (bezier2 , width , w1 = 1. , wm = 0.5 , w2 = 0. ):
411
411
"""
412
- Being similar to get_parallels, returns control points of two quadrativ
412
+ Being similar to get_parallels, returns control points of two quadratic
413
413
bezier lines having a width roughly parallel to given one separated by
414
414
*width*.
415
415
"""
@@ -460,31 +460,21 @@ def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
460
460
461
461
def make_path_regular (p ):
462
462
"""
463
- fill in the codes if None.
463
+ If the :attr:`codes` attribute of `Path` *p* is None, return a copy of *p*
464
+ with the :attr:`codes` set to (MOVETO, LINETO, LINETO, ..., LINETO);
465
+ otherwise return *p* itself.
464
466
"""
465
467
c = p .codes
466
468
if c is None :
467
- c = np .empty (p .vertices .shape [:1 ], "i" )
468
- c .fill (Path .LINETO )
469
+ c = np .full (len (p .vertices ), Path .LINETO , dtype = Path .code_type )
469
470
c [0 ] = Path .MOVETO
470
-
471
471
return Path (p .vertices , c )
472
472
else :
473
473
return p
474
474
475
475
476
476
def concatenate_paths (paths ):
477
- """
478
- concatenate list of paths into a single path.
479
- """
480
-
481
- vertices = []
482
- codes = []
483
- for p in paths :
484
- p = make_path_regular (p )
485
- vertices .append (p .vertices )
486
- codes .append (p .codes )
487
-
488
- _path = Path (np .concatenate (vertices ),
489
- np .concatenate (codes ))
490
- return _path
477
+ """Concatenate a list of paths into a single path."""
478
+ vertices = np .concatenate ([p .vertices for p in paths ])
479
+ codes = np .concatenate ([make_path_regular (p ).codes for p in paths ])
480
+ return Path (vertices , codes )
0 commit comments