@@ -409,7 +409,7 @@ def find_control_points(c1x, c1y, mmx, mmy, c2x, c2y):
409409
410410def make_wedged_bezier2 (bezier2 , width , w1 = 1. , wm = 0.5 , w2 = 0. ):
411411 """
412- Being similar to get_parallels, returns control points of two quadrativ
412+ Being similar to get_parallels, returns control points of two quadratic
413413 bezier lines having a width roughly parallel to given one separated by
414414 *width*.
415415 """
@@ -460,31 +460,21 @@ def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
460460
461461def make_path_regular (p ):
462462 """
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.
464466 """
465467 c = p .codes
466468 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 )
469470 c [0 ] = Path .MOVETO
470-
471471 return Path (p .vertices , c )
472472 else :
473473 return p
474474
475475
476476def 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