Fast and simple cubic spline interpolant.

It was derived from a Hermitian construction setting the first derivative at each sample position to the linear slope between neighboring positions over their parameter interval.

Examples

const interpolant = new CubicInterpolant(
new Float32Array( 2 ),
new Float32Array( 2 ),
1,
new Float32Array( 1 )
);

interpolant.evaluate( 0.5 );

Hierarchy

Constructors

  • new CubicInterpolant(parameterPositions: any, sampleValues: any, sampleSize: any, resultBuffer?: any): CubicInterpolant
  • Create a new instance.

    Parameters

    • parameterPositions: any

      array of positions

    • sampleValues: any

      array of samples

    • sampleSize: any

      number of samples

    • Optional resultBuffer: any

      buffer to store the interpolation results.

    Returns CubicInterpolant

Properties

DefaultSettings_: unknown
_cachedIndex: number
_offsetNext: number
_offsetPrev: number
_weightNext: number
_weightPrev: number
parameterPositions: any[]
resultBuffer?: any[]
sampleValues: any[]
settings: unknown
valueSize: number

Methods

  • copySampleValue_(index: number): any[]
  • evaluate(t: number): any[]
  • Evaluate the interpolant at position t.

    Returns

    An array

    Parameters

    • t: number

      time

    Returns any[]

  • getSettings_(): CubicInterpolantSettings
  • interpolate_(i1: any, t0: any, t: any, t1: any): any
  • intervalChanged_(i1: any, t0: any, t1: any): void