File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,26 +108,20 @@ impl Component for Simulation {
108108 for boid in & self . boids {
109109
110110 let color = format!( "hsl({:.3}rad, 100%, 50%)" , boid. hue) ;
111-
112111 let mut points = String :: new( ) ;
113-
114- const SHAPE : [ ( f64 , f64 ) ; 3 ] = [
112+ for offset in [
115113 ( 0. * math:: FRAC_TAU_3 , 2.0 ) ,
116114 ( 1. * math:: FRAC_TAU_3 , 1.0 ) ,
117115 ( 2. * math:: FRAC_TAU_3 , 1.0 ) ,
118- ] ;
119-
120- for offset in SHAPE
116+ ]
121117 . iter( )
122118 . copied( )
123119 . map( move |( angle, radius_mul) | Vector2D :: from_polar( angle + boid. velocity. angle( ) , radius_mul * boid. radius) ) {
124120 let Vector2D { x, y } = boid. position + offset;
125-
126121 // Write to string will never fail.
127122 let _ = write!( points, "{x:.2},{y:.2} " ) ;
128123 } ;
129124
130-
131125 <polygon { points} fill={ color} />
132126 }
133127 </svg>
You can’t perform that action at this time.
0 commit comments