[][src]Struct bspline::BSpline

pub struct BSpline<T: Interpolate + Copy> { /* fields omitted */ }

Represents a B-spline curve that will use polynomials of the specified degree to interpolate between the control points given the knots.

Methods

impl<T: Interpolate + Copy> BSpline<T>[src]

pub fn new(degree: usize, control_points: Vec<T>, knots: Vec<f32>) -> BSpline<T>[src]

Create a new B-spline curve of the desired degree that will interpolate the control_points using the knots. The knots should be sorted in non-decreasing order otherwise they will be sorted for you, which may lead to undesired knots for control points. Note that here we use the interpolating polynomial degree, if you're familiar with the convention of "B-spline curve order" the degree is curve_order - 1.

Your curve must have a valid number of control points and knots or the function will panic. A B-spline curve requires at least as one more control point than the degree (control_points.len() > degree) and the number of knots should be equal to control_points.len() + degree + 1.

pub fn point(&self, t: f32) -> T[src]

Compute a point on the curve at t, the parameter must be in the inclusive range of values returned by knot_domain. If t is out of bounds this function will assert on debug builds and on release builds you'll likely get an out of bounds crash.

pub fn control_points(&self) -> Iter<T>[src]

Get an iterator over the control points.

pub fn knots(&self) -> Iter<f32>[src]

Get an iterator over the knots.

pub fn knot_domain(&self) -> (f32, f32)[src]

Get the min and max knot domain values for finding the t range to compute the curve over. The curve is only defined over the inclusive range [min, max], passing a t value outside of this range will result in an assert on debug builds and likely a crash on release builds.

Trait Implementations

impl<T: Clone + Interpolate + Copy> Clone for BSpline<T>[src]

impl<T: Debug + Interpolate + Copy> Debug for BSpline<T>[src]

Auto Trait Implementations

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

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

impl<T> Unpin for BSpline<T> where
    T: Unpin

impl<T> UnwindSafe for BSpline<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for BSpline<T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

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.

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

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

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