Struct bspline::BSpline
[−]
[src]
pub struct BSpline<T: Interpolate + Copy> { // some fields omitted }
Represents a B-spline 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]
fn new(degree: usize, control_points: Vec<T>, knots: Vec<f32>) -> BSpline<T>
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 this is in terms of the interpolating polynomial degree,
if you are 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 many control points as the degree (control_points.len() >= degree) and the number of knots should be equal to control_points.len() + degree + 1.
fn point(&self, t: f32) -> T
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.
fn control_points(&self) -> Iter<T>
Get an iterator over the control points.
fn knots(&self) -> Iter<f32>
Get an iterator over the knots.
fn knot_domain(&self) -> (f32, f32)
Get the min and max knot domain values for finding the t range to compute
the curve over. The curve is only defined over this (inclusive) range, passing
a t value out of this range will assert on debug builds and likely result in
a crash on release builds.