@@ -472,41 +472,21 @@ def plot(self, **kwds):
472472 else :
473473 radius = ceil (self .r () / (2 * pi ))
474474 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 )
483477 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 )
492481 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' )
497483 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 )
506486 # Helper functions
507487
508488 def triangle (x ):
509- ( a , b ) = sorted (x [:2 ])
489+ a , b = sorted (x [:2 ])
510490 for p in self .vertices ():
511491 if (p , a ) in self .triangulation () or (a , p ) in self .triangulation ():
512492 if (p , b ) in self .triangulation () or (b , p ) in self .triangulation ():
@@ -522,7 +502,7 @@ def plot_arc(radius, p, q, **opts):
522502 if p - q in [1 , - 1 ]:
523503 def f (t ):
524504 return (radius * cos (t ), radius * sin (t ))
525- ( p , q ) = sorted ([p , q ])
505+ p , q = sorted ([p , q ])
526506 angle_p = vertex_to_angle (p )
527507 angle_q = vertex_to_angle (q )
528508 return parametric_plot (f (t ), (t , angle_q , angle_p ), ** opts )
@@ -533,7 +513,7 @@ def f(t):
533513 angle_p += 2 * pi
534514 internal_angle = angle_p - angle_q
535515 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 )
537517 internal_angle = angle_p - angle_q
538518 angle_center = (angle_p + angle_q ) / 2
539519 hypotenuse = radius / cos (internal_angle / 2 )
@@ -607,8 +587,8 @@ def vertex_to_angle(v):
607587 P += line ([(0 , 1.1 * radius ), (0 , - 1.1 * radius )],
608588 zorder = len (P ), ** reflections_opts )
609589 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 ))
612592 P += line ([(a , b ), (- a , - b )], zorder = len (P ), ** reflections_opts )
613593 # Wrap up
614594 P .set_aspect_ratio (1 )
0 commit comments