pub trait Interpolate<T>: Sized + Copy {
    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

Values that can be interpolated. Implementing this trait is required to perform sampling on splines.

T is the interpolator used to sample with. Typical implementations use [f32] or [f64], but you’re free to use the ones you like.

Required methods

Step interpolation.

Linear interpolation.

Cosine interpolation.

Cubic hermite interpolation.

Quadratic Bézier interpolation.

a is the first point; b is the second point and u is the tangent of a to the curve.

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.

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).

Implementations on Foreign Types

Implementors