BezierInterpolant

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

A Bezier interpolant using cubic Bezier curves with 2D control points.

This interpolant supports the COLLADA/Maya style of Bezier animation where each keyframe has explicit in/out tangent control points specified as 2D coordinates (time, value).

The tangent data must be provided via the settings object:

  • settings.inTangents: packed [time, value] pairs per keyframe per component.

  • settings.outTangents: packed [time, value] pairs per keyframe per component.

For a track with N keyframes and stride S:

  • Each tangent array has N * S * 2 values.

  • Layout: [k0_c0_time, k0_c0_value, k0_c1_time, k0_c1_value, ..., k0_cS_time, k0_cS_value, k1_c0_time, k1_c0_value, ...].

When no tangent data is present, this falls back to linear interpolation.

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).

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.