bsfun
Basis Spline Fun(ctions)
This is a super simple Rust library for working with basis splines and NURBS (Non-Uniform Rational B-Splines) with zero dependecies (besides alloc::Vec
).
These five basic functions are used in NURBSCurve
and NURBSSurface
evaluation:
bspline_basis()
Calculate the value of a basis spline at a givent
. This is the basic building block for all splines and the rational basis functions.rational_bspline_basis_curve()
Calculate the value of a rational basis spline for curves at a givent
rational_bspline_basis_surface()
Calculate the value of a rational basis spline for surfaces at a given value pair(u, v)
nurbs_curve_point()
Calculate the value of a NURBS curve at a given valuet
nurbs_surface_point()
Calculate the value of a NURBS surface at a given value pair(u, v)
You could use 1
, 2
and 3
to build your own Splines. 4
and 5
are just functions for calculating the value of a NURBS curve or surface for a set of parameters directly.
Caution:
4
and5
are mostly for playing around and will not validate parameters for you. You have to make sure that the parameters are in the correct range and of correct shape yourself. If you don't want that use the structsNURBSCurve
andNURBSSurface
and theireval()
methods
Since this library does not have enhanced functionality beyond curve evaluations, you may want to use a more practical NURBS implementation from e.g. the library truck
.
Visualization of B-Spline Basis Functions
Degree: k
Number of control points: n + 1
Number of knots: n + 1 + k (must be non-decreasing in value)
Recursion formula for B-Spline basis functions:
made with plotters