fn point_mapper(i: i32, ring_radius: f32, model: &Model) -> impl Fn(i32) -> Point2 {
  // The goal here is to create an "offset" so the segments are rotated slightly which makes them lay together nicely.
  let start_rotation = 2.0 * PI / 3.0;
  let origin_x = map_range(
    i,
    0,
    model.n_rings,
    start_rotation,
    start_rotation + 2.0 * PI,
  )
  .cos()
    * model.radius
    / 4.0;
  let origin_y = map_range(
    i,
    0,
    model.n_rings,
    start_rotation,
    start_rotation + 2.0 * PI,
  )
  .sin()
    * model.radius
    / 4.0;
  move |deg| {
    let angle = deg_to_rad(deg as f32);
    let x = angle.cos() * ring_radius + origin_x;
    let y = angle.sin() * ring_radius + origin_y;
    pt2(x, y)
  }
}
// returns a closure suitable for a `map` function too convert degrees to points
returns a closure suitable for a `map` function too convert degrees to points
returns a closure suitable for a ` map ` function too convert degrees to points
fn point_mapper(i: i32, ring_radius: f32, model: &Model) -> impl Fn(i32) -> Point2 {
  // The goal here is to create an "offset" so the segments are rotated slightly which makes them lay together nicely.
  let start_rotation = 2.0 * PI / 3.0;
  let origin_x = map_range(
    i,
    0,
    model.n_rings,
    start_rotation,
    start_rotation + 2.0 * PI,
  )
  .cos()
    * model.radius
    / 4.0;
  let origin_y = map_range(
    i,
    0,
    model.n_rings,
    start_rotation,
    start_rotation + 2.0 * PI,
  )
  .sin()
    * model.radius
    / 4.0;
  move |deg| {
    let angle = deg_to_rad(deg as f32);
    let x = angle.cos() * ring_radius + origin_x;
    let y = angle.sin() * ring_radius + origin_y;
    pt2(x, y)
  }
}
fn point_mapper ( i : i32 , ring_radius : f32 , model : & Model ) -> impl Fn ( i32 ) -> Point2 { // The goal here is to create an "offset" so the segments are rotated slightly which makes them lay together nicely. let start_rotation = 2.0 * PI / 3.0 ; let origin_x = map_range ( i , 0 , model . n_rings , start_rotation , start_rotation + 2.0 * PI , ) . cos ( ) * model . radius / 4.0 ; let origin_y = map_range ( i , 0 , model . n_rings , start_rotation , start_rotation + 2.0 * PI , ) . sin ( ) * model . radius / 4.0 ; move | deg | { let angle = deg_to_rad ( deg as f32 ) ; let x = angle . cos ( ) * ring_radius + origin_x ; let y = angle . sin ( ) * ring_radius + origin_y ; pt2 ( x , y ) } }
returns a closure suitable for a `map` function too convert degrees to points
returns a closure suitable for a ` map ` function too convert degrees to points
i
i32
ring_radius
f32
model
&Model