fn slight_curve(&self, start: Point2, end: Point2, draw: &Draw) {
    let (lum, alpha) = self.adjust_lum_alpha();
    let x_range = end.x - start.x;
    let y_range = end.y - start.y;
    let angle = y_range.atan2(x_range);
    let segments = 20;
    let dx = x_range / segments as f32;
    let dy = y_range / segments as f32;
    let segment_length = start.distance(end) / segments as f32;
    let points: Vec<Point2> = (0..segments)
      .map(|n| {
        let pos = n as f32 / segments as f32;
        let x = angle.cos() * segment_length + dx * n as f32 + start.x;
        let y = angle.sin() * segment_length + dy * n as f32 + start.y;
        // let x = x + (pos * (PI + angle)).cos() * 20.;// + (angle + PI).cos() * 20.;
        let y = y + (pos * (PI + angle)).sin() * 10.; // + (angle + PI).sin() * 20.;
        pt2(x, y)
      })
      .collect();

    draw
      .polyline()
      .color(hsla(self.hsla[0], self.hsla[1], lum, alpha))
      .weight(0.5)
      .points(points);
  }
// give the stroke a subtle arc by giving it half a sin curve.
// Turns out this isn't super easy!
give the stroke a subtle arc by giving it half a sin curve.
Turns out this isn't super easy!
give the stroke a subtle arc by giving it half a sin curve . Turns out this isn ' t super easy!
fn slight_curve(&self, start: Point2, end: Point2, draw: &Draw) {
    let (lum, alpha) = self.adjust_lum_alpha();
    let x_range = end.x - start.x;
    let y_range = end.y - start.y;
    let angle = y_range.atan2(x_range);
    let segments = 20;
    let dx = x_range / segments as f32;
    let dy = y_range / segments as f32;
    let segment_length = start.distance(end) / segments as f32;
    let points: Vec<Point2> = (0..segments)
      .map(|n| {
        let pos = n as f32 / segments as f32;
        let x = angle.cos() * segment_length + dx * n as f32 + start.x;
        let y = angle.sin() * segment_length + dy * n as f32 + start.y;
        // let x = x + (pos * (PI + angle)).cos() * 20.;// + (angle + PI).cos() * 20.;
        let y = y + (pos * (PI + angle)).sin() * 10.; // + (angle + PI).sin() * 20.;
        pt2(x, y)
      })
      .collect();
    draw
      .polyline()
      .color(hsla(self.hsla[0], self.hsla[1], lum, alpha))
      .weight(0.5)
      .points(points);
  }
fn slight_curve ( & self , start : Point2 , end : Point2 , draw : & Draw ) { let ( lum , alpha ) = self . adjust_lum_alpha ( ) ; let x_range = end . x - start . x ; let y_range = end . y - start . y ; let angle = y_range . atan2 ( x_range ) ; let segments = 20 ; let dx = x_range / segments as f32 ; let dy = y_range / segments as f32 ; let segment_length = start . distance ( end ) / segments as f32 ; let points : Vec < Point2 > = ( 0 .. segments ) . map ( | n | { let pos = n as f32 / segments as f32 ; let x = angle . cos ( ) * segment_length + dx * n as f32 + start . x ; let y = angle . sin ( ) * segment_length + dy * n as f32 + start . y ; // let x = x + (pos * (PI + angle)).cos() * 20.;// + (angle + PI).cos() * 20.; let y = y + ( pos * ( PI + angle ) ) . sin ( ) * 10. ; // + (angle + PI).sin() * 20.; pt2 ( x , y ) } ) . collect ( ) ; draw . polyline ( ) . color ( hsla ( self . hsla [ 0 ] , self . hsla [ 1 ] , lum , alpha ) ) . weight ( 0.5 ) . points ( points ) ; }
give the stroke a subtle arc by giving it half a sin curve.
give the stroke a subtle arc by giving it half a sin curve .
&self
start
Point2
end
Point2
draw
&Draw