fix self-intersection of dumbbell curve
This commit is contained in:
parent
b74b9e4c7f
commit
d1dd84cdfa
|
@ -48,11 +48,11 @@ pub fn dumbbell(a: f64) -> impl Fn(f64) -> [f64; 2] {
|
|||
} else if t <= 0.75 {
|
||||
let tm4 = (t - 0.5) * 4.0;
|
||||
let t2 = tm4.powi(2);
|
||||
[-a * tm4, a * t2 * (1.0 - t2).sqrt()]
|
||||
[-a * tm4, -a * t2 * (1.0 - t2).sqrt()]
|
||||
} else {
|
||||
let tm4 = 1.0 - (t - 0.75) * 4.0;
|
||||
let t2 = tm4.powi(2);
|
||||
[-a * tm4, -a * t2 * (1.0 - t2).sqrt()]
|
||||
[-a * tm4, a * t2 * (1.0 - t2).sqrt()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue