src/m4.js
function rotateX(m, angleInRadians, dst) {
  dst = dst || new MatType(16);

  const m10 = m[4];
  const m11 = m[5];
  const m12 = m[6];
  const m13 = m[7];
  const m20 = m[8];
  const m21 = m[9];
  const m22 = m[10];
  const m23 = m[11];
  const c = Math.cos(angleInRadians);
  const s = Math.sin(angleInRadians);

  dst[4]  = c * m10 + s * m20;
  dst[5]  = c * m11 + s * m21;
  dst[6]  = c * m12 + s * m22;
  dst[7]  = c * m13 + s * m23;
  dst[8]  = c * m20 - s * m10;
  dst[9]  = c * m21 - s * m11;
  dst[10] = c * m22 - s * m12;
  dst[11] = c * m23 - s * m13;

  if (m !== dst) {
    dst[ 0] = m[ 0];
    dst[ 1] = m[ 1];
    dst[ 2] = m[ 2];
    dst[ 3] = m[ 3];
    dst[12] = m[12];
    dst[13] = m[13];
    dst[14] = m[14];
    dst[15] = m[15];
  }

  return dst;
}
function rotateX(m, angleInRadians, dst) {
  dst = dst || new MatType(16);

  const m10 = m[4];
  const m11 = m[5];
  const m12 = m[6];
  const m13 = m[7];
  const m20 = m[8];
  const m21 = m[9];
  const m22 = m[10];
  const m23 = m[11];
  const c = Math.cos(angleInRadians);
  const s = Math.sin(angleInRadians);

  dst[4]  = c * m10 + s * m20;
  dst[5]  = c * m11 + s * m21;
  dst[6]  = c * m12 + s * m22;
  dst[7]  = c * m13 + s * m23;
  dst[8]  = c * m20 - s * m10;
  dst[9]  = c * m21 - s * m11;
  dst[10] = c * m22 - s * m12;
  dst[11] = c * m23 - s * m13;

  if (m !== dst) {
    dst[ 0] = m[ 0];
    dst[ 1] = m[ 1];
    dst[ 2] = m[ 2];
    dst[ 3] = m[ 3];
    dst[12] = m[12];
    dst[13] = m[13];
    dst[14] = m[14];
    dst[15] = m[15];
  }

  return dst;
}
function rotateX ( m , angleInRadians , dst ) { dst = dst || new MatType ( 16 ) ; const m10 = m [ 4 ] ; const m11 = m [ 5 ] ; const m12 = m [ 6 ] ; const m13 = m [ 7 ] ; const m20 = m [ 8 ] ; const m21 = m [ 9 ] ; const m22 = m [ 10 ] ; const m23 = m [ 11 ] ; const c = Math . cos ( angleInRadians ) ; const s = Math . sin ( angleInRadians ) ; dst [ 4 ] = c * m10 + s * m20 ; dst [ 5 ] = c * m11 + s * m21 ; dst [ 6 ] = c * m12 + s * m22 ; dst [ 7 ] = c * m13 + s * m23 ; dst [ 8 ] = c * m20 - s * m10 ; dst [ 9 ] = c * m21 - s * m11 ; dst [ 10 ] = c * m22 - s * m12 ; dst [ 11 ] = c * m23 - s * m13 ; if ( m !== dst ) { dst [ 0 ] = m [ 0 ] ; dst [ 1 ] = m [ 1 ] ; dst [ 2 ] = m [ 2 ] ; dst [ 3 ] = m [ 3 ] ; dst [ 12 ] = m [ 12 ] ; dst [ 13 ] = m [ 13 ] ; dst [ 14 ] = m [ 14 ] ; dst [ 15 ] = m [ 15 ] ; } return dst ; }
Modifies the given 4-by-4 matrix by a rotation around the x-axis by the given
angle.
@param {module:twgl/m4.Mat4} m The matrix.
@param {number} angleInRadians The angle by which to rotate (in radians).
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} m once modified.
@memberOf module:twgl/m4
Modifies the given 4 - by - 4 matrix by a rotation around the x - axis by the given angle .