File tree 1 file changed +9
-8
lines changed
examples/shapes_and_collections 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 75
75
parts = dolphin .split ()
76
76
i = 0
77
77
code_map = {
78
- 'M' : (Path .MOVETO , 1 ),
79
- 'C' : (Path .CURVE4 , 3 ),
80
- 'L' : (Path .LINETO , 1 )}
78
+ 'M' : Path .MOVETO ,
79
+ 'C' : Path .CURVE4 ,
80
+ 'L' : Path .LINETO ,
81
+ }
81
82
82
83
while i < len (parts ):
83
- code = parts [i ]
84
- path_code , npoints = code_map [ code ]
84
+ path_code = code_map [ parts [i ] ]
85
+ npoints = Path . NUM_VERTICES_FOR_CODE [ path_code ]
85
86
codes .extend ([path_code ] * npoints )
86
- vertices .extend ([[float ( x ) for x in y .split (',' )] for y in
87
- parts [i + 1 :i + npoints + 1 ]])
87
+ vertices .extend ([[* map ( float , y .split (',' ))]
88
+ for y in parts [i + 1 :][: npoints ]])
88
89
i += npoints + 1
89
- vertices = np .array (vertices , float )
90
+ vertices = np .array (vertices )
90
91
vertices [:, 1 ] -= 160
91
92
92
93
dolphin_path = Path (vertices , codes )
You can’t perform that action at this time.
0 commit comments