@@ -440,20 +440,28 @@ def arc(cls, theta1, theta2, is_wedge=False, n=None):
440
440
n = int (2 ** math .ceil ((eta2 - eta1 ) / halfpi ))
441
441
442
442
deta = (eta2 - eta1 ) / n
443
- etaB = eta1
443
+ t = math .tan (0.5 * deta )
444
+ alpha = math .sin (deta ) * (math .sqrt (4.0 + 3.0 * t * t ) - 1 ) / 3.0
445
+
446
+ steps = npy .linspace (eta1 , eta2 , n + 1 , True )
447
+ cos_eta = npy .cos (steps )
448
+ sin_eta = npy .sin (steps )
449
+
450
+ xA = cos_eta [:- 1 ]
451
+ yA = sin_eta [:- 1 ]
452
+ xA_dot = - yA
453
+ yA_dot = xA
444
454
445
- cos_etaB = math .cos (etaB )
446
- sin_etaB = math .sin (etaB )
447
- xB = cos_etaB
448
- yB = sin_etaB
449
- xB_dot = - sin_etaB
450
- yB_dot = cos_etaB
455
+ xB = cos_eta [1 :]
456
+ yB = sin_eta [1 :]
457
+ xB_dot = - yB
458
+ yB_dot = xB
451
459
452
460
if is_wedge :
453
461
length = n * 3 + 4
454
462
vertices = npy .zeros ((length , 2 ), npy .float_ )
455
463
codes = Path .CURVE4 * npy .ones ((length , ), Path .code_type )
456
- vertices [1 ] = [xB , yB ]
464
+ vertices [1 ] = [xA [ 0 ], yA [ 0 ] ]
457
465
codes [0 :2 ] = [Path .MOVETO , Path .LINETO ]
458
466
codes [- 2 :] = [Path .LINETO , Path .CLOSEPOLY ]
459
467
vertex_offset = 2
@@ -462,28 +470,11 @@ def arc(cls, theta1, theta2, is_wedge=False, n=None):
462
470
length = n * 3 + 1
463
471
vertices = npy .zeros ((length , 2 ), npy .float_ )
464
472
codes = Path .CURVE4 * npy .ones ((length , ), Path .code_type )
465
- vertices [0 ] = [xB , yB ]
473
+ vertices [0 ] = [xA [ 0 ], yA [ 0 ] ]
466
474
codes [0 ] = Path .MOVETO
467
475
vertex_offset = 1
468
476
end = length
469
477
470
- t = math .tan (0.5 * deta )
471
- alpha = math .sin (deta ) * (math .sqrt (4.0 + 3.0 * t * t ) - 1 ) / 3.0
472
-
473
- steps = npy .linspace (eta1 , eta2 , n + 1 , True )
474
- cos_eta = npy .cos (steps )
475
- sin_eta = npy .sin (steps )
476
-
477
- xA = cos_eta [:- 1 ]
478
- yA = sin_eta [:- 1 ]
479
- xA_dot = - yA
480
- yA_dot = xA
481
-
482
- xB = cos_eta [1 :]
483
- yB = sin_eta [1 :]
484
- xB_dot = - yB
485
- yB_dot = xB
486
-
487
478
vertices [vertex_offset :end :3 , 0 ] = xA + alpha * xA_dot
488
479
vertices [vertex_offset :end :3 , 1 ] = yA + alpha * yA_dot
489
480
vertices [vertex_offset + 1 :end :3 , 0 ] = xB - alpha * xB_dot
0 commit comments