Matrices
This module provides the following matrix and matrix row classes:
- MatrixRow3: Used for the storage of matrix rows for matrices with 3 columns.
- MatrixRow4: Used for the storage of matrix rows for matrices with 4 columns.
- Matrix3x3: A matrix of 3 columns and 3 rows.
- Matrix4x3: A matrix of 4 columns and 3 rows.
- Matrix4x4: A matrix of 4 columns and 4 rows.
- RichMatrix3x3:
- RichMatrix4x3:
- RichMatrix4x4:
Single precision variants are also available. Simply prefix these class names with "Float" to use them
Module Data
kIdentity3x3 -> A Matrix3x3 containing an identity transformation.
kIdentity4x3 -> A Matrix4x3 containing an identity transformation.
kIdentity4x4 -> A Matrix4x4 containing an identity transformation.
kRichIdentity3x3 -> A RichMatrix3x3 containing an identity transformation.
kRichIdentity4x3 -> A RichMatrix4x3 containing an identity transformation.
kRichIdentity4x4 -> A RichMatrix4x4 containing an identity transformation.
The MatrixRow3 Class
Objects of this class represent the rows of 3 column matrices which are defined later in this document.
This class has the following constant data members:
MatrixRow3.kNumColumns -> constant integer value of 3
MatrixRow3.kElementSize -> constant integer value of 4
This class has the following construction methods:
MatrixRow3 ()
row -> MatrixRow3
Constructs a new 3 column matrix row with uninitialized values. Returns the new matrix row.
MatrixRow3 (row)
Constructs a new 3 column matrix row by copying the given 3 column matrix row.
Returns the new matrix row.
MatrixRow3 (c1, c2, c3)
c1 -> double
c2 -> double
c3 -> double
Constructs a new 3 column matrix row with the given values.
Returns the new matrix row.
MatrixRow3 (t)
t -> table of three double values, either numerically indexed or indexed by the keys 'col1', 'col2' and 'col3'
Constructs a new 3 column matrix row with the values from the given table. Returns the new matrix row.
Every instance of this class has the following member values, accessible both by numeric indices and the following keys:
1 | "col1" -> the first column value
2 | "col2" -> the second column value
3 | "col3" -> the third column value
Every instance of this class has the following member methods:
MatrixRow3:Clone ()
Returns a newly allocated copy of this object.
MatrixRow3:GetIndexedElement (index)
index -> integer (from 1 to MatrixRow3.kNumColumns)
Returns the indexed column. This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
MatrixRow3:SetIndexedElement (index, value)
index -> integer (from 1 to MatrixRow3.kNumColumns)
value -> double
Set the indexed column. This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
The original matrix row is modified in place.
Returns the newly modified matrix row.
MatrixRow3:IsEqual (row)
row -> MatrixRow3
Returns true if this matrix row is exactly equal to the given matrix row.
MatrixRow3:IsNearEqual (row)
row -> MatrixRow3
Returns true if this matrix row is nearly equal to the given matrix row, using a tolerance based on the precision of the matrix row elements.
MatrixRow3:IsNearEqual (row, tolerance)
row -> MatrixRow3
tolerance -> double
Returns true if this matrix row is nearly equal to the given matrix row, using the given tolerance.
The MatrixRow4 Class
Objects of this class represent the rows of 4 column matrices which are defined later in this document.
This class has the following constant data members:
MatrixRow4.kNumColumns -> constant integer value of 4
MatrixRow4.kElementSize -> constant integer value of 4
This class has the following construction methods:
MatrixRow4 ()
Constructs a new 4 column matrix row with uninitialized values.
Returns the new matrix row.
MatrixRow4 (row)
row -> MatrixRow4
Constructs a new 4 column matrix row by copying the given 4 column matrix row.
Returns the new matrix row.
MatrixRow4 (c1, c2, c3, c4)
c1 -> double
c2 -> double
c3 -> double
c4 -> double
Constructs a new 4 column matrix row with the given values.
Returns the new matrix row.
MatrixRow4 (t)
t -> table of four double values, either numerically indexed or indexed by the keys 'col1', 'col2', 'col3' and 'col4'
Constructs a new 4 column matrix row with the values from the given table.
Returns the new matrix row.
Every instance of this class has the following member values, accessible both by numeric indices and the following keys:
1 | "col1" -> the first column value
2 | "col2" -> the second column value
3 | "col3" -> the third column value
4 | "col4" -> the fourth column value
Every instance of this class has the following member methods:
MatrixRow4:Clone ()
Returns a newly allocated copy of this object.
MatrixRow4:GetIndexedElement (index)
index -> integer (from 1 to MatrixRow4.kNumColumns)
Returns the indexed column. This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
MatrixRow4:SetIndexedElement (index, value)
index -> integer (from 1 to MatrixRow4.kNumColumns)
value -> double
Set the indexed column.
This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
The original matrix row is modified in place.
Returns the newly modified matrix row.
MatrixRow4:IsEqual (row)
row -> MatrixRow4
Returns true if this matrix row is exactly equal to the given matrix row.
MatrixRow4:IsNearEqual (row)
row -> MatrixRow4
Returns true if this matrix row is nearly equal to the given matrix row, using a tolerance based on the precision of the matrix row elements.
MatrixRow4:IsNearEqual (row, tolerance)
tolerance -> double
row -> MatrixRow4
Returns true if this matrix row is nearly equal to the given matrix row, using the given tolerance.
The Matrix3x3 Class
Objects of this class represent a 3 column 3 row matrix in column major order.
This class has the following constant data members:
Matrix3x3.kNumRows -> constant integer value of 3
Matrix3x3.kNumColumns -> constant integer value of 3
Matrix3x3.kNumElements -> constant integer value of 9
Matrix3x3.kElementSize -> constant integer value of 4
Matrix3x3.kMatrixRowClass -> the class of the rows in this matrix, MatrixRow3 in this case.
This class has the following construction methods:
Matrix3x3 ()
Constructs a new 3x3 matrix with uninitialized values.
Returns the new matrix.
Matrix3x3 (mat)
mat -> Matrix3x3
Constructs a new 3x3 matrix by copying the given 3x3 matrix.
Returns the new matrix.
Matrix3x3 (r1, r2, r3)
r1 -> MatrixRow3
r2 -> MatrixRow3
r3 -> MatrixRow3
Constructs a new 3x3 matrix with the given rows.
Returns the new matrix.
Matrix3x3 (t)
t -> table of 3 tables, either numerically indexed or indexed by the keys 'row1', 'row2' and 'row3'
Constructs a new 3x3 matrix from the given table, which must contain 3 tables of 3 doubles. Returns the new matrix row.
Every instance of this class has the following member values, accessible both by numeric indices and the following keys:
1 | "row1" -> the first MatrixRow3
2 | "row2" -> the second MatrixRow3
3 | "row3" -> the third MatrixRow3
In addition, for convenient access to the individual elements of the matrix, the following accessors are also available:
1 | "elem1" -> the value at row 1 column 1
2 | "elem2" -> the value at row 1 column 2
3 | "elem3" -> the value at row 1 column 3
4 | "elem4" -> the value at row 2 column 1
5 | "elem5" -> the value at row 2 column 2
6 | "elem6" -> the value at row 2 column 3
7 | "elem7" -> the value at row 3 column 1
8 | "elem8" -> the value at row 3 column 2
9 | "elem9" -> the value at row 3 column 3
Every instance of this class has the following member methods:
Matrix3x3:Clone ()
Returns a newly allocated copy of this object.
Matrix3x3:GetIndexedElement (index)
index -> integer (from 1 to Matrix3x3.kNumElements)
Returns the indexed element, accessing the matrix as a one-dimensional array of values in row-major order.
Matrix3x3:SetIndexedElement (index, value)
index -> integer (from 1 to Matrix3x3.kNumElements)
value -> double
Sets the indexed element, accessing the matrix as a one-dimensional array of values in row-major order.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix3x3:GetIndexedRow (index)
index -> integer (from 1 to Matrix3x3.kNumRows)
Returns the indexed column. This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
Matrix3x3:SetIndexedRow (index, row)
index -> integer (from 1 to Matrix3x3.kNumRows)
row -> MatrixRow3
Set the indexed column. This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix3x3:Append (mat)
mat -> Matrix3x3
Multiplies this matrix against the other matrix and stores the result back into this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix3x3:AppendScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
This is a shortcut for creating a scaling matrix and appending it to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix3x3:GetInverse ()
Returns a newly allocated copy of this matrix inverted.
Matrix3x3:Invert ()
Inverts this matrix in place.
Returns the newly inverted matrix.
Matrix3x3:IsEqual (mat)
mat -> Matrix3x3
Returns true if this matrix is exactly equal to the given matrix.
Matrix3x3:IsIdentity ()
Returns true if this matrix is the identity.
Matrix3x3:IsNearEqual (mat)
mat -> Matrix3x3
Returns true if this matrix is nearly equal to the given matrix, using a tolerance based on the precision of the matrix elements.
Matrix3x3:IsNearEqual (mat, tolerance)
Returns true if this matrix is nearly equal to the given matrix, using the given tolerance.
mat -> Matrix3x3
tolerance -> double
Matrix3x3:IsNearIdentity ()
Returns true if this matrix is nearly equal to the identity using a tolerance based on the precision of the matrix elements.
Matrix3x3:PrependScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
This is a shortcut for creating a scaling matrix, appending this matrix to it, and assigning the result to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix3x3:SetIdentity ()
Sets this matrix to be the identity.
The original matrix is modified in place.
Returns the new identity matrix.
Matrix3x3:SetByRotationBetweenVectors (vec1, vec2)
vec1 -> Dir3d (normalized)
vec2 -> Dir3d (normalized)
Sets this matrix to be a rotation matrix, expressing a rotation from the first vector to the second.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix3x3:SetScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
Sets this matrix to be a scaling matrix.
The original matrix is modified in place.
Returns the new scaling matrix.
Matrix3x3:SetXRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the X axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix3x3:SetYRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the Y axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix3x3:SetZRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the Z axis given the angle in radians. of the angle.
The original matrix is modified in place. Returns the new rotation matrix.
Matrix3x3:SetXYZRotation (angleX, angleY, angleZ)
angleX -> double
angleY -> double
angleZ -> double
Sets this matrix to be a rotation matrix, expressing a rotation in X, Y and Z given the angles in radians.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix3x3:SetZYXInverseRotation (angleZ, angleY, angleX)
angleX -> double
angleY -> double
angleZ -> double
Sets this matrix to be a rotation matrix, expressing an inverse rotation in Z, Y and X given the angles in radians. Note the reverse order of the angle arguments.
The original matrix is modified in place.
Returns the new rotation matrix.
The Matrix4x3 Class
Objects of this class represent a 3 column 4 row matrix in column major order.
This class has the following constant data members:
Matrix4x3.kNumRows -> constant integer value of 4
Matrix4x3.kNumColumns -> constant integer value of 3
Matrix4x3.kNumElements -> constant integer value of 12
Matrix4x3.kElementSize -> constant integer value of 4
Matrix4x3.kMatrixRowClass -> the class of the rows in this matrix, MatrixRow3 in this case.
This class has the following construction methods:
Matrix4x3 ()
Constructs a new 4x3 matrix with uninitialized values.
Returns the new matrix.
Matrix4x3 (mat)
mat -> Matrix4x3
Constructs a new 4x3 matrix by copying the given 4x3 matrix.
Returns the new matrix.
Matrix4x3 (r1, r2, r3, r4)
r1 -> MatrixRow3
r2 -> MatrixRow3
r3 -> MatrixRow3
r4 -> MatrixRow3
Constructs a new 4x3 matrix with the given rows.
Returns the new matrix.
Matrix4x3 (t)
t -> table of 4 tables, either numerically indexed or indexed by the keys 'row1', 'row2', 'row3' and 'row4'
Constructs a new 4x3 matrix from the given table, which must contain 4 tables of 3 doubles.
Returns the new matrix row.
Every instance of this class has the following member values, accessible both by numeric indices and the following keys:
1 | "row1" -> the first MatrixRow3
2 | "row2" -> the second MatrixRow3
3 | "row3" -> the third MatrixRow3
4 | "row4" -> the fourth MatrixRow3
In addition, for convenient access to the individual elements of the matrix, the following accessors are also available:
1 | "elem1" -> the value at row 1 column 1
2 | "elem2" -> the value at row 1 column 2
3 | "elem3" -> the value at row 1 column 3
4 | "elem4" -> the value at row 2 column 1
5 | "elem5" -> the value at row 2 column 2
6 | "elem6" -> the value at row 2 column 3
7 | "elem7" -> the value at row 3 column 1
8 | "elem8" -> the value at row 3 column 2
9 | "elem9" -> the value at row 3 column 3
10 | "elem10" -> the value at row 4 column 1
11 | "elem11" -> the value at row 4 column 2
12 | "elem12" -> the value at row 4 column 3
Every instance of this class has the following member methods:
Matrix4x3:Clone ()
Returns a newly allocated copy of this object.
Matrix4x3:GetIndexedElement (index)
index -> integer (from 1 to Matrix4x3.kNumElements)
Returns the indexed element, accessing the matrix as a one-dimensional array of values in row-major order.
Matrix4x3:SetIndexedElement (index, value)
index -> integer (from 1 to Matrix4x3.kNumElements)
value -> double
Sets the indexed element, accessing the matrix as a one-dimensional array of values in row-major order.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x3:GetIndexedRow (index)
index -> integer (from 1 to Matrix4x3.kNumRows)
Returns the indexed column.
This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
Matrix4x3:SetIndexedRow (index, row)
index -> integer (from 1 to Matrix4x3.kNumRows)
row -> MatrixRow3
Set the indexed column.
This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x3:Append (mat)
mat -> Matrix4x3
Multiplies this matrix against the other matrix and stores the result back into this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x3:AppendScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
This is a shortcut for creating a scaling matrix and appending it to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x3:GetInverse ()
Returns a newly allocated copy of this matrix inverted.
Matrix4x3:Invert ()
Inverts this matrix in place.
Returns the newly inverted matrix.
Matrix4x3:IsEqual (mat)
mat -> Matrix4x3
Returns true if this matrix is exactly equal to the given matrix.
Matrix4x3:IsIdentity ()
Returns true if this matrix is the identity.
Matrix4x3:IsNearEqual (mat)
mat -> Matrix4x3
Returns true if this matrix is nearly equal to the given matrix, using a tolerance based on the precision of the matrix elements.
Matrix4x3:IsNearEqual (mat, tolerance)
mat -> Matrix4x3
tolerance -> double
Returns true if this matrix is nearly equal to the given matrix, using the given tolerance.
Matrix4x3:IsNearIdentity ()
Returns true if this matrix is nearly equal to the identity using a tolerance based on the precision of the matrix elements.
Matrix4x3:PrependScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
This is a shortcut for creating a scaling matrix, appending this matrix to it, and assigning the result to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x3:PrependTranslation (x, y, z)
x -> a translation value in X
y -> a translation value in Y
z -> a translation value in Z
This is a shortcut for creating a translation matrix, appending this matrix to it, and assigning the result to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x3:SetIdentity ()
Sets this matrix to be the identity.
The original matrix is modified in place.
Returns the new identity matrix.
Matrix4x3:SetByRotationBetweenVectors (vec1, vec2)
vec1 -> Dir3d (normalized)
vec2 -> Dir3d (normalized)
Sets this matrix to be a rotation matrix, expressing a rotation from the first vector to the second.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x3:SetScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
Sets this matrix to be a scaling matrix.
The original matrix is modified in place.
Returns the new scaling matrix.
Matrix4x3:SetTranslation (x, y, z)
x -> a translation value in X
y -> a translation value in Y
z -> a translation value in Z
Sets this matrix to be a translation matrix.
Returns the new scaling matrix.
Matrix4x3:SetXRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the X axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x3:SetYRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the Y axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x3:SetZRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the Z axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x3:SetXYZRotation (angleX, angleY, angleZ)
angleX -> double
angleY -> double
angleZ -> double
Sets this matrix to be a rotation matrix, expressing a rotation in X, Y and Z given the angles in radians.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x3:SetZYXInverseRotation (angleZ, angleY, angleX)
angleZ -> double
angleY -> double
angleX -> double
Sets this matrix to be a rotation matrix, expressing an inverse rotation in Z, Y and X given the angles in radians.
Note the reverse order of the angle arguments.
The original matrix is modified in place.
Returns the new rotation matrix.
The Matrix4x4 Class
Objects of this class represent a 4 column 4 row matrix in column major order.
This class has the following constant data members:
Matrix4x4.kNumRows -> constant integer value of 4
Matrix4x4.kNumColumns -> constant integer value of 4
Matrix4x4.kNumElements -> constant integer value of 16
Matrix4x4.kElementSize -> constant integer value of 4
Matrix4x4.kMatrixRowClass -> the class of the rows in this matrix, MatrixRow4 in this case.
This class has the following construction methods:
Matrix4x4 () Constructs a new 4x4 matrix with uninitialized values.
Returns the new matrix.
Matrix4x4 (mat)
mat -> Matrix4x4
Constructs a new 4x4 matrix by copying the given 4x4 matrix.
Returns the new matrix.
Matrix4x4 (r1, r2, r3, r4)
r1 -> MatrixRow4
r2 -> MatrixRow4
r3 -> MatrixRow4
r4 -> MatrixRow4
Constructs a new 4x4 matrix with the given rows.
Returns the new matrix.
Matrix4x4 (t)
t -> table of 4 tables, either numerically indexed or indexed by the keys 'row1', 'row2', 'row3' and 'row4'
Constructs a new 4x4 matrix from the given table, which must contain 4 tables of 4 doubles.
Returns the new matrix row.
Every instance of this class has the following member values, accessible both by numeric indices and the following keys:
1 | "row1" -> the first MatrixRow4
2 | "row2" -> the second MatrixRow4
3 | "row3" -> the third MatrixRow4
4 | "row4" -> the fourth MatrixRow4
In addition, for convenient access to the individual elements of the matrix, the following accessors are also available:
1 | "elem1" -> the value at row 1 column 1
2 | "elem2" -> the value at row 1 column 2
3 | "elem3" -> the value at row 1 column 3
4 | "elem4" -> the value at row 1 column 4
5 | "elem5" -> the value at row 2 column 1
6 | "elem6" -> the value at row 2 column 2
7 | "elem7" -> the value at row 2 column 3
8 | "elem8" -> the value at row 2 column 4
9 | "elem9" -> the value at row 3 column 1
10 | "elem10" -> the value at row 3 column 2
11 | "elem11" -> the value at row 3 column 3
12 | "elem12" -> the value at row 3 column 4
13 | "elem13" -> the value at row 4 column 1
14 | "elem14" -> the value at row 4 column 2
15 | "elem15" -> the value at row 4 column 3
16 | "elem16" -> the value at row 4 column 4
Every instance of this class has the following member methods: The original matrix is modified in place.
Matrix4x4:Clone ()
index -> integer (from 1 to Matrix4x4.kNumElements)
Returns a newly allocated copy of this object.
Matrix4x4:GetIndexedElement (index)
Returns the indexed element, accessing the matrix as a one-dimensional array of values in row-major order.
Matrix4x4:SetIndexedElement (index, value)
index -> integer (from 1 to Matrix4x4.kNumElements)
value -> double
Sets the indexed element, accessing the matrix as a one-dimensional array of values in row-major order.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4:GetIndexedRow (index)
index -> integer (from 1 to Matrix4x4.kNumRows)
Returns the indexed column. This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
Matrix4x4:SetIndexedRow (index, row)
index -> integer (from 1 to Matrix4x4.kNumRows)
row -> MatrixRow4
Set the indexed column. This seems a bit redundant now that I think of it, but it's potentially faster than the normal numerical Lua index operation.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4: Append (mat)
mat -> Matrix4x4
Multiplies this matrix against the other matrix and stores the result back into this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4:AppendScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
This is a shortcut for creating a scaling matrix and appending it to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4:AppendTranslation (x, y, z)
x -> a translation value in X
y -> a translation value in Y
z -> a translation value in Z
This is a shortcut for creating a translation matrix and appending it to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4:GetInverse ()
Returns a newly allocated copy of this matrix inverted.
Matrix4x4:Invert ()
Inverts this matrix in place.
Returns the newly inverted matrix.
Matrix4x4:IsEqual (mat)
mat -> Matrix4x4
Returns true if this matrix is exactly equal to the given matrix.
Matrix4x4:IsIdentity ()
Returns true if this matrix is the identity.
Matrix4x4:IsNearEqual (mat)
mat -> Matrix4x4
Returns true if this matrix is nearly equal to the given matrix, using a tolerance based on the precision of the matrix elements.
Matrix4x4:IsNearEqual (mat, tolerance)
mat -> Matrix4x4
tolerance -> double
Returns true if this matrix is nearly equal to the given matrix, using the given tolerance.
Matrix4x4:IsNearIdentity ()
Returns true if this matrix is nearly equal to the identity using a tolerance based on the precision of the matrix elements.
Matrix4x4:PrependScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
This is a shortcut for creating a scaling matrix, appending this matrix to it, and assigning the result to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4:PrependTranslation (x, y, z)
x -> a translation value in X
y -> a translation value in Y
z -> a translation value in Z
This is a shortcut for creating a translation matrix, appending this matrix to it, and assigning the result to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4:SetIdentity ()
Sets this matrix to be the identity.
The original matrix is modified in place.
Returns the new identity matrix.
Matrix4x4:PrependTranslation (x, y, z)
x -> a translation value in X
y -> a translation value in Y
z -> a translation value in Z
This is a shortcut for creating a translation matrix, appending this matrix to it, and assigning the result to this matrix.
The original matrix is modified in place.
Returns the newly modified matrix.
Matrix4x4:SetPerspective (viewAngle, [ lensThickness ])
viewAngle -> double
lensThickness -> double
Sets this matrix to be a perspective matrix with the given view angle in radians.
The original matrix is modified in place.
Returns the new perspective matrix.
Matrix4x4:SetScaling (x, y, z)
x -> a scale value in X
y -> a scale value in Y
z -> a scale value in Z
Sets this matrix to be a scaling matrix.
The original matrix is modified in place.
Returns the new scaling matrix.
Matrix4x4:SetTranslation (x, y, z)
x -> a translation value in X
y -> a translation value in Y
z -> a translation value in Z
Sets this matrix to be a translation matrix.
The original matrix is modified in place.
Returns the new scaling matrix.
Matrix4x4:SetXRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the X axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x4:SetYRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the Y axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x4:SetZRotation (angle)
angle -> double
Sets this matrix to be a rotation matrix, expressing a rotation about the Z axis given the angle in radians. of the angle.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x4:SetXYZRotation (angleX, angleY, angleZ)
angleX -> double
angleY -> double
angleZ -> double
Sets this matrix to be a rotation matrix, expressing a rotation in X, Y and Z given the angles in radians.
The original matrix is modified in place.
Returns the new rotation matrix.
Matrix4x4:SetZYXInverseRotation (angleZ, angleY, angleX)
angleZ -> double
angleY -> double
angleX -> double
Sets this matrix to be a rotation matrix, expressing an inverse rotation in Z, Y and X given the angles in radians. Note the reverse order of the angle arguments.
Returns the new rotation matrix.
The RichMatrix3x3 Class
Objects of this class hold both a Matrix3x3 transformation and its inverse. These are often required when transforming Normal vectors. It's "rich" because of that extra inverse information.
This class has the following constant data members:
RichMatrix3x3.kMatrixClass -> the class of the contained transformation and inverse, Matrix3x3 in this case.
This class has the following construction methods:
RichMatrix3x3 ()
Constructs a new rich 3x3 matrix with uninitialized values.
Returns the new rich matrix.
RichMatrix3x3 (richMat)
richMat -> RichMatrix3x3
Constructs a new rich 3x3 matrix by copying the given rich 3x3 matrix.
Returns the new rich matrix.
RichMatrix3x3 (mat)
mat -> Matrix3x3
Constructs a new rich 3x3 matrix using the given 3x3 matrix as its transformation.
Returns the new rich matrix.
Every instance of this class has the following member methods:
RichMatrix3x3:Clone ()
Returns a newly allocated copy of this object.
RichMatrix3x3:GetInverse ()
Returns the inverse transformation for this object as a Matrix3x3.
RichMatrix3x3:GetTransformation ()
Returns the transformation for this object as a Matrix3x3.
RichMatrix3x3:InverseReady ()
Returns true if the inverse transformation for this object has already been computed and cached.
RichMatrix3x3:SetTransformation (mat)
Sets the transformation for this object to the given matrix, invalidating any cached inverse.
The original object is modified in place.
The RichMatrix4x3 Class
Objects of this class hold both a Matrix4x3 transformation and its inverse. These are often required when transforming Normal vectors. It's "rich" because of that extra inverse information.
This class has the following constant data members:
RichMatrix4x3.kMatrixClass -> the class of the contained transformation and inverse, Matrix4x3 in this case.
This class has the following construction methods:
RichMatrix4x3 ()
Constructs a new rich 4x3 matrix with uninitialized values.
Returns the new matrix.
RichMatrix4x3 (richMat)
richMat -> RichMatrix4x3
Constructs a new rich 4x3 matrix by copying the given rich 4x3 matrix.
Returns the new rich matrix.
RichMatrix4x3 (mat)
mat -> Matrix4x3
Constructs a new rich 4x3 matrix using the given 4x3 matrix as its transformation.
Returns the new rich matrix.
Every instance of this class has the following member methods:
RichMatrix4x3:Clone ()
Returns a newly allocated copy of this object.
RichMatrix4x3:GetInverse ()
Returns the inverse transformation for this object as a Matrix4x3.
RichMatrix4x3:GetTransformation ()
Returns the transformation for this object as a Matrix4x3.
RichMatrix4x3:InverseReady ()
Returns true if the inverse transformation for this object has already been computed and cached.
RichMatrix4x3:SetTransformation (mat)
Sets the transformation for this object to the given matrix, invalidating any cached inverse.
The original object is modified in place.
The RichMatrix4x4 Class
Objects of this class hold both a Matrix4x4 transformation and its inverse.
These are often required when transforming Normal vectors. It's "rich" because of that extra inverse information.
This class has the following constant data members:
RichMatrix4x4.kMatrixClass -> the class of the contained transformation and inverse, Matrix4x4 in this case.
This class has the following construction methods:
RichMatrix4x4 ()
Constructs a new rich 4x4 matrix with uninitialized values.
Returns the new matrix.
RichMatrix4x4 (richMat)
richMat -> RichMatrix4x4
Constructs a new rich 4x4 matrix by copying the given rich 4x4 matrix.
Returns the new rich matrix.
RichMatrix4x4 (mat)
mat -> Matrix4x4
Constructs a new rich 4x4 matrix using the given 4x4 matrix as its transformation.
Returns the new rich matrix.
Every instance of this class has the following member methods:
RichMatrix4x4:Clone ()
Returns a newly allocated copy of this object.
RichMatrix4x4:GetInverse ()
Returns the inverse transformation for this object as a Matrix4x4.
RichMatrix4x4:GetTransformation ()
Returns the transformation for this object as a Matrix4x4.
RichMatrix4x4:InverseReady ()
Returns true if the inverse transformation for this object has already been computed and cached.
RichMatrix4x4:SetTransformation (mat)
Sets the transformation for this object to the given matrix, invalidating any cached inverse.
The original object is modified in place.