@@ -472,41 +472,21 @@ def plot(self, **kwds):
472
472
else :
473
473
radius = ceil (self .r () / (2 * pi ))
474
474
points_opts = {}
475
- if 'points_color' in kwds :
476
- points_opts ['color' ] = kwds ['points_color' ]
477
- else :
478
- points_opts ['color' ] = 'black'
479
- if 'points_size' in kwds :
480
- points_opts ['size' ] = kwds ['points_size' ]
481
- else :
482
- points_opts ['size' ] = 7
475
+ points_opts ['color' ] = kwds .get ('points_color' , 'black' )
476
+ points_opts ['size' ] = kwds .get ('points_size' , 7 )
483
477
triangulation_opts = {}
484
- if 'triangulation_color' in kwds :
485
- triangulation_opts ['color' ] = kwds ['triangulation_color' ]
486
- else :
487
- triangulation_opts ['color' ] = 'black'
488
- if 'triangulation_thickness' in kwds :
489
- triangulation_opts ['thickness' ] = kwds ['triangulation_thickness' ]
490
- else :
491
- triangulation_opts ['thickness' ] = 0.5
478
+ triangulation_opts ['color' ] = kwds .get ('triangulation_color' , 'black' )
479
+ triangulation_opts ['thickness' ] = kwds .get ('triangulation_thickness' ,
480
+ 0.5 )
492
481
shading_opts = {}
493
- if 'shading_color' in kwds :
494
- shading_opts ['color' ] = kwds ['shading_color' ]
495
- else :
496
- shading_opts ['color' ] = 'lightgray'
482
+ shading_opts ['color' ] = kwds .get ('shading_color' , 'lightgray' )
497
483
reflections_opts = {}
498
- if 'reflections_color' in kwds :
499
- reflections_opts ['color' ] = kwds ['reflections_color' ]
500
- else :
501
- reflections_opts ['color' ] = 'blue'
502
- if 'reflections_thickness' in kwds :
503
- reflections_opts ['thickness' ] = kwds ['reflections_thickness' ]
504
- else :
505
- reflections_opts ['thickness' ] = 1
484
+ reflections_opts ['color' ] = kwds .get ('reflections_color' , 'blue' )
485
+ reflections_opts ['thickness' ] = kwds .get ('reflections_thickness' , 1 )
506
486
# Helper functions
507
487
508
488
def triangle (x ):
509
- ( a , b ) = sorted (x [:2 ])
489
+ a , b = sorted (x [:2 ])
510
490
for p in self .vertices ():
511
491
if (p , a ) in self .triangulation () or (a , p ) in self .triangulation ():
512
492
if (p , b ) in self .triangulation () or (b , p ) in self .triangulation ():
@@ -522,7 +502,7 @@ def plot_arc(radius, p, q, **opts):
522
502
if p - q in [1 , - 1 ]:
523
503
def f (t ):
524
504
return (radius * cos (t ), radius * sin (t ))
525
- ( p , q ) = sorted ([p , q ])
505
+ p , q = sorted ([p , q ])
526
506
angle_p = vertex_to_angle (p )
527
507
angle_q = vertex_to_angle (q )
528
508
return parametric_plot (f (t ), (t , angle_q , angle_p ), ** opts )
@@ -533,7 +513,7 @@ def f(t):
533
513
angle_p += 2 * pi
534
514
internal_angle = angle_p - angle_q
535
515
if internal_angle > pi :
536
- ( angle_p , angle_q ) = (angle_q + 2 * pi , angle_p )
516
+ angle_p , angle_q = (angle_q + 2 * pi , angle_p )
537
517
internal_angle = angle_p - angle_q
538
518
angle_center = (angle_p + angle_q ) / 2
539
519
hypotenuse = radius / cos (internal_angle / 2 )
@@ -607,8 +587,8 @@ def vertex_to_angle(v):
607
587
P += line ([(0 , 1.1 * radius ), (0 , - 1.1 * radius )],
608
588
zorder = len (P ), ** reflections_opts )
609
589
axis_angle = vertex_to_angle (- 0.5 * (self .rk () + (1 , 1 ))[1 ])
610
- ( a , b ) = (1.1 * radius * cos (axis_angle ),
611
- 1.1 * radius * sin (axis_angle ))
590
+ a , b = (1.1 * radius * cos (axis_angle ),
591
+ 1.1 * radius * sin (axis_angle ))
612
592
P += line ([(a , b ), (- a , - b )], zorder = len (P ), ** reflections_opts )
613
593
# Wrap up
614
594
P .set_aspect_ratio (1 )
0 commit comments