fn view(app: &App, model: &Model, frame: Frame) {
  let draw = app.draw();
  draw.background().color(WHITESMOKE);

  let points: Vec<Point> = (0..=model.n_circles)
    .flat_map(|n| {
      let frac = n as f32 / model.n_circles as f32;
      let noise = random_range(model.noise_scale * 0.98, model.noise_scale * 1.02);
      // need to look at nannou built-ins, I'm sure there are better options than this
      let radius = Interp::exp(model.radius / 10.0, model.radius, frac);

      let inner_points = Blob::new()
        .x_y(model.x_origin, model.y_origin)
        .radius(radius)
        .noise_scale(noise * (frac + 1.0))
        .seed(model.seed)
        .fuzziness(2.0)
        .rotate_rad(frac * PI)
        .resolution(model.resolution)
        .points();

      // removing the last point from here eliminates any duplicates that may be created from Blob::points()
      inner_points[0..inner_points.len() - 1].to_vec()
    })
    .map(|p| Point {
      x: p.x as f64,
      y: p.y as f64,
    })
    .collect();

  let delauney = triangulate(&points).expect("No triangulation exists.");

  // delauney.triangles is flat array,
  // where every 3 values represents the indices of the points of a triangle
  for n in 0..delauney.triangles.len() / 3 {
    let tri_points = (3 * n..=3 * n + 2) // indices of delauney.triangles
      .map(|i| delauney.triangles[i]) // indices of points
      .map(|p| points[p].clone()) // the actual points
      .map(|p| pt2(p.x as f32, p.y as f32)); // proper data type
    let frac = (3 * n) as f32 / delauney.triangles.len() as f32;
    let hue = 0.6 + frac / 2.0;
    let lum = 0.6 + frac / 10.0;
    draw
      .polygon()
      .stroke(hsl(hue, 0.5, lum - 0.2))
      .color(hsl(hue, 0.5, lum))
      .points(tri_points);
  }

  // Write to the window frame and capture image
  draw.to_frame(app, &frame).unwrap();
  app
    .main_window()
    .capture_frame_threaded(captured_frame_path(app, &frame));
}
// the only thing this should do is draw the model.grid (or maybe model.next)
the only thing this should do is draw the model.grid (or maybe model.next)
the only thing this should do is draw the model . grid ( or maybe model . next )
fn view(app: &App, model: &Model, frame: Frame) {
  let draw = app.draw();
  draw.background().color(WHITESMOKE);
  let points: Vec<Point> = (0..=model.n_circles)
    .flat_map(|n| {
      let frac = n as f32 / model.n_circles as f32;
      let noise = random_range(model.noise_scale * 0.98, model.noise_scale * 1.02);
      // need to look at nannou built-ins, I'm sure there are better options than this
      let radius = Interp::exp(model.radius / 10.0, model.radius, frac);
      let inner_points = Blob::new()
        .x_y(model.x_origin, model.y_origin)
        .radius(radius)
        .noise_scale(noise * (frac + 1.0))
        .seed(model.seed)
        .fuzziness(2.0)
        .rotate_rad(frac * PI)
        .resolution(model.resolution)
        .points();
      // removing the last point from here eliminates any duplicates that may be created from Blob::points()
      inner_points[0..inner_points.len() - 1].to_vec()
    })
    .map(|p| Point {
      x: p.x as f64,
      y: p.y as f64,
    })
    .collect();
  let delauney = triangulate(&points).expect("No triangulation exists.");
  // delauney.triangles is flat array,
  // where every 3 values represents the indices of the points of a triangle
  for n in 0..delauney.triangles.len() / 3 {
    let tri_points = (3 * n..=3 * n + 2) // indices of delauney.triangles
      .map(|i| delauney.triangles[i]) // indices of points
      .map(|p| points[p].clone()) // the actual points
      .map(|p| pt2(p.x as f32, p.y as f32)); // proper data type
    let frac = (3 * n) as f32 / delauney.triangles.len() as f32;
    let hue = 0.6 + frac / 2.0;
    let lum = 0.6 + frac / 10.0;
    draw
      .polygon()
      .stroke(hsl(hue, 0.5, lum - 0.2))
      .color(hsl(hue, 0.5, lum))
      .points(tri_points);
  }
  // Write to the window frame and capture image
  draw.to_frame(app, &frame).unwrap();
  app
    .main_window()
    .capture_frame_threaded(captured_frame_path(app, &frame));
}
fn view ( app : & App , model : & Model , frame : Frame ) { let draw = app . draw ( ) ; draw . background ( ) . color ( WHITESMOKE ) ; let points : Vec < Point > = ( 0 ..= model . n_circles ) . flat_map ( | n | { let frac = n as f32 / model . n_circles as f32 ; let noise = random_range ( model . noise_scale * 0.98 , model . noise_scale * 1.02 ) ; // need to look at nannou built-ins, I'm sure there are better options than this let radius = Interp :: exp ( model . radius / 10.0 , model . radius , frac ) ; let inner_points = Blob :: new ( ) . x_y ( model . x_origin , model . y_origin ) . radius ( radius ) . noise_scale ( noise * ( frac + 1.0 ) ) . seed ( model . seed ) . fuzziness ( 2.0 ) . rotate_rad ( frac * PI ) . resolution ( model . resolution ) . points ( ) ; // removing the last point from here eliminates any duplicates that may be created from Blob::points() inner_points [ 0 .. inner_points . len ( ) - 1 ] . to_vec ( ) } ) . map ( | p | Point { x : p . x as f64 , y : p . y as f64 , } ) . collect ( ) ; let delauney = triangulate ( & points ) . expect ( " " ) ; // delauney.triangles is flat array, // where every 3 values represents the indices of the points of a triangle for n in 0 .. delauney . triangles . len ( ) / 3 { let tri_points = ( 3 * n ..= 3 * n + 2 ) // indices of delauney.triangles . map ( | i | delauney . triangles [ i ] ) // indices of points . map ( | p | points [ p ] . clone ( ) ) // the actual points . map ( | p | pt2 ( p . x as f32 , p . y as f32 ) ) ; // proper data type let frac = ( 3 * n ) as f32 / delauney . triangles . len ( ) as f32 ; let hue = 0.6 + frac / 2.0 ; let lum = 0.6 + frac / 10.0 ; draw . polygon ( ) . stroke ( hsl ( hue , 0.5 , lum - 0.2 ) ) . color ( hsl ( hue , 0.5 , lum ) ) . points ( tri_points ) ; } // Write to the window frame and capture image draw . to_frame ( app , & frame ) . unwrap ( ) ; app . main_window ( ) . capture_frame_threaded ( captured_frame_path ( app , & frame ) ) ; }
the only thing this should do is draw the model.grid (or maybe model.next)
the only thing this should do is draw the model . grid ( or maybe model . next )
app
&App
model
&Model
frame
Frame