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

  const m00 = m[0 * 4 + 0];
  const m01 = m[0 * 4 + 1];
  const m02 = m[0 * 4 + 2];
  const m03 = m[0 * 4 + 3];
  const m10 = m[1 * 4 + 0];
  const m11 = m[1 * 4 + 1];
  const m12 = m[1 * 4 + 2];
  const m13 = m[1 * 4 + 3];
  const c = Math.cos(angleInRadians);
  const s = Math.sin(angleInRadians);

  dst[ 0] = c * m00 + s * m10;
  dst[ 1] = c * m01 + s * m11;
  dst[ 2] = c * m02 + s * m12;
  dst[ 3] = c * m03 + s * m13;
  dst[ 4] = c * m10 - s * m00;
  dst[ 5] = c * m11 - s * m01;
  dst[ 6] = c * m12 - s * m02;
  dst[ 7] = c * m13 - s * m03;

  if (m !== dst) {
    dst[ 8] = m[ 8];
    dst[ 9] = m[ 9];
    dst[10] = m[10];
    dst[11] = m[11];
    dst[12] = m[12];
    dst[13] = m[13];
    dst[14] = m[14];
    dst[15] = m[15];
  }

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

  const m00 = m[0 * 4 + 0];
  const m01 = m[0 * 4 + 1];
  const m02 = m[0 * 4 + 2];
  const m03 = m[0 * 4 + 3];
  const m10 = m[1 * 4 + 0];
  const m11 = m[1 * 4 + 1];
  const m12 = m[1 * 4 + 2];
  const m13 = m[1 * 4 + 3];
  const c = Math.cos(angleInRadians);
  const s = Math.sin(angleInRadians);

  dst[ 0] = c * m00 + s * m10;
  dst[ 1] = c * m01 + s * m11;
  dst[ 2] = c * m02 + s * m12;
  dst[ 3] = c * m03 + s * m13;
  dst[ 4] = c * m10 - s * m00;
  dst[ 5] = c * m11 - s * m01;
  dst[ 6] = c * m12 - s * m02;
  dst[ 7] = c * m13 - s * m03;

  if (m !== dst) {
    dst[ 8] = m[ 8];
    dst[ 9] = m[ 9];
    dst[10] = m[10];
    dst[11] = m[11];
    dst[12] = m[12];
    dst[13] = m[13];
    dst[14] = m[14];
    dst[15] = m[15];
  }

  return dst;
}
function rotateZ ( m , angleInRadians , dst ) { dst = dst || new MatType ( 16 ) ; const m00 = m [ 0 * 4 + 0 ] ; const m01 = m [ 0 * 4 + 1 ] ; const m02 = m [ 0 * 4 + 2 ] ; const m03 = m [ 0 * 4 + 3 ] ; const m10 = m [ 1 * 4 + 0 ] ; const m11 = m [ 1 * 4 + 1 ] ; const m12 = m [ 1 * 4 + 2 ] ; const m13 = m [ 1 * 4 + 3 ] ; const c = Math . cos ( angleInRadians ) ; const s = Math . sin ( angleInRadians ) ; dst [ 0 ] = c * m00 + s * m10 ; dst [ 1 ] = c * m01 + s * m11 ; dst [ 2 ] = c * m02 + s * m12 ; dst [ 3 ] = c * m03 + s * m13 ; dst [ 4 ] = c * m10 - s * m00 ; dst [ 5 ] = c * m11 - s * m01 ; dst [ 6 ] = c * m12 - s * m02 ; dst [ 7 ] = c * m13 - s * m03 ; if ( m !== dst ) { dst [ 8 ] = m [ 8 ] ; dst [ 9 ] = m [ 9 ] ; dst [ 10 ] = m [ 10 ] ; dst [ 11 ] = m [ 11 ] ; 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 z-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 z - axis by the given angle .