Trait angular_units::Interpolate
[−]
[src]
pub trait Interpolate: Angle { 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>; }
A trait for linear interpolation between angles.
Required Methods
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.
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.
Implementors
impl<T: Float> Interpolate for Deg<T>
impl<T: Float> Interpolate for Rad<T>
impl<T: Float> Interpolate for Turns<T>
impl<T: Float> Interpolate for ArcMinutes<T>
impl<T: Float> Interpolate for ArcSeconds<T>