+dumbbell
This commit is contained in:
parent
0de797d45b
commit
1f81337913
2 changed files with 13 additions and 0 deletions
|
@ -34,6 +34,14 @@ pub fn circle_sin_chain1(w: f64) -> impl Fn(f64) -> [f64; 2] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// source: https://mathworld.wolfram.com/DumbbellCurve.html
|
||||||
|
pub fn dumbbell(a: f64) -> impl Fn(f64) -> [f64; 2] {
|
||||||
|
move |t: f64| {
|
||||||
|
let t2 = t * t;
|
||||||
|
[a * t, a * t2 * (1.0 - t2).sqrt()]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn ellipse(a: f64, b: f64) -> impl Fn(f64) -> [f64; 2] {
|
pub fn ellipse(a: f64, b: f64) -> impl Fn(f64) -> [f64; 2] {
|
||||||
move |t: f64| {
|
move |t: f64| {
|
||||||
let cdat = circle(t);
|
let cdat = circle(t);
|
||||||
|
|
|
@ -12,6 +12,7 @@ pub enum SelectExample {
|
||||||
CassiniAntiAstroid { ca: f64, cc: f64, aa: f64 },
|
CassiniAntiAstroid { ca: f64, cc: f64, aa: f64 },
|
||||||
CassiniAstroidTsq { ca: f64, cc: f64, aa: f64 },
|
CassiniAstroidTsq { ca: f64, cc: f64, aa: f64 },
|
||||||
|
|
||||||
|
Dumbbell { a: f64 },
|
||||||
Ellipse { a: f64, b: f64 },
|
Ellipse { a: f64, b: f64 },
|
||||||
Lemniskate { a: f64 },
|
Lemniskate { a: f64 },
|
||||||
CirclePow { k: f64 },
|
CirclePow { k: f64 },
|
||||||
|
@ -42,6 +43,9 @@ impl SelectExample {
|
||||||
*cc += l;
|
*cc += l;
|
||||||
*aa += l;
|
*aa += l;
|
||||||
}
|
}
|
||||||
|
Self::Dumbbell { a } => {
|
||||||
|
*a += l;
|
||||||
|
}
|
||||||
Self::Ellipse { a, b } => {
|
Self::Ellipse { a, b } => {
|
||||||
*a /= 1.0 + l;
|
*a /= 1.0 + l;
|
||||||
*b *= 1.0 + l;
|
*b *= 1.0 + l;
|
||||||
|
@ -79,6 +83,7 @@ impl SelectExample {
|
||||||
let x = ex::cassini_astroid(ca, cc, aa);
|
let x = ex::cassini_astroid(ca, cc, aa);
|
||||||
Box::new(move |t: f64| x(t * t))
|
Box::new(move |t: f64| x(t * t))
|
||||||
}
|
}
|
||||||
|
Self::Dumbbell { a } => Box::new(ex::dumbbell(a)),
|
||||||
Self::Ellipse { a, b } => Box::new(ex::ellipse(a, b)),
|
Self::Ellipse { a, b } => Box::new(ex::ellipse(a, b)),
|
||||||
Self::Lemniskate { a } => Box::new(move |t: f64| ex::lemniskate(t, a)),
|
Self::Lemniskate { a } => Box::new(move |t: f64| ex::lemniskate(t, a)),
|
||||||
Self::CirclePow { k } => Box::new(ex::circle_pow(k)),
|
Self::CirclePow { k } => Box::new(ex::circle_pow(k)),
|
||||||
|
|
Loading…
Reference in a new issue