[][src]Struct yoyo_physics::Sampler

pub struct Sampler<'a, C: ?Sized, T> where
    C: Curve,
    T: Threshold
{ /* fields omitted */ }

Sampling iterator over curves that generates approximations at a fixed sample rate.

Implementations

impl<'a, C: ?Sized, T> Sampler<'a, C, T> where
    C: Curve,
    T: Threshold<Value = C::Value>, 
[src]

pub fn with_threshold(
    curve: &'a C,
    sample_rate: f32,
    threshold: T
) -> Sampler<'a, C, T>

Notable traits for Sampler<'a, C, T>

impl<'a, C: ?Sized, T> Iterator for Sampler<'a, C, T> where
    C: Curve,
    T: Threshold<Value = C::Value, Velocity = C::Velocity>, 
type Item = Approximation<C::Value, C::Velocity>;
[src]

This function creates a new sampler of the given curve with the given sample rate. The sample rate is the number of samples per second. This will use the default thresholds of 1e-3.

pub fn keyed(self) -> KeyedIter<'a, C, T>

Notable traits for KeyedIter<'a, C, T>

impl<'a, C: ?Sized, T> Iterator for KeyedIter<'a, C, T> where
    C: Curve,
    T: Threshold<Value = C::Value, Velocity = C::Velocity>, 
type Item = (f32, Approximation<C::Value, C::Velocity>);
[src]

Turns this sampler into a keyed iterator, which returns the timestamps along with the approximations.

impl<'a, C: ?Sized, T> Sampler<'a, C, And<VelocityThreshold<T>, DisplacementThreshold<T>>> where
    C: Curve<Value = T>,
    T: Float
[src]

pub fn new(
    curve: &'a C,
    sample_rate: f32
) -> Sampler<'a, C, And<VelocityThreshold<T>, DisplacementThreshold<T>>>

Notable traits for Sampler<'a, C, T>

impl<'a, C: ?Sized, T> Iterator for Sampler<'a, C, T> where
    C: Curve,
    T: Threshold<Value = C::Value, Velocity = C::Velocity>, 
type Item = Approximation<C::Value, C::Velocity>;
[src]

This function creates a new sampler of the given curve with the given sample rate. The sample rate is the number of samples per second. This will use the default thresholds of 1e-3.

pub fn with_thresholds(
    curve: &'a C,
    sample_rate: f32,
    rest_velocity_threshold: T,
    rest_displacement_threshold: T
) -> Sampler<'a, C, And<VelocityThreshold<T>, DisplacementThreshold<T>>>

Notable traits for Sampler<'a, C, T>

impl<'a, C: ?Sized, T> Iterator for Sampler<'a, C, T> where
    C: Curve,
    T: Threshold<Value = C::Value, Velocity = C::Velocity>, 
type Item = Approximation<C::Value, C::Velocity>;
[src]

This function creates a new sampler of the given curve with the given sample rate and thresholds. The sample rate is the number of samples per second. Both thresholds must be met in order for the sampler to rest. The velocity threshold applies to the absolute velocity at a given time. The displacement threshold applies to the absolute distance between the current value at a given time and the target value.

Trait Implementations

impl<'a, C: Clone + ?Sized, T: Clone> Clone for Sampler<'a, C, T> where
    C: Curve,
    T: Threshold
[src]

impl<'a, C: Copy + ?Sized, T: Copy> Copy for Sampler<'a, C, T> where
    C: Curve,
    T: Threshold
[src]

impl<'a, C: ?Sized, T> Iterator for Sampler<'a, C, T> where
    C: Curve,
    T: Threshold<Value = C::Value, Velocity = C::Velocity>, 
[src]

type Item = Approximation<C::Value, C::Velocity>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, C: ?Sized, T> RefUnwindSafe for Sampler<'a, C, T> where
    C: RefUnwindSafe,
    T: RefUnwindSafe

impl<'a, C: ?Sized, T> Send for Sampler<'a, C, T> where
    C: Sync,
    T: Send

impl<'a, C: ?Sized, T> Sync for Sampler<'a, C, T> where
    C: Sync,
    T: Sync

impl<'a, C: ?Sized, T> Unpin for Sampler<'a, C, T> where
    T: Unpin

impl<'a, C: ?Sized, T> UnwindSafe for Sampler<'a, C, T> where
    C: RefUnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.