Home

Library goog.vec.Matrix4

Function Summary
add(?goog.vec.ArrayType mat0, ?goog.vec.ArrayType mat1, ?goog.vec.ArrayType resultMat) ⇒ ?goog.vec.ArrayType

Performs a per-component addition of the matrix mat0 and mat1, storing the result into resultMat.

applyRotate(?goog.vec.ArrayType mat, number angle, number x, number y, number z)

Applies a rotation by angle about the x,y,z axis to the given matrix.

applyScale(?goog.vec.ArrayType mat, number x, number y, number z)

Applies an x,y,z scale to the given matrix.

applyTranslate(?goog.vec.ArrayType mat, number x, number y, number z)

Applies a translation by x,y,z to the given matrix.

create() ⇒ ?goog.vec.Matrix4.Type

Creates the array representation of a 4x4 matrix. The use of the array directly eliminates any overhead associated with the class representation defined above. The returned matrix is cleared to all zeros.

createFromArray(?goog.vec.ArrayType matrix) ⇒ ?goog.vec.Matrix4.Type

Creates a 4x4 matrix initialized from the given array.

createFromValues(number v00, number v10, number v20, number v30, number v01, number v11, number v21, number v31, number v02, number v12, number v22, number v32, number v03, number v13, number v23, number v33) ⇒ ?goog.vec.Matrix4.Type

Creates a 4x4 matrix initialized from the given values.

createIdentity() ⇒ ?goog.vec.Matrix4.Type

Creates the array representation of a 4x4 matrix. The use of the array directly eliminates any overhead associated with the class representation defined above. The returned matrix is initialized with the identity

determinant(?goog.vec.ArrayType mat) ⇒ number

Computes the determinant of the matrix.

equals(?goog.vec.ArrayType mat0, ?goog.vec.ArrayType mat1) ⇒ boolean

Returns true if the components of mat0 are equal to the components of mat1.

fromEulerZXZ(?goog.vec.ArrayType matrix, number theta1, number theta2, number theta3)

Constructs a rotation matrix from its Euler angles using the ZXZ convention. Given the euler angles [theta1, theta2, theta3], the rotation is defined as rotation = rotation_z(theta1) * rotation_x(theta2) * rotation_z(theta3), where rotation_x(theta) means rotation around the X axis of theta radians.

getColumn(?goog.vec.ArrayType mat, number column, ?goog.vec.ArrayType vec)

Retrieves the specified column from the matrix into the given vector array.

getColumns(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec0, ?goog.vec.ArrayType vec1, ?goog.vec.ArrayType vec2, ?goog.vec.ArrayType vec3)

Retrieves the column values from the given matrix into the given vector elements.

getElement(?goog.vec.ArrayType mat, number row, number column) ⇒ number

Retrieves the element at the requested row and column.

getRow(?goog.vec.ArrayType mat, number row, ?goog.vec.ArrayType vec)

Retrieves the row values into the given vector.

getRows(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec0, ?goog.vec.ArrayType vec1, ?goog.vec.ArrayType vec2, ?goog.vec.ArrayType vec3)

Retrieves the rows of the matrix into the supplied vectors.

invert(?goog.vec.ArrayType mat, ?goog.vec.ArrayType resultMat) ⇒ boolean

Computes the inverse of mat storing the result into resultMat. If the inverse is defined, this function returns true, false otherwise.

lookAt(?goog.vec.ArrayType viewMatrix, ?goog.vec.ArrayType eyePt, ?goog.vec.ArrayType centerPt, ?goog.vec.ArrayType worldUpVec)

Updates a matrix representing the modelview matrix of a camera so that the camera is 'looking at' the given center point.

makeAxisAngleRotate(?goog.vec.ArrayType mat, number angle, number ax, number ay, number az)

Initializes the given 4x4 matrix as a rotation matrix with the given rotation angle about the axis defined by the vector (ax, ay, az).

makeFrustum(?goog.vec.ArrayType mat, number left, number right, number bottom, number top, number near, number far)

Initializes the given 4x4 matrix as a perspective projection matrix.

makeOrtho(?goog.vec.ArrayType mat, number left, number right, number bottom, number top, number near, number far)

Initializes the given 4x4 matrix as an orthographic projection matrix.

makePerspective(?goog.vec.ArrayType mat, number fovy, number aspect, number near, number far)

Initializes the given 4x4 matrix as a perspective projection matrix given a field of view and aspect ratio.

makeScale(?goog.vec.ArrayType mat, number x, number y, number z)

Initializes the given 4x4 matrix as a scale matrix with x, y and z scale factors.

makeTranslate(?goog.vec.ArrayType mat, number x, number y, number z)

Initializes the given 4x4 matrix as a translation matrix with x, y and z translation factors.

multMat(?goog.vec.ArrayType mat0, ?goog.vec.ArrayType mat1, ?goog.vec.ArrayType resultMat) ⇒ ?goog.vec.ArrayType

Multiplies the two matrices mat0 and mat1 using matrix multiplication, storing the result into resultMat.

