Returns a monotonous cubic spline interpolation function for given pivot points, that prevent overshoot of interpolated values.
Notes: Don't mutate xs and ys arrays after creating this function since data from these arrays is read during interpolation.
The array of X coordinates of pivot points in ascending order.
The array of corresponding Y coordinates of pivot points.
The function that takes X coordinate and returns an interpolated Y coordinate.
const f = csplineMonot(xs, ys);const y = f(x); Copy
const f = csplineMonot(xs, ys);const y = f(x);
Monotone cubic interpolation
Returns a monotonous cubic spline interpolation function for given pivot points, that prevent overshoot of interpolated values.
Notes: Don't mutate xs and ys arrays after creating this function since data from these arrays is read during interpolation.