src/m4.js
function rotateY(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 m20 = m[2 * 4 + 0];
  const m21 = m[2 * 4 + 1];
  const m22 = m[2 * 4 + 2];
  const m23 = m[2 * 4 + 3];
  const c = Math.cos(angleInRadians);
  const s = Math.sin(angleInRadians);

  dst[ 0] = c * m00 - s * m20;
  dst[ 1] = c * m01 - s * m21;
  dst[ 2] = c * m02 - s * m22;
  dst[ 3] = c * m03 - s * m23;
  dst[ 8] = c * m20 + s * m00;
  dst[ 9] = c * m21 + s * m01;
  dst[10] = c * m22 + s * m02;
  dst[11] = c * m23 + s * m03;

  if (m !== dst) {
    dst[ 4] = m[ 4];
    dst[ 5] = m[ 5];
    dst[ 6] = m[ 6];
    dst[ 7] = m[ 7];
    dst[12] = m[12];
    dst[13] = m[13];
    dst[14] = m[14];
    dst[15] = m[15];
  }

  return dst;
}
function rotateY(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 m20 = m[2 * 4 + 0];
  const m21 = m[2 * 4 + 1];
  const m22 = m[2 * 4 + 2];
  const m23 = m[2 * 4 + 3];
  const c = Math.cos(angleInRadians);
  const s = Math.sin(angleInRadians);

  dst[ 0] = c * m00 - s * m20;
  dst[ 1] = c * m01 - s * m21;
  dst[ 2] = c * m02 - s * m22;
  dst[ 3] = c * m03 - s * m23;
  dst[ 8] = c * m20 + s * m00;
  dst[ 9] = c * m21 + s * m01;
  dst[10] = c * m22 + s * m02;
  dst[11] = c * m23 + s * m03;

  if (m !== dst) {
    dst[ 4] = m[ 4];
    dst[ 5] = m[ 5];
    dst[ 6] = m[ 6];
    dst[ 7] = m[ 7];
    dst[12] = m[12];
    dst[13] = m[13];
    dst[14] = m[14];
    dst[15] = m[15];
  }

  return dst;
}
function rotateY ( 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 m20 = m [ 2 * 4 + 0 ] ; const m21 = m [ 2 * 4 + 1 ] ; const m22 = m [ 2 * 4 + 2 ] ; const m23 = m [ 2 * 4 + 3 ] ; const c = Math . cos ( angleInRadians ) ; const s = Math . sin ( angleInRadians ) ; dst [ 0 ] = c * m00 - s * m20 ; dst [ 1 ] = c * m01 - s * m21 ; dst [ 2 ] = c * m02 - s * m22 ; dst [ 3 ] = c * m03 - s * m23 ; dst [ 8 ] = c * m20 + s * m00 ; dst [ 9 ] = c * m21 + s * m01 ; dst [ 10 ] = c * m22 + s * m02 ; dst [ 11 ] = c * m23 + s * m03 ; if ( m !== dst ) { dst [ 4 ] = m [ 4 ] ; dst [ 5 ] = m [ 5 ] ; dst [ 6 ] = m [ 6 ] ; dst [ 7 ] = m [ 7 ] ; 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 y-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 y - axis by the given angle .