Skip to content

Matrix4x4

The Matrix4x4 class is primarily used for 3D graphics transformations, including rotation, translation, scaling, and other transformations.

typescript
// Create a new empty matrix
let matrix = new Matrix4x4();

成员变量

Matrix4x4.m00 : number
The value of the element in the first row and first column of the matrix.
Matrix4x4.m03 : number
The value of the element in the first row and fourth column of the matrix.
Matrix4x4.m10 : number
The value of the element in the second row and first column of the matrix.
Matrix4x4.m13 : number
The value of the element in the second row and fourth column of the matrix.
Matrix4x4.m20 : number
The value of the element in the third row and first column of the matrix.
Matrix4x4.m23 : number
The value of the element in the third row and fourth column of the matrix.
Matrix4x4.m30 : number
The value of the element in the fourth row and first column of the matrix.
Matrix4x4.m01 : number
The value of the element in the first row and second column of the matrix.
Matrix4x4.m11 : number
The value of the element in the second row and second column of the matrix.
Matrix4x4.m21 : number
The value of the element in the third row and second column of the matrix.
Matrix4x4.m31 : number
The value of the element in the fourth row and second column of the matrix.
Matrix4x4.m02 : number
The value of the element in the first row and third column of the matrix.
Matrix4x4.m12 : number
The value of the element in the second row and third column of the matrix.
Matrix4x4.m22 : number
The value of the element in the third row and third column of the matrix.
Matrix4x4.m32 : number
The value of the element in the fourth row and third column of the matrix.
Matrix4x4.m33 : number
The value of the element in the fourth row and fourth column of the matrix.
Matrix4x4.xAxis : Vector3
(Read Only) The X-axis direction of the matrix.
Matrix4x4.yScale : number
(Read Only) The Y component of the scale vector.
Matrix4x4.determinant : number
(Read Only) Gets the determinant of the matrix.
Matrix4x4.position : Vector3
(Read Only) The position vector in the matrix.
Matrix4x4.yAxis : Vector3
(Read Only) The Y-axis direction of the matrix.
Matrix4x4.zAxis : Vector3
(Read Only) The Z-axis direction of the matrix.
Matrix4x4.xScale : number
(Read Only) The X component of the scale vector.
Matrix4x4.maxScale : number
(Read Only) The maximum scale of the matrix.
Matrix4x4.zScale : number
(Read Only) The Z component of the scale vector.
Matrix4x4.rotation : Quaternion
(Read Only) The rotation vector in the matrix.
Matrix4x4.isPerspective : boolean
(Read Only) Whether the current matrix is a perspective projection matrix.
Matrix4x4.scale : Vector3
(Read Only) The scale factor of the matrix.
Matrix4x4.determinant_3x3 : number
(Read-only) The determinant of a 3x3 matrix.
Matrix4x4.invert : Matrix4x4
(Read Only) The inverse matrix.
Matrix4x4.transpose : Matrix4x4
(Read Only) Transposed matrix.
Matrix4x4.invertTranspose : Matrix4x4
(Read Only) The inverse matrix of the transposed matrix.

静态变量

Matrix4x4.zero : Matrix4x4
(Read Only) A 4x4 empty matrix.
Matrix4x4.identity : Matrix4x4
(Read Only) The identity matrix.

成员方法

Matrix4x4.SetColumn ( index : number , column : Vector4 ) : void
Set the specified column data of the matrix.
Matrix4x4.AddAssign ( rhs : Matrix4x4 ) : void
Adds a Matrix4x4 matrix to the current matrix.
Matrix4x4.GetRow ( index : number ) : Vector4
Get the specified row data of a matrix.
Matrix4x4.SetIdentity ( ) : void
Set the matrix to an empty matrix (i.e. an identity matrix).
Matrix4x4.SetRow ( index : number , column : Vector4 ) : void
Set the data of a specific row in the matrix.
Matrix4x4.Mul ( rhs : Matrix4x4 ) : Matrix4x4
Multiplies two Matrix4x4 matrices.
Matrix4x4.GetColumn ( index : number ) : Vector4
Get the specified column data of the matrix.
Matrix4x4.MultiplyPoint ( point : Vector3 ) : Vector3
Transforms a vector position using a matrix.
Matrix4x4.Scale ( scale : Vector3 ) : void
Scale the current matrix.
Matrix4x4.PerspectiveMultiplyPoint3 ( v : Vector3 ) : Vector3
Multiply a 3D vector by a perspective projection matrix.
Matrix4x4.MultiplyPoint3x4 ( point : Vector3 ) : Vector3
Multiplies a 3D vector by a 4x4 matrix.
Matrix4x4.SubAssign ( rhs : Matrix4x4 ) : void
Subtracts a Matrix4x4 matrix from the current matrix.
Matrix4x4.MultiplyVector ( vector : Vector3 ) : Vector3
Multiply a vector by a matrix.
Matrix4x4.CopyFrom ( from : Matrix4x4 ) : void
Assigns a Matrix4x4 matrix to the current matrix.
Matrix4x4.MultiplyVector4 ( vector : Vector4 ) : Vector4
Multiply a Vector4 by a matrix.
Matrix4x4.toString ( ) : string
Returns the string representation of the current 4x4 matrix properties.
Matrix4x4.Get ( index : number ) : number
Get the value of an element in a matrix based on its row and column index.
Matrix4x4.Invert ( ) : void
Calculates the inverse matrix of the current matrix.
Matrix4x4.Set ( index : number , value : number ) : void
Set the value of the elements in the matrix at the specified row and column.
Matrix4x4.Add ( rhs : Matrix4x4 ) : Matrix4x4
Adds two Matrix4x4 matrices together.
Matrix4x4.Sub ( rhs : Matrix4x4 ) : Matrix4x4
Subtracts two Matrix4x4 matrices.
Matrix4x4.MulAssign ( rhs : Matrix4x4 ) : void
Multiplies the current matrix by a Matrix4x4 matrix.
Matrix4x4.EqualsTo ( other : Matrix4x4 ) : boolean
判断当前矩阵与other是否相等。
Matrix4x4.Transpose ( ) : void
Transpose matrix, which means swapping its rows and columns.
Matrix4x4.InvertTranspose ( ) : void
Calculates the inverse matrix after transposing.

静态方法

Matrix4x4.FromTRS ( pos : Vector3 , rot : Quaternion , scale : Vector3 ) : Matrix4x4
Create a matrix based on translation, rotation, and scaling information.
Matrix4x4.FromTR ( pos : Vector3 , rot : Quaternion ) : Matrix4x4
Create a matrix based on translation and rotation information.
Matrix4x4.FromTranslate ( pos : Vector3 ) : Matrix4x4
Create a transformation matrix.
Matrix4x4.FromScale ( scale : Vector3 ) : Matrix4x4
Create a scaling matrix.
Matrix4x4.FromRotate ( rot : Quaternion ) : Matrix4x4
Create a rotation matrix.
Matrix4x4.EqualsTo ( lhs : Matrix4x4 , rhs : Matrix4x4 ) : boolean
判断两个Matrix4x4矩阵是否相等。