package OCADml
Module OCADml.CubicSplineSource
Cubic spline interpolation of 2d paths.
This is a port of a javascript implementation underlying a spline visualization tool by Timo Denk.
Boundary condition for cubic spline fitting.
Cubic spline coefficients
Calculated coefficients along with the X ranges that they apply to. Abstracted to protect array access
Immutable access to fit results
xmins t
Minimum X values to which the coefficients at the same indices within t apply.
xmaxs t
Maximum X values to which the coefficients at the same indices within t apply.
coefs t
Coefficients describing a cubic spline, as calculated by fit.
Index getters
Fitting
fit ?boundary ps
Calculate cubic spline coefficients with the boundary condition (defaults to `Natural) for the 2-dimensional control points ps.
Extrapolation
extrapolate t x
Calculate the corresponding dependent value (e.g. Some y) for the given independent value x using the cubic spline fit coefficient in t. If x does not fall within the range of the control values used to generate t, None is returned.
extrapolate_path t xs
Use t to extrapolate xs into a 2-dimensional cubic spline path.
interpolate_path t n
Use t to interpolate 2-dimensional cubic spline path with n evently spaced points.