hermite function

List<double> hermite(
  1. dynamic out,
  2. dynamic a,
  3. dynamic b,
  4. dynamic c,
  5. dynamic d,
  6. dynamic t,
)

Performs a hermite interpolation with two control points

@param {vec3} out the receiving vector @param {ReadonlyVec3} a the first operand @param {ReadonlyVec3} b the second operand @param {ReadonlyVec3} c the third operand @param {ReadonlyVec3} d the fourth operand @param {Number} t interpolation amount, in the range 0-1, between the two inputs @returns {vec3} out

Implementation

List<double> hermite(out, a, b, c, d, t) {
  final factorTimes2 = t * t;
  final factor1 = factorTimes2 * (2 * t - 3) + 1;
  final factor2 = factorTimes2 * (t - 2) + t;
  final factor3 = factorTimes2 * (t - 1);
  final factor4 = factorTimes2 * (3 - 2 * t);

  out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
  out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
  out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;

  return out;
}