1.0.0 • Published 7 years ago

spline-interpolator v1.0.0

Weekly downloads
250
License
MIT
Repository
github
Last release
7 years ago

spline-interpolator

Library for smoothing spline interpolation.

Usage

// initialization

const SplineInterpolator = require('spline-interpolator')
const x = [1, 2, 3, 4, 5]
const y = [9, 3, 6, 2, 4]
const interpolator = new SplineInterpolator(x, y)

// interpolate single point
console.log(interpolator.interpolate(4.2))
// >> 1.7468571428571422

// print curve in the range [0.0, 6.0]
for (const [xi, yi] of interpolator.curve(100, [0.0, 6.0])) {
  console.log(xi, yi)
}
1.0.0

7 years ago

0.0.0

8 years ago