lerp function

List<double> lerp(
  1. List<double> out,
  2. List<double> a,
  3. List<double> b,
  4. double t,
)

Performs a linear interpolation between two vec4's

@param {vec4} out the receiving vector @param {ReadonlyVec4} a the first operand @param {ReadonlyVec4} b the second operand @param {Number} t interpolation amount, in the range 0-1, between the two inputs @returns {vec4} out

Implementation

List<double> lerp(List<double> out, List<double> a, List<double> b, double t) {
  final ax = a[0];
  final ay = a[1];
  final az = a[2];
  final aw = a[3];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  out[2] = az + t * (b[2] - az);
  out[3] = aw + t * (b[3] - aw);
  return out;
}