The goog.vec.Matrix3 Namespace

.Type

@typedef
{goog.vec.ArrayType}

.add(mat0, mat1, resultMat)

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

mat0 {goog.vec.ArrayType}
The first addend.
mat1 {goog.vec.ArrayType}
The second addend.
resultMat {goog.vec.ArrayType}
The matrix to receive the results (may be either mat0 or mat1).
returns {goog.vec.ArrayType}
return resultMat so that operations can be chained together.

.clone

Creates a clone of a 3x3 matrix.

matrix {goog.vec.Matrix3.Type}
The source 3x3 matrix.
returns {goog.vec.Matrix3.Type}
The new 3x3 element matrix.

.create()

Creates the array representation of a 3x3 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.

returns {goog.vec.Matrix3.Type}
The new, nine element array.

.createFromArray(matrix)

Creates a 3x3 matrix initialized from the given array.

matrix {goog.vec.ArrayType}
The array containing the matrix values in column major order.
returns {goog.vec.Matrix3.Type}
The new, nine element array.

.createFromValues(v00, v10, v20, v01, v11, v21, v02, v12, v22)

Creates a 3x3 matrix initialized from the given values.

v00 {number}
The values at (0, 0).
v10 {number}
The values at (1, 0).
v20 {number}
The values at (2, 0).
v01 {number}
The values at (0, 1).
v11 {number}
The values at (1, 1).
v21 {number}
The values at (2, 1).
v02 {number}
The values at (0, 2).
v12 {number}
The values at (1, 2).
v22 {number}
The values at (2, 2).
returns {goog.vec.Matrix3.Type}
The new, nine element array.

.createIdentity()

Creates the array representation of a 3x3 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.

returns {goog.vec.Matrix3.Type}
The new, nine element array.

.equals(mat0, mat1)

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

mat0 {goog.vec.ArrayType}
The first matrix.
mat1 {goog.vec.ArrayType}
The second matrix.
returns {boolean}
True if the the two matrices are equivalent.

.getColumn(mat, column, vec)

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

mat {goog.vec.ArrayType}
The matrix supplying the values.
column {number}
The column to get the values from.
vec {goog.vec.ArrayType}
The vector elements to receive the column.

.getColumns(mat, vec0, vec1, vec2)

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

mat {goog.vec.ArrayType}
The matrix containing the columns to retrieve.
vec0 {goog.vec.ArrayType}
The vector elements to receive column 0.
vec1 {goog.vec.ArrayType}
The vector elements to receive column 1.
vec2 {goog.vec.ArrayType}
The vector elements to receive column 2.

.getElement(mat, row, column)

Retrieves the element at the requested row and column.

mat {goog.vec.ArrayType}
The matrix containing the value to retrieve.
row {number}
The row index.
column {number}
The column index.
returns {number}
The element value at the requested row, column indices.

.getRow(mat, row, vec)

Retrieves the row values into the given vector.

mat {goog.vec.ArrayType}
The matrix supplying the values.
row {number}
The index of the row supplying the values.
vec {goog.vec.ArrayType}
The vector to receive the row.

.getRows(mat, vec0, vec1, vec2)

Retrieves the rows of the matrix into the supplied vectors.

mat {goog.vec.ArrayType}
The matrix to supplying the values.
vec0 {goog.vec.ArrayType}
The vector to receive row 0.
vec1 {goog.vec.ArrayType}
The vector to receive row 1.
vec2 {goog.vec.ArrayType}
The vector to receive row 2.

.invert(mat0, resultMat)

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

mat0 {goog.vec.ArrayType}
The matrix to invert.
resultMat {goog.vec.ArrayType}
The matrix to receive the result (may be mat0).
returns {boolean}
True if the inverse is defined. If false is returned, resultMat is not modified.

.makeAxisAngleRotate(mat, angle, ax, ay, az)

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

mat {goog.vec.ArrayType}
The 3x3 (9-element) matrix array to receive the new scale matrix.
angle {number}
The rotation angle in radians.
ax {number}
The x component of the rotation axis.
ay {number}
The y component of the rotation axis.
az {number}
The z component of the rotation axis.

.makeScale(mat, x, y, z)

Initializes the given 3x3 matrix as a scale matrix with x, y and z scale factors.

mat {goog.vec.ArrayType}
The 3x3 (9-element) matrix array to receive the new scale matrix.
x {number}
The scale along the x axis.
y {number}
The scale along the y axis.
z {number}
The scale along the z axis.

.makeTranslate(mat, x, y)

Initializes the given 3x3 matrix as a translation matrix with x and y translation values.

mat {goog.vec.ArrayType}
The 3x3 (9-element) matrix array to receive the new translation matrix.
x {number}
The translation along the x axis.
y {number}
The translation along the y axis.

.multMat(mat0, mat1, resultMat)

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

mat0 {goog.vec.ArrayType}
The first (left hand) matrix.
mat1 {goog.vec.ArrayType}
The second (right hand) matrix.
resultMat {goog.vec.ArrayType}
The matrix to receive the results (may be either mat0 or mat1).
returns {goog.vec.ArrayType}
return resultMat so that operations can be chained together.

