#curve #b-spline #derivative #spline #nalgebra #graphics

no-std bsplines

N-dimensional B-spline curves and their derivatives built on top of nalgebra

9 releases

0.0.1-alpha.8 Feb 9, 2024
0.0.1-alpha.7 Feb 8, 2024

#404 in Math



bsplines Rust Library

Crates.io Docs.rs License

Rust library for vectorized, N-dimensional B-spline curves and their derivatives based on nalgebra.

🚧 This Library is Under Construction 🚧

  • Use iterators and simplify loops
  • Use thiserror
  • Refactor visibility and folder structure
  • Refactor method selection and settings structs
  • Add benchmarks and improve performance


bsplines is a library for vectorized, N-dimensional B-spline curves and their derivatives based on [nalgebra].


What are B-Splines?

B-splines are parametric functions composed of piecewise, polynomial basis functions of degree p > 0. These piecewise polynomials are joined so that the parametric function is p-1 times continuously differentiable. The overall functions are parametrized over finite domains with a so-called knot vector with the co-domain being an N-dimensional vector space, that is defined by control points. They can describe [curves][curve], but also surfaces. These characteristics lead to many desirable properties. The piecewise definition makes B-spline functions versatile allowing to interpolate or approximate complex-shaped and high-dimensional data, while maintaining a low polynomial degree. Because of the polynomial nature, all possible derivatives are accessible.

![A 2D B-Spline curve.][img-curve]

Still, evaluations or spatial manipulations can be executed fast because only local polynomial segments must be considered and the associated numerical procedures are stable. Lastly, polynomials represent a memory-efficient way of storing spatial information as few polynomial coefficients suffice to describe complex shapes.


Piegl1997 Piegl, L., Tiller, W. The NURBS Book. Monographs in Visual Communication. Springer, Berlin, Heidelberg, 2nd ed., 1997.
Eilers1996 Eilers, P. H. C., Marx, B. D., Flexible smoothing with B -splines and penalties, Stat. Sci., 11(2) (1996) 89–121.
Tai2003 Tai, C.-L., Hu, S.-M., Huang, Q.-X., Approximate merging of B-spline curves via knot adjustment and constrained optimization, Comput. Des., 35(10) (2003) 893–899.


~95K SLoC