[go: up one dir, main page]

Module bspline

Module bspline 

Source
Expand description

Basis spline curves.

BSpline support all flavours or B-Splines, such as uniform (equidistant) and non-uniform B-Splines as well as the most generalized version: NURBS (Non-Uniform Rational B-SPlines). The easist way to create a bspline is by using the builder pattern of BSplineBuilder.

let bspline = BSpline::builder()
                .clamped()
                .elements([0.0,5.0,3.0,10.0,7.0])
                .equidistant::<f64>()
                .degree(3)
                .normalized()
                .constant::<4>()
                .build()?;
let results = [0.0,2.346,3.648,4.302,4.704,5.25,6.2,7.27,8.04,8.09,7.0];
for (value,result) in bspline.take(results.len()).zip(results.iter().copied()){
    assert_f64_near!(value, result);
}

BSplines can be seen as many bezier curves put together. They have most properties of bezier curves but changing an element in a bspline only affects a local area of the curve, not the whole curve, like it is in bezier curves. BSplines allow you to define curves with a lot of control points without increasing the degree of the curve.

Structs§

BSpline
BSpline curve.
BSplineBuilder
Builder for bspline interpolation.
BSplineDirector
Builder for bspline interpolation.
BorderBuffer
Chain Adaptor which repeats its first and last element n more times.
BorderDeletion
Chain Adaptor which deletes the first and last element.
IncongruousElementsDegree
Error returned when the number of elements and the degree are ill-matched.
IncongruousElementsKnots
Error returned when the number of elements and knots are ill-matched.
InvalidDegree
Error returned if the number of elements and the number of knots are not matching.
NotSorted
Error returned if the given knots are not sorted.
TooFewElements
Error returned if the elements are to few for the specific interpolation.
TooSmallWorkspace
Error returned when the workspace is too small.

Enums§

BSplineError
Errors which could occur when using or creating a linear interpolation.