Interpolant

abstract class Interpolant(val parameterPositions: DoubleArray, val sampleValues: DoubleArray, sampleSize: Int, val resultBuffer: DoubleArray = DoubleArray(sampleSize))

Abstract base class of interpolants over parametric samples.

The parameter domain is one dimensional, typically the time or a path along a curve defined by the data. The sample values can have any dimensionality and derived classes may apply special interpretations to the data.

This class provides the interval seek in a Template Method, deferring the actual interpolation to derived classes via interpolate_.

Time complexity is O(1) for linear access crossing at most two points and O(log N) for random access, where N is the number of positions.

Instances are mutable and not thread-safe; confine an instance (and the buffers it wraps) to a single thread, exactly as in three.js. The resultBuffer is reused across calls and its contents are overwritten by each evaluate.

See the Template Method pattern.

Parameters

parameterPositions

The parameter positions holding the interpolation factors.

sampleValues

The sample values.

sampleSize

The sample size (a.k.a. the value size / stride).

resultBuffer

The result buffer; defaults to a fresh DoubleArray(sampleSize).

Inheritors

Constructors

Link copied to clipboard
constructor(parameterPositions: DoubleArray, sampleValues: DoubleArray, sampleSize: Int, resultBuffer: DoubleArray = DoubleArray(sampleSize))

Properties

Link copied to clipboard

The default settings object. Overridden by CubicInterpolant.

Link copied to clipboard

The parameter positions.

Link copied to clipboard

The result buffer. Reused across calls; overwritten by every evaluate.

Link copied to clipboard

The sample values.

Link copied to clipboard

The interpolation settings. null until assigned; getSettings_ then falls back to DefaultSettings_.

Link copied to clipboard

The value size (stride).

Functions

Link copied to clipboard
open fun copySampleValue_(index: Int): DoubleArray

Copies a sample value to the result buffer.

Link copied to clipboard

Evaluates the interpolant at position t.

Link copied to clipboard

Returns the interpolation settings.