pub trait Curve<T> {
// Required methods
fn domain(&self) -> Interval;
fn sample_unchecked(&self, t: f32) -> T;
// Provided methods
fn sample(&self, t: f32) -> Option<T> { ... }
fn sample_clamped(&self, t: f32) -> T { ... }
}
curve
only.Expand description
A trait for a type that can represent values of type T
parametrized over a fixed interval.
Typical examples of this are actual geometric curves where T: VectorSpace
, but other kinds
of output data can be represented as well. See the module-level documentation for details.
Required Methods§
Sourcefn domain(&self) -> Interval
fn domain(&self) -> Interval
The interval over which this curve is parametrized.
This is the range of values of t
where we can sample the curve and receive valid output.
Sourcefn sample_unchecked(&self, t: f32) -> T
fn sample_unchecked(&self, t: f32) -> T
Sample a point on this curve at the parameter value t
, extracting the associated value.
This is the unchecked version of sampling, which should only be used if the sample time t
is already known to lie within the curve’s domain.
Values sampled from outside of a curve’s domain are generally considered invalid; data which is nonsensical or otherwise useless may be returned in such a circumstance, and extrapolation beyond a curve’s domain should not be relied upon.
Provided Methods§
Sourcefn sample(&self, t: f32) -> Option<T>
fn sample(&self, t: f32) -> Option<T>
Sample a point on this curve at the parameter value t
, returning None
if the point is
outside of the curve’s domain.
Sourcefn sample_clamped(&self, t: f32) -> T
fn sample_clamped(&self, t: f32) -> T
Sample a point on this curve at the parameter value t
, clamping t
to lie inside the
domain of the curve.
Implementors§
impl Curve<f32> for EaseFunction
impl<P: VectorSpace> Curve<P> for CubicCurve<P>
alloc
only.impl<P: VectorSpace> Curve<P> for CubicSegment<P>
impl<P: VectorSpace> Curve<P> for RationalCurve<P>
alloc
only.impl<P: VectorSpace> Curve<P> for RationalSegment<P>
impl<S, T, C, D> Curve<(S, T)> for ZipCurve<S, T, C, D>
impl<S, T, C, F> Curve<T> for MapCurve<S, T, C, F>
impl<T> Curve<T> for ConstantCurve<T>where
T: Clone,
impl<T> Curve<T> for EasingCurve<T>
impl<T> Curve<T> for SampleAutoCurve<T>where
T: StableInterpolate,
alloc
only.impl<T> Curve<T> for UnevenSampleAutoCurve<T>where
T: StableInterpolate,
alloc
only.impl<T, C> Curve<(f32, T)> for GraphCurve<T, C>where
C: Curve<T>,
impl<T, C> Curve<WithDerivative<T>> for SampleDerivativeWrapper<C>where
T: HasTangent,
C: SampleDerivative<T>,
impl<T, C> Curve<WithTwoDerivatives<T>> for SampleTwoDerivativesWrapper<C>where
T: HasTangent,
C: SampleTwoDerivatives<T>,
impl<T, C> Curve<T> for ForeverCurve<T, C>where
C: Curve<T>,
impl<T, C> Curve<T> for LinearReparamCurve<T, C>where
C: Curve<T>,
impl<T, C> Curve<T> for PingPongCurve<T, C>where
C: Curve<T>,
impl<T, C> Curve<T> for RepeatCurve<T, C>where
C: Curve<T>,
impl<T, C> Curve<T> for ReverseCurve<T, C>where
C: Curve<T>,
impl<T, C, D> Curve<T> for ChainCurve<T, C, D>
impl<T, C, D> Curve<T> for ContinuationCurve<T, C, D>
impl<T, C, D> Curve<T> for CurveReparamCurve<T, C, D>
impl<T, C, D> Curve<T> for D
impl<T, C, F> Curve<T> for ReparamCurve<T, C, F>
impl<T, F> Curve<T> for FunctionCurve<T, F>
impl<T, I> Curve<T> for SampleCurve<T, I>
alloc
only.impl<T, I> Curve<T> for UnevenSampleCurve<T, I>
alloc
only.