Struct splines::Spline[][src]

pub struct Spline<T>(_);

Spline curve used to provide interpolation between control points (keys).

Methods

impl<T> Spline<T>
[src]

Create a new spline out of keys. The keys don’t have to be sorted even though it’s recommended to provide ascending sorted ones (for performance purposes).

Create a new spline by consuming an Iterater<Item = Key<T>>. They keys don’t have to be sorted.

Note on iterators

It’s valid to use any iterator that implements Iterator<Item = Key<T>>. However, you should use Spline::from_vec if you are passing a Vec<_>. This will remove dynamic allocations.

Retrieve the keys of a spline.

Sample a spline at a given time.

The current implementation, based on immutability, cannot perform in constant time. This means that sampling’s processing complexity is currently O(log n). It’s possible to achieve O(1) performance by using a slightly different spline type. If you are interested by this feature, an implementation for a dedicated type is foreseen yet not started yet.

Return

None if you try to sample a value at a time that has no key associated with. That can also happen if you try to sample between two keys with a specific interpolation mode that make the sampling impossible. For instance, Interpolate::CatmullRom requires four keys. If you’re near the beginning of the spline or its end, ensure you have enough keys around to make the sampling.

Sample a spline at a given time with clamping.

Return

If you sample before the first key or after the last one, return the first key or the last one, respectively. Otherwise, behave the same way as Spline::sample.

Panic

This function panics if you have no key.

Trait Implementations

impl<T: Debug> Debug for Spline<T>
[src]

Formats the value using the given formatter. Read more

impl<T: Clone> Clone for Spline<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, T> IntoIterator for &'a Spline<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

impl<T> Send for Spline<T> where
    T: Send

impl<T> Sync for Spline<T> where
    T: Sync