Skip to main content

cubic_basis

Function cubic_basis 

Source
pub fn cubic_basis<'a>(
    x: VR1D<'a>,
    y: VR1D<'a>,
    tension: f64,
) -> Result<PiecewiseHermite<'a>, ErrorsJSL>
Expand description

Builds a cardinal cubic interpolant through (x, y).

Interior slopes are (1 - tension) (y[i+1]-y[i-1]) / (x[i+1]-x[i-1]); end slopes use the one-sided secant. tension is normally in [0, 1] (1 gives zero slopes, a smoothed staircase). x must be strictly increasing with at least two points.