goog.vec.mat4f
Functions
addMat( mat0, mat1, resultMat ) → Float32Array
Float32Array
Performs a per-component addition of the matrix mat0 and mat1, storing the result into resultMat.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
create() → Float32Array
Float32Array
Creates a mat4f with all elements initialized to zero.
Parameters | None. | ||
---|---|---|---|
Returns |
|
createIdentity() → Float32Array
Float32Array
determinant( mat ) → number
number
Computes the determinant of the matrix.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
equals( mat0, mat1 ) → boolean
boolean
Returns true if the components of mat0 are equal to the components of mat1.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
getColumn( mat, column, vec ) → Float32Array
Float32Array
Retrieves the specified column from the matrix into the given vector.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
getColumns( mat, vec0, vec1, vec2, vec3 ) → void
void
Retrieves the column values from the given matrix into the given vectors.
Parameters |
|
---|
getDiagonal( mat, vec, opt_diagonal ) → Float32Array
Float32Array
Gets the diagonal values of the matrix into the given vector.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
getElement( mat, row, column ) → number
number
getRow( mat, row, vec ) → Float32Array
Float32Array
Retrieves the row values into the given vector.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
getRows( mat, vec0, vec1, vec2, vec3 ) → void
void
Retrieves the rows of the matrix into the supplied vectors.
Parameters |
|
---|
getTranslation( mat, translation ) → Float32Array
Float32Array
Retrieves the translation component of the transformation matrix.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
invert( mat, resultMat ) → boolean
boolean
Computes the inverse of mat storing the result into resultMat. If the inverse is defined, this function returns true, false otherwise.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeEulerZXZ( mat, theta1, theta2, theta3 ) → Float32Array
Float32Array
Makes the given 4x4 matrix a rotation matrix given 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), with theta1 in [0, 2 * pi], theta2 in [0, pi] and theta3 in [0, 2 * pi]. rotation_x(theta) means rotation around the X axis of theta radians,
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeFrustum( mat, left, right, bottom, top, near, far ) → Float32Array
Float32Array
Makes the given 4x4 matrix a perspective projection matrix.
Parameters |
| ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeIdentity( mat ) → Float32Array
Float32Array
Makes the given 4x4 matrix the identity matrix.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
makeLookAt( mat, eyePt, centerPt, worldUpVec ) → Float32Array
Float32Array
Makes the given 4x4 matrix a modelview matrix of a camera so that the camera is 'looking at' the given center point.
Note that unlike most other goog.vec functions where we inline everything, this function does not inline various goog.vec functions. This makes the code more readable, but somewhat less efficient.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeOrtho( mat, left, right, bottom, top, near, far ) → Float32Array
Float32Array
Makes the given 4x4 matrix an orthographic projection matrix.
Parameters |
| ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makePerspective( mat, fovy, aspect, near, far ) → Float32Array
Float32Array
Makes the given 4x4 matrix perspective projection matrix given a field of view and aspect ratio.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeRotate( mat, angle, ax, ay, az ) → Float32Array
Float32Array
Makes the given 4x4 matrix a rotation matrix with the given rotation angle about the axis defined by the vector (ax, ay, az).
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeRotateX( mat, angle ) → Float32Array
Float32Array
Makes the given 4x4 matrix a rotation matrix with the given rotation angle about the X axis.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeRotateY( mat, angle ) → Float32Array
Float32Array
Makes the given 4x4 matrix a rotation matrix with the given rotation angle about the Y axis.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeRotateZ( mat, angle ) → Float32Array
Float32Array
Makes the given 4x4 matrix a rotation matrix with the given rotation angle about the Z axis.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeRotationTranslation( mat, rotation, translation ) → Float32Array
Float32Array
Creates a matrix from a quaternion rotation and vector translation.
This is a specialization of makeRotationTranslationScaleOrigin.
This is equivalent to, but faster than: goog.vec.mat4f.makeIdentity(m); goog.vec.mat4f.translate(m, tx, ty, tz); goog.vec.mat4f.rotate(m, theta, rx, ry, rz); and: goog.vec.Quaternion.toRotationMatrix4(rotation, mat); mat[12] = translation[0]; mat[13] = translation[1]; mat[14] = translation[2]; See http://jsperf.com/goog-vec-makerotationtranslation2 .
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeRotationTranslationScale( mat, rotation, translation, scale ) → Float32Array
Float32Array
Creates a matrix from a quaternion rotation, vector translation, and vector scale.
This is a specialization of makeRotationTranslationScaleOrigin.
This is equivalent to, but faster than: goog.vec.mat4f.makeIdentity(m); goog.vec.mat4f.translate(m, tx, ty, tz); goog.vec.mat4f.rotate(m, theta, rx, ry, rz); goog.vec.mat4f.scale(m, sx, sy, sz);
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeRotationTranslationScaleOrigin( mat, rotation, translation, scale, origin ) → Float32Array
Float32Array
Creates a matrix from a quaternion rotation, vector translation, and vector scale, rotating and scaling about the given origin.
This is equivalent to, but faster than: goog.vec.mat4f.makeIdentity(m); goog.vec.mat4f.translate(m, tx, ty, tz); goog.vec.mat4f.translate(m, ox, oy, oz); goog.vec.mat4f.rotate(m, theta, rx, ry, rz); goog.vec.mat4f.scale(m, sx, sy, sz); goog.vec.mat4f.translate(m, -ox, -oy, -oz); See http://jsperf.com/glmatrix-matrix-variant-test/3 for performance results of a similar function in the glmatrix library.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeScale( mat, x, y, z ) → Float32Array
Float32Array
makeTranslate( mat, x, y, z ) → Float32Array
Float32Array
Makes the given 4x4 matrix a translation matrix with x, y and z translation factors.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
makeZero( mat ) → Float32Array
Float32Array
Makes the given 4x4 matrix the zero matrix.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
multMat( mat0, mat1, resultMat ) → Float32Array
Float32Array
Multiplies the two matrices mat0 and mat1 using matrix multiplication, storing the result into resultMat.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
multScalar( mat, scalar, resultMat ) → Float32Array
Float32Array
Multiplies matrix mat with the given scalar, storing the result into resultMat.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
multVec3( mat, vec, resultVec ) → Float32Array
Float32Array
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.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
multVec3NoTranslate( mat, vec, resultVec ) → Float32Array
Float32Array
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.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
multVec3Projective( mat, vec, resultVec ) → Float32Array
Float32Array
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.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
multVec4( mat, vec, resultVec ) → Float32Array
Float32Array
Transforms the given vector with the given matrix storing the resulting, transformed vector into resultVec.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
rotate( mat, angle, x, y, z ) → Float32Array
Float32Array
Rotate the given matrix by angle about the x,y,z axis. Equivalent to: goog.vec.mat4f.multMat( mat, goog.vec.mat4f.makeRotate(goog.vec.mat4f.create(), angle, x, y, z), mat);
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
rotateX( mat, angle ) → Float32Array
Float32Array
Rotate the given matrix by angle about the x axis. Equivalent to: goog.vec.mat4f.multMat( mat, goog.vec.mat4f.makeRotateX(goog.vec.mat4f.create(), angle), mat);
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
rotateY( mat, angle ) → Float32Array
Float32Array
Rotate the given matrix by angle about the y axis. Equivalent to: goog.vec.mat4f.multMat( mat, goog.vec.mat4f.makeRotateY(goog.vec.mat4f.create(), angle), mat);
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
rotateZ( mat, angle ) → Float32Array
Float32Array
Rotate the given matrix by angle about the z axis. Equivalent to: goog.vec.mat4f.multMat( mat, goog.vec.mat4f.makeRotateZ(goog.vec.mat4f.create(), angle), mat);
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
scale( mat, x, y, z ) → Float32Array
Float32Array
Scales the given matrix by x,y,z. Equivalent to: goog.vec.mat4f.multMat( mat, goog.vec.mat4f.makeScale(goog.vec.mat4f.create(), x, y, z), mat);
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setColumn( mat, column, vec ) → Float32Array
Float32Array
Sets the specified column with the value from the supplied vector.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setColumnValues( mat, column, v0, v1, v2, v3 ) → Float32Array
Float32Array
Sets the specified column with the supplied values.
Parameters |
| ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setColumns( mat, vec0, vec1, vec2, vec3 ) → Float32Array
Float32Array
Sets the columns of the matrix from the given vectors.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setDiagonal( mat, vec ) → Float32Array
Float32Array
Sets the diagonal values of the matrix from the given vector.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
setDiagonalValues( mat, v00, v11, v22, v33 ) → Float32Array
Float32Array
Sets the diagonal values of the matrix from the given values.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setElement( mat, row, column, value ) → Float32Array
Float32Array
Sets the element at the requested row and column.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setFromArray( mat, src ) → Float32Array
Float32Array
setFromMat4d( mat, src ) → Float32Array
Float32Array
Initializes mat4f mat from mat4d src (typed as a Float64Array to avoid circular goog.requires).
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
setFromMat4f( mat, src ) → Float32Array
Float32Array
Initializes mat4f mat from mat4f src.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
setFromValues( mat, v00, v10, v20, v30, v01, v11, v21, v31, v02, v12, v22, v32, v03, v13, v23, v33 ) → Float32Array
Float32Array
Initializes the matrix from the set of values. Note the values supplied are in column major order.
Parameters |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setRow( mat, row, vec ) → Float32Array
Float32Array
Sets the row values from the supplied vector.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setRowValues( mat, row, v0, v1, v2, v3 ) → Float32Array
Float32Array
Sets the row values from the supplied values.
Parameters |
| ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
setRows( mat, vec0, vec1, vec2, vec3 ) → Float32Array
Float32Array
Sets the rows of the matrix from the supplied vectors.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
subMat( mat0, mat1, resultMat ) → Float32Array
Float32Array
Performs a per-component subtraction of the matrix mat0 and mat1, storing the result into resultMat.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
toEulerZXZ( mat, euler, opt_theta2IsNegative ) → Float32Array
Float32Array
Decomposes a rotation matrix into Euler angles using the ZXZ convention so that rotation = rotation_z(theta1) * rotation_x(theta2) * rotation_z(theta3), with theta1 in [0, 2 * pi], theta2 in [0, pi] and theta3 in [0, 2 * pi]. rotation_x(theta) means rotation around the X axis of theta radians.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
toLookAt( mat, eyePt, fwdVec, worldUpVec ) → boolean
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.
Note that unlike most other goog.vec functions where we inline everything, this function does not inline various goog.vec functions. This makes the code more readable, but somewhat less efficient.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
translate( mat, x, y, z ) → Float32Array
Float32Array
Translates the given matrix by x,y,z. Equvialent to: goog.vec.mat4f.multMat( mat, goog.vec.mat4f.makeTranslate(goog.vec.mat4f.create(), x, y, z), mat);
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
transpose( mat, resultMat ) → Float32Array
Float32Array
Transposes the given matrix mat storing the result into resultMat.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Properties
Type → Float32Array
Float32Array
No information.