multiplyQuaternions method

Quat multiplyQuaternions(
  1. Quat a,
  2. Quat b
)

Multiply a by b

Implementation

Quat multiplyQuaternions(Quat a, Quat b ) {
  double qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;
  double qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;

  x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
  y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
  z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
  w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
  return this;
}