multVec3(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec, ?goog.vec.ArrayType resultVec) ⇒ ?goog.vec.ArrayType

Transforms the given vector with the given matrix storing the resulting, transformed vector into resultVec. The input vector is multiplied against the upper 3x4 matrix omitting the projective component.

multVec3NoTranslate(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec, ?goog.vec.ArrayType resultVec) ⇒ ?goog.vec.ArrayType

Transforms the given vector with the given matrix storing the resulting, transformed vector into resultVec. The input vector is multiplied against the upper 3x3 matrix omitting the projective component and translation components.

multVec3Projective(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec, ?goog.vec.ArrayType resultVec) ⇒ ?goog.vec.ArrayType

Transforms the given vector with the given matrix storing the resulting, transformed vector into resultVec. The input vector is multiplied against the full 4x4 matrix with the homogeneous divide applied to reduce the 4 element vector to a 3 element vector.

multVec3ToArray(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec, ?goog.vec.ArrayType resultVec) ⇒ ?goog.vec.ArrayType

Transforms the given vector with the given matrix storing the resulting, transformed vector into resultVec. The input matrix is multiplied against the upper 3x4 matrix omitting the projective component.

multVec4(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec, ?goog.vec.ArrayType resultVec) ⇒ ?goog.vec.ArrayType

Transforms the given vector with the given matrix storing the resulting, transformed vector into resultVec.

multVec4ToArray(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec, ?goog.vec.ArrayType resultVec) ⇒ ?goog.vec.ArrayType

Transforms the given vector with the given matrix storing the resulting, transformed vector into resultVec.

scale(?goog.vec.ArrayType mat0, number scalar, ?goog.vec.ArrayType resultMat) ⇒ ?goog.vec.ArrayType

Performs a component-wise multiplication of mat0 with the given scalar storing the result into resultMat.

setColumn(?goog.vec.ArrayType mat, number column, ?goog.vec.ArrayType vec)

Sets the specified column with the value from the supplied array.

setColumnValues(?goog.vec.ArrayType mat, number column, number v0, number v1, number v2, number v3)

Sets the specified column with the supplied values.

setColumns(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec0, ?goog.vec.ArrayType vec1, ?goog.vec.ArrayType vec2, ?goog.vec.ArrayType vec3)

Sets the columns of the matrix from the set of vector elements.

setDiagonal(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec)

Sets the diagonal values of the matrix from the given vector.

setDiagonalValues(?goog.vec.ArrayType mat, number v00, number v11, number v22, number v33)

Sets the diagonal values of the matrix from the given values.

setElement(?goog.vec.ArrayType mat, number row, number column, number value)

Sets the element at the requested row and column.

setFromArray(?goog.vec.ArrayType mat, ?goog.vec.ArrayType values)

Sets the matrix from the array of values stored in column major order.

setFromRowMajorArray(?goog.vec.ArrayType mat, ?goog.vec.ArrayType values)

Sets the matrix from the array of values stored in row major order.

setFromValues(?goog.vec.ArrayType mat, number v00, number v10, number v20, number v30, number v01, number v11, number v21, number v31, number v02, number v12, number v22, number v32, number v03, number v13, number v23, number v33)

Initializes the matrix from the set of values. Note the values supplied are in column major order.

setIdentity(?goog.vec.ArrayType mat)

Sets the given matrix to the identity matrix.

setRow(?goog.vec.ArrayType mat, number row, ?goog.vec.ArrayType vec)

Sets the row values from the supplied vector.

setRowValues(?goog.vec.ArrayType mat, number row, number v0, number v1, number v2, number v3)

Sets the row values from the supplied values.

setRows(?goog.vec.ArrayType mat, ?goog.vec.ArrayType vec0, ?goog.vec.ArrayType vec1, ?goog.vec.ArrayType vec2, ?goog.vec.ArrayType vec3)

Sets the rows of the matrix from the supplied vectors.

setZero(?goog.vec.ArrayType mat)

Clears the given matrix to zero.

subtract(?goog.vec.ArrayType mat0, ?goog.vec.ArrayType mat1, ?goog.vec.ArrayType resultMat) ⇒ ?goog.vec.ArrayType

Performs a per-component subtraction of the matrix mat0 and mat1, storing the result into resultMat.

toEulerZXZ(?goog.vec.ArrayType matrix, ?goog.vec.ArrayType euler)

Decomposes a rotation matrix into Euler angles using the ZXZ convention.

toLookAt(?goog.vec.ArrayType viewMatrix, ?goog.vec.ArrayType eyePt, ?goog.vec.ArrayType fwdVec, ?goog.vec.ArrayType worldUpVec) ⇒ boolean

Decomposes a matrix into the lookAt vectors eyePt, fwdVec and worldUpVec. The matrix represents the modelview matrix of a camera. It is the inverse of lookAt except for the output of the fwdVec instead of centerPt. The centerPt itself cannot be recovered from a modelview matrix.

transpose(?goog.vec.ArrayType mat, ?goog.vec.ArrayType resultMat) ⇒ ?goog.vec.ArrayType

Transposes the given matrix mat storing the result into resultMat.