Skip to main content

Splines

Simple

const spline = new CubicSpline.MultiPoint<number>({ compute: x => x })
.addPoint(0, 0)
.addPoint(1, 1)

const value = spline.compute(0.4)
Simple [0, 0] -> [1, 1]

Nested

const spline = new CubicSpline.MultiPoint({ compute: x => x })
.addPoint(0, 0)
.addPoint(0.4, new CubicSpline.MultiPoint({ compute: x => 2 * x - x * x })
.addPoint(0.2, -1)
.addPoint(1, 1))

const value = spline.compute(0.4)
Nested with different mapper