pub trait Interpolate<T>: Sized + Copy {
// Required methods
fn step(t: T, threshold: T, a: Self, b: Self) -> Self;
fn lerp(t: T, a: Self, b: Self) -> Self;
fn cosine(t: T, a: Self, b: Self) -> Self;
fn cubic_hermite(
t: T,
x: (T, Self),
a: (T, Self),
b: (T, Self),
y: (T, Self),
) -> Self;
fn quadratic_bezier(t: T, a: Self, u: Self, b: Self) -> Self;
fn cubic_bezier(t: T, a: Self, u: Self, v: Self, b: Self) -> Self;
fn cubic_bezier_mirrored(t: T, a: Self, u: Self, v: Self, b: Self) -> Self;
}Expand description
Required Methods§
Sourcefn cubic_hermite(
t: T,
x: (T, Self),
a: (T, Self),
b: (T, Self),
y: (T, Self),
) -> Self
fn cubic_hermite( t: T, x: (T, Self), a: (T, Self), b: (T, Self), y: (T, Self), ) -> Self
Cubic hermite interpolation.
Sourcefn quadratic_bezier(t: T, a: Self, u: Self, b: Self) -> Self
fn quadratic_bezier(t: T, a: Self, u: Self, b: Self) -> Self
Quadratic Bézier interpolation.
a is the first point; b is the second point and u is the tangent of a to the curve.
Sourcefn cubic_bezier(t: T, a: Self, u: Self, v: Self, b: Self) -> Self
fn cubic_bezier(t: T, a: Self, u: Self, v: Self, b: Self) -> Self
Cubic Bézier interpolation.
a is the first point; b is the second point; u is the output tangent of a to the curve and v is the
input tangent of b to the curve.
Sourcefn cubic_bezier_mirrored(t: T, a: Self, u: Self, v: Self, b: Self) -> Self
fn cubic_bezier_mirrored(t: T, a: Self, u: Self, v: Self, b: Self) -> Self
Cubic Bézier interpolation – special case for non-explicit second tangent.
This version does the same computation as Interpolate::cubic_bezier but computes the second tangent by
inversing it (typical when the next point uses a Bézier interpolation, where input and output tangents are
mirrored for the same key).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Interpolate<f32> for f32
Available on crate features std or num-traits only.
impl Interpolate<f32> for f32
std or num-traits only.fn step(t: f32, threshold: f32, a: Self, b: Self) -> Self
fn cosine(t: f32, a: Self, b: Self) -> Self
fn lerp(t: f32, a: Self, b: Self) -> Self
fn cubic_hermite( t: f32, x: (f32, Self), a: (f32, Self), b: (f32, Self), y: (f32, Self), ) -> Self
fn quadratic_bezier(t: f32, a: Self, u: Self, b: Self) -> Self
fn cubic_bezier(t: f32, a: Self, u: Self, v: Self, b: Self) -> Self
fn cubic_bezier_mirrored(t: f32, a: Self, u: Self, v: Self, b: Self) -> Self
Source§impl Interpolate<f32> for f64
Available on crate features std or num-traits only.
impl Interpolate<f32> for f64
std or num-traits only.fn step(t: f32, threshold: f32, a: Self, b: Self) -> Self
fn cosine(t: f32, a: Self, b: Self) -> Self
fn lerp(t: f32, a: Self, b: Self) -> Self
fn cubic_hermite( t: f32, x: (f32, Self), a: (f32, Self), b: (f32, Self), y: (f32, Self), ) -> Self
fn quadratic_bezier(t: f32, a: Self, u: Self, b: Self) -> Self
fn cubic_bezier(t: f32, a: Self, u: Self, v: Self, b: Self) -> Self
fn cubic_bezier_mirrored(t: f32, a: Self, u: Self, v: Self, b: Self) -> Self
Source§impl Interpolate<f64> for f64
Available on crate features std or num-traits only.
impl Interpolate<f64> for f64
std or num-traits only.