Library
Module
Module type
Parameter
Class
Class type
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.
Calculated coefficients along with the X ranges that they apply to. Abstracted to protect array access
val len : t -> int
len t
Length of the X range and coefficient arrays stored in t
.
val xmins : t -> float list
xmins t
Minimum X values to which the coefficients at the same indices within t
apply.
val xmaxs : t -> float list
xmaxs t
Maximum X values to which the coefficients at the same indices within t
apply.
val get_xmin : t -> int -> float option
val get_xmax : t -> int -> float option
val get_xmin_exn : t -> int -> float
val get_xmax_exn : t -> int -> float
fit ?boundary ps
Calculate cubic spline coefficients with the boundary
condition (defaults to `Natural
) for the 2-dimensional control points ps
.
val extrapolate : t -> float -> float option
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.
val coef_to_string : coef -> string
coef_to_string c
Show contents of c
as a string.