Trait Interpolate

Source
pub trait Interpolate: Angle {
    // Required methods
    fn interpolate<U>(&self, right: &U, pos: Self::Scalar) -> Self
       where U: Clone + IntoAngle<Self, OutputScalar = Self::Scalar>;
    fn interpolate_forward<U>(&self, right: &U, pos: Self::Scalar) -> Self
       where U: Clone + IntoAngle<Self, OutputScalar = Self::Scalar>;
}
Expand description

A trait for linear interpolation between angles.

Required Methods§

Source

fn interpolate<U>(&self, right: &U, pos: Self::Scalar) -> Self
where U: Clone + IntoAngle<Self, OutputScalar = Self::Scalar>,

Perform a linear interpolation between two angles.

This method will always follow the shortest past between the two angles. This means it will go backward if the angles are more than a half turn apart. To force the interpolation to go forward, use interpolate_forward. The output is not normalized, and may exceed a full turn if it interpolates backward, even if both inputs are normalized. The angles may be represented in different units.

Source

fn interpolate_forward<U>(&self, right: &U, pos: Self::Scalar) -> Self
where U: Clone + IntoAngle<Self, OutputScalar = Self::Scalar>,

Perform a linear interpolation between two angles, going forward from self to right.

Unlike interpolate this will always go forward from self to right, even if going backward would take a shorter path. The output is not normalized, but should remain normalized if both self and right are. The angles may be represented in different units.

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.

Implementors§