.multVec3(mat, vec, resultVec)

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

mat {goog.vec.ArrayType}
The matrix supplying the transformation.
vec {goog.vec.ArrayType}
The vector to transform.
resultVec {goog.vec.ArrayType}
The vector to receive the results (may be vec).
returns {goog.vec.ArrayType}
return resultVec so that operations can be chained together.

.scale(mat0, scalar, resultMat)

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

mat0 {goog.vec.ArrayType}
The matrix to scale.
scalar {number}
The scalar value to multiple to each element of mat0.
resultMat {goog.vec.ArrayType}
The matrix to receive the results (may be mat0).
returns {goog.vec.ArrayType}
return resultMat so that operations can be chained together.

.setColumn(mat, column, vec)

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

mat {goog.vec.ArrayType}
The matrix to receive the values.
column {number}
The column index to set the values on.
vec {goog.vec.ArrayType}
The vector elements for the column.

.setColumnValues(mat, column, v0, v1, v2)

Sets the specified column with the supplied values.

mat {goog.vec.ArrayType}
The matrix to recieve the values.
column {number}
The column index to set the values on.
v0 {number}
The value for row 0.
v1 {number}
The value for row 1.
v2 {number}
The value for row 2.

.setColumns(mat, vec0, vec1, vec2)

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

mat {goog.vec.ArrayType}
The matrix to receive the values.
vec0 {goog.vec.ArrayType}
The values for column 0.
vec1 {goog.vec.ArrayType}
The values for column 1.
vec2 {goog.vec.ArrayType}
The values for column 2.

.setDiagonal(mat, vec)

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

mat {goog.vec.ArrayType}
The matrix to receive the values.
vec {goog.vec.ArrayType}
The vector containing the values.

.setDiagonalValues(mat, v00, v11, v22)

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

mat {goog.vec.ArrayType}
The matrix to receive the values.
v00 {number}
The values for (0, 0).
v11 {number}
The values for (1, 1).
v22 {number}
The values for (2, 2).

.setElement(mat, row, column, value)

Sets the element at the requested row and column.

mat {goog.vec.ArrayType}
The matrix containing the value to retrieve.
row {number}
The row index.
column {number}
The column index.
value {number}
The value to set at the requested row, column.

.setFromArray(mat, values)

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

mat {goog.vec.ArrayType}
The matrix to receive the values.
values {goog.vec.ArrayType}
The column major ordered array of values to store in the matrix.

.setFromRowMajorArray(mat, values)

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

mat {goog.vec.ArrayType}
The matrix to receive the values.
values {goog.vec.ArrayType}
The row major ordered array of values to store in the matrix.

.setFromValues(mat, v00, v10, v20, v01, v11, v21, v02, v12, v22)

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

mat {goog.vec.ArrayType}
The matrix to receive the values.
v00 {number}
The values at (0, 0).
v10 {number}
The values at (1, 0).
v20 {number}
The values at (2, 0).
v01 {number}
The values at (0, 1).
v11 {number}
The values at (1, 1).
v21 {number}
The values at (2, 1).
v02 {number}
The values at (0, 2).
v12 {number}
The values at (1, 2).
v22 {number}
The values at (2, 2).

.setIdentity(mat)

Sets the given matrix to the identity matrix.

mat {goog.vec.ArrayType}
The matrix to set.

.setRow(mat, row, vec)

Sets the row values from the supplied vector.

mat {goog.vec.ArrayType}
The matrix to receive the row values.
row {number}
The index of the row.
vec {goog.vec.ArrayType}
The vector containing the values.

.setRowValues(mat, row, v0, v1, v2)

Sets the row values from the supplied values.

mat {goog.vec.ArrayType}
The matrix to receive the values.
row {number}
The index of the row to receive the values.
v0 {number}
The value for column 0.
v1 {number}
The value for column 1.
v2 {number}
The value for column 2.

.setRows(mat, vec0, vec1, vec2)

Sets the rows of the matrix from the supplied vectors.

mat {goog.vec.ArrayType}
The matrix to receive the values.
vec0 {goog.vec.ArrayType}
The values for row 0.
vec1 {goog.vec.ArrayType}
The values for row 1.
vec2 {goog.vec.ArrayType}
The values for row 2.

.setZero(mat)

Clears the given matrix to zero.

mat {goog.vec.ArrayType}
The matrix to clear.

.subtract(mat0, mat1, resultMat)

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

mat0 {goog.vec.ArrayType}
The minuend.
mat1 {goog.vec.ArrayType}
The subtrahend.
resultMat {goog.vec.ArrayType}
The matrix to receive the results (may be either mat0 or mat1).
returns {goog.vec.ArrayType}
return resultMat so that operations can be chained together.

.transpose(mat, resultMat)

Transposes the given matrix mat storing the result into resultMat.

mat {goog.vec.ArrayType}
The matrix to transpose.
resultMat {goog.vec.ArrayType}
The matrix to receive the results (may be mat).
returns {goog.vec.ArrayType}
return resultMat so that operations can be chained together.