Trait Curve

Source
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 { ... }
}
Available on crate feature 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§

Source

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.

Source

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§

Source

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.

Source

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§

Source§

impl Curve<f32> for EaseFunction

Source§

impl<P: VectorSpace> Curve<P> for CubicCurve<P>

Available on crate feature alloc only.
Source§

impl<P: VectorSpace> Curve<P> for CubicSegment<P>

Source§

impl<P: VectorSpace> Curve<P> for RationalCurve<P>

Available on crate feature alloc only.
Source§

impl<P: VectorSpace> Curve<P> for RationalSegment<P>

Source§

impl<S, T, C, D> Curve<(S, T)> for ZipCurve<S, T, C, D>
where C: Curve<S>, D: Curve<T>,

Source§

impl<S, T, C, F> Curve<T> for MapCurve<S, T, C, F>
where C: Curve<S>, F: Fn(S) -> T,

Source§

impl<T> Curve<T> for ConstantCurve<T>
where T: Clone,

Source§

impl<T> Curve<T> for EasingCurve<T>
where T: Ease + Clone,

Source§

impl<T> Curve<T> for SampleAutoCurve<T>

Available on crate feature alloc only.
Source§

impl<T> Curve<T> for UnevenSampleAutoCurve<T>

Available on crate feature alloc only.
Source§

impl<T, C> Curve<(f32, T)> for GraphCurve<T, C>
where C: Curve<T>,

Source§

impl<T, C> Curve<WithDerivative<T>> for SampleDerivativeWrapper<C>
where T: HasTangent, C: SampleDerivative<T>,

Source§

impl<T, C> Curve<WithTwoDerivatives<T>> for SampleTwoDerivativesWrapper<C>

Source§

impl<T, C> Curve<T> for ForeverCurve<T, C>
where C: Curve<T>,

Source§

impl<T, C> Curve<T> for LinearReparamCurve<T, C>
where C: Curve<T>,

Source§

impl<T, C> Curve<T> for PingPongCurve<T, C>
where C: Curve<T>,

Source§

impl<T, C> Curve<T> for RepeatCurve<T, C>
where C: Curve<T>,

Source§

impl<T, C> Curve<T> for ReverseCurve<T, C>
where C: Curve<T>,

Source§

impl<T, C, D> Curve<T> for ChainCurve<T, C, D>
where C: Curve<T>, D: Curve<T>,

Source§

impl<T, C, D> Curve<T> for ContinuationCurve<T, C, D>
where T: VectorSpace, C: Curve<T>, D: Curve<T>,

Source§

impl<T, C, D> Curve<T> for CurveReparamCurve<T, C, D>
where C: Curve<T>, D: Curve<f32>,

Source§

impl<T, C, D> Curve<T> for D
where C: Curve<T> + ?Sized, D: Deref<Target = C>,

Source§

impl<T, C, F> Curve<T> for ReparamCurve<T, C, F>
where C: Curve<T>, F: Fn(f32) -> f32,

Source§

impl<T, F> Curve<T> for FunctionCurve<T, F>
where F: Fn(f32) -> T,

Source§

impl<T, I> Curve<T> for SampleCurve<T, I>
where T: Clone, I: Fn(&T, &T, f32) -> T,

Available on crate feature alloc only.
Source§

impl<T, I> Curve<T> for UnevenSampleCurve<T, I>
where T: Clone, I: Fn(&T, &T, f32) -> T,

Available on crate feature alloc only.