Uniform Cubic Spline Interpolation & Inversion
This crate supports the following types of splines:
- B-spline
- Bezier
- Catmull-Rom
- Hermite
- Linear
- Power
If you come from a background of shading languages used in offline rendering this crate should feel like home.
The code is a Rust port of the resp. implementation found in the Open Shading Language C++ source.
Example
Using a combination of spline()
and spline_inverse()
it is
possible to compute a full spline-with-nonuniform-abscissæ:
use ;
// We want to evaluate the spline at knot value 0.3.
let x = 0.3;
let values = ;
let knots = ;
let v = .unwrap;
let y = ;
assert!;