fn update(_app: &App, model: &mut Model, _update: Update) {
  // let Model { blobs, resolution, .. } = model;

  model.blobs = model
    .blobs
    .iter()
    .map(|blob| ExpandoBlob {
      id: blob.id,
      origin: blob.origin,
      points: blob
        .points
        .clone()
        .iter()
        .enumerate()
        .map(|(i, pt)| {
          // find new point by expanding outwards by 1
          let angle = map_range(i, 0, model.resolution as usize - 1, 0.0, 2.0 * PI);
          let new_pt = pt2(pt.x + angle.cos(), pt.y + angle.sin());
          // check intersections with all points in all other blobs.
          // Ignore current blob, so that closely-spaced adjacent points don't cause failure
          // if intersection, do not move, else move
          if model
            .blobs
            .clone()
            .iter()
            .filter(|b| b.id != blob.id)
            .flat_map(|b| b.points.clone())
            .any(|p| p.distance(new_pt) < model.padding)
          {
            pt.clone()
          } else {
            new_pt
          }
        })
        .collect(),
    })
    .collect();
}
// each update, expand the points in the blobs until they hit another point
each update, expand the points in the blobs until they hit another point
each update expand the points in the blobs until they hit another point
fn update(_app: &App, model: &mut Model, _update: Update) {
  // let Model { blobs, resolution, .. } = model;
  model.blobs = model
    .blobs
    .iter()
    .map(|blob| ExpandoBlob {
      id: blob.id,
      origin: blob.origin,
      points: blob
        .points
        .clone()
        .iter()
        .enumerate()
        .map(|(i, pt)| {
          // find new point by expanding outwards by 1
          let angle = map_range(i, 0, model.resolution as usize - 1, 0.0, 2.0 * PI);
          let new_pt = pt2(pt.x + angle.cos(), pt.y + angle.sin());
          // check intersections with all points in all other blobs.
          // Ignore current blob, so that closely-spaced adjacent points don't cause failure
          // if intersection, do not move, else move
          if model
            .blobs
            .clone()
            .iter()
            .filter(|b| b.id != blob.id)
            .flat_map(|b| b.points.clone())
            .any(|p| p.distance(new_pt) < model.padding)
          {
            pt.clone()
          } else {
            new_pt
          }
        })
        .collect(),
    })
    .collect();
}
fn update ( _app : & App , model : & mut Model , _update : Update ) { // let Model { blobs, resolution, .. } = model; model . blobs = model . blobs . iter ( ) . map ( | blob | ExpandoBlob { id : blob . id , origin : blob . origin , points : blob . points . clone ( ) . iter ( ) . enumerate ( ) . map ( | ( i , pt ) | { // find new point by expanding outwards by 1 let angle = map_range ( i , 0 , model . resolution as usize - 1 , 0.0 , 2.0 * PI ) ; let new_pt = pt2 ( pt . x + angle . cos ( ) , pt . y + angle . sin ( ) ) ; // check intersections with all points in all other blobs. // Ignore current blob, so that closely-spaced adjacent points don't cause failure // if intersection, do not move, else move if model . blobs . clone ( ) . iter ( ) . filter ( | b | b . id != blob . id ) . flat_map ( | b | b . points . clone ( ) ) . any ( | p | p . distance ( new_pt ) < model . padding ) { pt . clone ( ) } else { new_pt } } ) . collect ( ) , } ) . collect ( ) ; }
each update, expand the points in the blobs until they hit another point
each update expand the points in the blobs until they hit another point
_app
&App
model
&mut Model
_update
Update