B2G/gecko/browser/devtools/tilt/TiltMath.jsm
/**
   * Scales a matrix by the given vector.
   *
   * @param {Array} aMat
   *                mat4 to translate
   * @param {Array} aVec
   *                vec3 specifying the scale on each axis
   * @param {Array} aDest
   *                optional, mat4 receiving operation result
   *                if not specified result is written to the first operand
   *
   * @return {Array} the destination mat4 if specified, first operand otherwise
   */
Scales a matrix by the given vector.
@param {Array} aMat
mat4 to translate
@param {Array} aVec
vec3 specifying the scale on each axis
@param {Array} aDest
optional, mat4 receiving operation result
if not specified result is written to the first operand

@return {Array} the destination mat4 if specified, first operand otherwise
Scales a matrix by the given vector . @param { Array } aMat mat4 to translate @param { Array } aVec vec3 specifying the scale on each axis @param { Array } aDest optional mat4 receiving operation result if not specified result is written to the first operand @return { Array } the destination mat4 if specified first operand otherwise
function M4_scale(aMat, aVec, aDest)
  {
    let x = aVec[0];
    let y = aVec[1];
    let z = aVec[2];
    if (!aDest || aMat === aDest) {
      aMat[0] *= x;
      aMat[1] *= x;
      aMat[2] *= x;
      aMat[3] *= x;
      aMat[4] *= y;
      aMat[5] *= y;
      aMat[6] *= y;
      aMat[7] *= y;
      aMat[8] *= z;
      aMat[9] *= z;
      aMat[10] *= z;
      aMat[11] *= z;
      return aMat;
    }
    aDest[0] = aMat[0] * x;
    aDest[1] = aMat[1] * x;
    aDest[2] = aMat[2] * x;
    aDest[3] = aMat[3] * x;
    aDest[4] = aMat[4] * y;
    aDest[5] = aMat[5] * y;
    aDest[6] = aMat[6] * y;
    aDest[7] = aMat[7] * y;
    aDest[8] = aMat[8] * z;
    aDest[9] = aMat[9] * z;
    aDest[10] = aMat[10] * z;
    aDest[11] = aMat[11] * z;
    aDest[12] = aMat[12];
    aDest[13] = aMat[13];
    aDest[14] = aMat[14];
    aDest[15] = aMat[15];
    return aDest;
  }
function M4_scale ( aMat , aVec , aDest ) { let x = aVec [ 0 ] ; let y = aVec [ 1 ] ; let z = aVec [ 2 ] ; if ( ! aDest || aMat === aDest ) { aMat [ 0 ] *= x ; aMat [ 1 ] *= x ; aMat [ 2 ] *= x ; aMat [ 3 ] *= x ; aMat [ 4 ] *= y ; aMat [ 5 ] *= y ; aMat [ 6 ] *= y ; aMat [ 7 ] *= y ; aMat [ 8 ] *= z ; aMat [ 9 ] *= z ; aMat [ 10 ] *= z ; aMat [ 11 ] *= z ; return aMat ; } aDest [ 0 ] = aMat [ 0 ] * x ; aDest [ 1 ] = aMat [ 1 ] * x ; aDest [ 2 ] = aMat [ 2 ] * x ; aDest [ 3 ] = aMat [ 3 ] * x ; aDest [ 4 ] = aMat [ 4 ] * y ; aDest [ 5 ] = aMat [ 5 ] * y ; aDest [ 6 ] = aMat [ 6 ] * y ; aDest [ 7 ] = aMat [ 7 ] * y ; aDest [ 8 ] = aMat [ 8 ] * z ; aDest [ 9 ] = aMat [ 9 ] * z ; aDest [ 10 ] = aMat [ 10 ] * z ; aDest [ 11 ] = aMat [ 11 ] * z ; aDest [ 12 ] = aMat [ 12 ] ; aDest [ 13 ] = aMat [ 13 ] ; aDest [ 14 ] = aMat [ 14 ] ; aDest [ 15 ] = aMat [ 15 ] ; return aDest ; }
Scales a matrix by the given vector.
Scales a matrix by the given vector .