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 finds the interval that holds the position. Subclasses do the actual interpolation in 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. Use each instance, and the buffers it wraps, from one thread only. resultBuffer is reused, and each evaluate call overwrites it.

See the Template Method pattern.

Parameters

parameterPositions

The parameter positions holding the interpolation factors.

sampleValues

The sample values.

sampleSize

The number of values in one sample (the 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.