Crate generic_spline

Crate generic_spline 

Source
Expand description

Library of generic implementation of spline interpolation and extrapolation. It does not assume that spline is used in graphics context.

§Example

use generic_spline::{Knot, Spline};
use assert_approx_eq::assert_approx_eq;
 
let knots = vec![
    Knot::fix1(0.0, 3.0, -3.0),
    Knot::c2(1.0, 1.0),
    Knot::fix1(2.0, 4.0, -2.0)
];
let spline = Spline::new(knots).unwrap();
 
assert_approx_eq!(2.344, spline.interpolate(0.2).unwrap(), 1e-6);
assert_approx_eq!(3.0, spline.interpolate(1.5).unwrap(), 1e-6);

Structs§

Knot
Knot represents point throught which spline function passes with additional data regarding required continuity and derivatives values.
Spline
Spline function that passes through knots (Knot) with continuity and dervatives constraints. Each knot can have different constraints on continuity and derivatives values, thus each spline interval (segment) can be a polynomial of different order.