multiplyQuaternionsFlat static method

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

Implementation

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

  final x1 = src1[srcOffset1];
  final y1 = src1[srcOffset1 + 1];
  final z1 = src1[srcOffset1 + 2];
  final 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;
}