## 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 Feb 8, 2024

#404 in Math

Apache-2.0

150KB
3K SLoC

# `bsplines` Rust Library

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

### `lib.rs`:

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

## Features

• Create `N`-dimensional (`N = 1, 2, 3,...`) curves of arbitrary polynomial degree `p`.
• Efficient curve evaluation for all available derivatives `k = 0, 1,... , p`.
• Built with nalgebra to store point data in contiguous arrays
• Multiple methods for

## 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.

## Literature:

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.

~4.5MB
~95K SLoC