Trait nbez::BezCurve [] [src]

pub trait BezCurve<F: Float>: AsRef<[Self::Point]> + AsMut<[Self::Point]> where Self: Sized {
    type Point: Point<F>;
    type Elevated: BezCurve<F, Point=Self::Point>;
    fn from_slice(&[Self::Point]) -> Option<Self>;
    fn interp_unbounded(&self, t: F) -> Self::Point;
    fn slope_unbounded(&self, t: F) -> Self::Point::Vector;
    fn elevate(&self) -> Self::Elevated;
    fn split_unbounded(&self, t: F) -> (Self, Self);
    fn order(&self) -> usize;

    fn interp(&self, t: F) -> Option<Self::Point> { ... }
    fn slope(&self, t: F) -> Option<Self::Point::Vector> { ... }
    fn split(&self, t: F) -> Option<(Self, Self)> { ... }
    fn interp_iter<'a>(&'a self, samples: u32) -> InterpIter<'a, F, Self> { ... }
}

Bezier curve trait

Associated Types

type Point: Point<F>

type Elevated: BezCurve<F, Point=Self::Point>

Required Methods

fn from_slice(&[Self::Point]) -> Option<Self>

Attempt to create a curve from a slice. Fails if the slice's length does not match the curve's order + 1.

fn interp_unbounded(&self, t: F) -> Self::Point

Perform interpolation on the curve with no range bounds

fn slope_unbounded(&self, t: F) -> Self::Point::Vector

Get the slope for the given t with no range bounds

fn elevate(&self) -> Self::Elevated

Elevate the curve order, getting a curve that is one order higher but gives the same results upon interpolation

fn split_unbounded(&self, t: F) -> (Self, Self)

Split the curve with no range bounds

fn order(&self) -> usize

Gets the order of the curve

Provided Methods

fn interp(&self, t: F) -> Option<Self::Point>

Perform interpolation on the curve for the given t, bounded on 0.0 to 1.0 inclusive. Returns None if t is not within bounds.

fn slope(&self, t: F) -> Option<Self::Point::Vector>

Get the slope for the given t, bounded on 0.0 to 1.0 inclusive. Returns None if t is not within bounds.

fn split(&self, t: F) -> Option<(Self, Self)>

Split the curve at the given t, bounded on 0.0 to 1.0 inclusive. Returns None if t is not within bounds.

fn interp_iter<'a>(&'a self, samples: u32) -> InterpIter<'a, F, Self>

Get an iterator over the interpolated values of this curve, splitting the curve into the given number of samples.

Implementors