fn stagger(&self, start: Point2, end: Point2, stagger_frac: f32) -> (Point2, Point2) {
    let middle_weight = 1. - (0.5 - stagger_frac).abs();
    let distance = start.distance(end);
    let orientation = (end.y - start.y).atan2(end.x - start.x);

    let start_offset = nextf(-0.1, 0.1) * middle_weight;
    let start_x = start.x + orientation.cos() * distance * start_offset;
    let start_y = start.y + orientation.sin() * distance * start_offset;

    let end_offset = nextf(-0.5, 0.2) * middle_weight;
    let end_x = end.x + orientation.cos() * distance * end_offset;
    let end_y = end.y + orientation.sin() * distance * end_offset;
    (pt2(start_x, start_y), pt2(end_x, end_y))
  }
// stagger_frac will be a value between 0 and 1.
// When it is near the middle, offset should be highest
stagger_frac will be a value between 0 and 1.
When it is near the middle, offset should be highest
stagger_frac will be a value between 0 and 1 . When it is near the middle offset should be highest
fn stagger(&self, start: Point2, end: Point2, stagger_frac: f32) -> (Point2, Point2) {
    let middle_weight = 1. - (0.5 - stagger_frac).abs();
    let distance = start.distance(end);
    let orientation = (end.y - start.y).atan2(end.x - start.x);
    let start_offset = nextf(-0.1, 0.1) * middle_weight;
    let start_x = start.x + orientation.cos() * distance * start_offset;
    let start_y = start.y + orientation.sin() * distance * start_offset;
    let end_offset = nextf(-0.5, 0.2) * middle_weight;
    let end_x = end.x + orientation.cos() * distance * end_offset;
    let end_y = end.y + orientation.sin() * distance * end_offset;
    (pt2(start_x, start_y), pt2(end_x, end_y))
  }
fn stagger ( & self , start : Point2 , end : Point2 , stagger_frac : f32 ) -> ( Point2 , Point2 ) { let middle_weight = 1. - ( 0.5 - stagger_frac ) . abs ( ) ; let distance = start . distance ( end ) ; let orientation = ( end . y - start . y ) . atan2 ( end . x - start . x ) ; let start_offset = nextf ( - 0.1 , 0.1 ) * middle_weight ; let start_x = start . x + orientation . cos ( ) * distance * start_offset ; let start_y = start . y + orientation . sin ( ) * distance * start_offset ; let end_offset = nextf ( - 0.5 , 0.2 ) * middle_weight ; let end_x = end . x + orientation . cos ( ) * distance * end_offset ; let end_y = end . y + orientation . sin ( ) * distance * end_offset ; ( pt2 ( start_x , start_y ) , pt2 ( end_x , end_y ) ) }
stagger_frac will be a value between 0 and 1.
stagger_frac will be a value between 0 and 1 .
&self
start
Point2
end
Point2
stagger_frac
f32