multiplyQuaternionsFlat static method

dynamic multiplyQuaternionsFlat(
  1. dynamic dst,
  2. num dstOffset,
  3. dynamic src0,
  4. num srcOffset0,
  5. dynamic src1,
  6. num srcOffset1,
)

Implementation

static multiplyQuaternionsFlat(dst, num dstOffset, src0, num srcOffset0, src1, num srcOffset1) {
  var x0 = src0[srcOffset0];
  var y0 = src0[srcOffset0 + 1];
  var z0 = src0[srcOffset0 + 2];
  var w0 = src0[srcOffset0 + 3];

  var x1 = src1[srcOffset1];
  var y1 = src1[srcOffset1 + 1];
  var z1 = src1[srcOffset1 + 2];
  var w1 = src1[srcOffset1 + 3];

  dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;
  dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;
  dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;
  dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;

  return dst;
}