B2G/gecko/browser/devtools/tilt/TiltMath.jsm
/**
   * Performs a quaternion multiplication.
   *
   * @param {Array} aQuat
   *                first operand
   * @param {Array} aQuat2
   *                second operand
   * @param {Array} aDest
   *                optional, quat4 receiving the operation result
   *                if not specified result is written to the first operand
   *
   * @return {Array} the destination quat if specified, first operand otherwise
   */
Performs a quaternion multiplication.
@param {Array} aQuat
first operand
@param {Array} aQuat2
second operand
@param {Array} aDest
optional, quat4 receiving the operation result
if not specified result is written to the first operand

@return {Array} the destination quat if specified, first operand otherwise
Performs a quaternion multiplication . @param { Array } aQuat first operand @param { Array } aQuat2 second operand @param { Array } aDest optional quat4 receiving the operation result if not specified result is written to the first operand @return { Array } the destination quat if specified first operand otherwise
function Q4_multiply(aQuat, aQuat2, aDest)
  {
    if (!aDest) {
      aDest = aQuat;
    }
    let qax = aQuat[0];
    let qay = aQuat[1];
    let qaz = aQuat[2];
    let qaw = aQuat[3];
    let qbx = aQuat2[0];
    let qby = aQuat2[1];
    let qbz = aQuat2[2];
    let qbw = aQuat2[3];
    aDest[0] = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
    aDest[1] = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
    aDest[2] = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
    aDest[3] = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
    return aDest;
  }
function Q4_multiply ( aQuat , aQuat2 , aDest ) { if ( ! aDest ) { aDest = aQuat ; } let qax = aQuat [ 0 ] ; let qay = aQuat [ 1 ] ; let qaz = aQuat [ 2 ] ; let qaw = aQuat [ 3 ] ; let qbx = aQuat2 [ 0 ] ; let qby = aQuat2 [ 1 ] ; let qbz = aQuat2 [ 2 ] ; let qbw = aQuat2 [ 3 ] ; aDest [ 0 ] = qax * qbw + qaw * qbx + qay * qbz - qaz * qby ; aDest [ 1 ] = qay * qbw + qaw * qby + qaz * qbx - qax * qbz ; aDest [ 2 ] = qaz * qbw + qaw * qbz + qax * qby - qay * qbx ; aDest [ 3 ] = qaw * qbw - qax * qbx - qay * qby - qaz * qbz ; return aDest ; }
Performs a quaternion multiplication.
Performs a quaternion multiplication .