# Matrix4x4

Operates as the cornerstone in modeling transformations in 3D space, holding critical data about translations, rotations, and scaling. Think of it as the mathematical blueprint that instructs your 3D objects on how to transform from one state to another – a fundamental tool in creating dynamic and interactive 3D environments. Like a guiding chart for your 3D objects, impacting how they move, turn, and resize in the 3D realm.

## Properties

Quaternion that represents the rotation part of this matrix. Accessing this property can be particularly useful if you want to extract the rotation information of a Matrix4x4 instance.

Vector3 representing the scale of the matrix. If the matrix has a uniform scale (the same scale along all axes), 'lossyScale' will correctly report it. If the matrix has a non-uniform scale (different scales along different axes), 'lossyScale' will not accurately reflect it.

Boolean indicating whether the matrix is the identity matrix. The identity matrix is a special type of matrix that doesn't change any vector when we multiply that vector with it.

Determinant of the matrix. The determinant is a special number that encapsulates some properties of the matrix. It is used for solving systems of equations, in calculus, and more.

Inverse of the matrix, assuming it exists. An inverse matrix is a matrix that, when multiplied by the original matrix, yields the identity matrix.

Transpose of the matrix. The transpose of a matrix is obtained by swapping its rows with columns and vice versa.

Element at the first row and first column of the matrix.

Element at the second row and first column of the matrix.

Element in the third row and first column of the matrix.

Element at the fourth row and first column of the matrix.

Element in the first row and second column of the matrix.

Element at the second row and second column of the matrix.

Element at the third row and second column of the matrix.

Element in the fourth row and second column of the matrix.

Element at the first row and third column of the matrix.

Element in the second row and third column of the matrix.

Element in the third row and third column of the matrix.

Element at the fourth row and third column of the matrix.

Element in the first row and fourth column of the matrix.

Element at the second row and fourth column of the matrix.

Element in the third row and fourth column of the matrix.

Element at the fourth row and fourth column of the matrix.

Matrix4x4 where all elements are set to zero. This essentially signifies a "null" transformation, meaning no change will take place on applying this matrix to a vector or a point.

Identity Matrix4x4. An identity matrix, when used to transform a point or a vector, leaves it unaltered, just like the number '1' in multiplication. It plays a crucial role in matrix operations and can be very useful for resetting transformations.

## Methods

Checks if a matrix is a valid transformation matrix. It returns a boolean indicating whether the matrix holds valid translation, rotation, and scale values.

#### Returns

Returns true if the matrix is a valid transformation matrix, otherwise false.

Sets the matrix to a transformation matrix, given a Vector3 for position, a Quaternion for rotation, and a Vector3 for scale. It's quick and convenient when you want to set up a transform from position, rotation and scale values.

#### Parameters

##### pos

Vector3The position to set in the transformation matrix.

The rotation to set in the transformation matrix.

The scale to set in the transformation matrix.

#### Returns

Vector4 representing a specified column of the matrix. This can be helpful when you need to extract specific column information from a matrix.

#### Parameters

##### index

The index of the column to retrieve.

#### Returns

Returns a Vector4 representing the specified column of the matrix.

Vector4 representing a specified row of the matrix. This can be useful when you need to extract certain row information from a matrix.

#### Parameters

##### index

The index of the row to retrieve.

#### Returns

Returns a Vector4 representing the specified row of the matrix.

Vector3 representing the position stored in the transformation matrix. This is particularly useful when wanting to extract the position component from a transformation matrix.

#### Returns

Returns a Vector3 representing the position stored in the matrix.

Vector4 to a specified column of the matrix. This method comes in handy when you want to replace a specific column of a matrix.

#### Parameters

##### index

The index of the column to set.

##### column

Vector4The vector to set in the specified column of the matrix.

#### Returns

Vector4 to a specified row of the matrix. You can use this method to replace a certain row of a matrix.

#### Parameters

##### index

The index of the row to set.

##### row

Vector4The vector to set in the specified row of the matrix.

#### Returns

Multiplies a Matrix4x4 and a Vector3 together. It treats the input Vector3 as a point in 3D space - this means it also considers the translation stored in the matrix.

Multiplies a Matrix4x4 and a Vector3 together. It treats the matrix as if it's a 3x4 matrix, and thus the result will not have perspective projection applied.

Multiplies a Matrix4x4 and a Vector3 together. It treats the input Vector3 as a direction rather than a point, meaning it will not consider the translation part of the matrix.

Determinant of a given Matrix4x4. The determinant of a matrix is a special scalar value that can be computed from its elements and can provide useful information about the matrix.

#### Parameters

The matrix whose determinant is to be calculated.

#### Returns

Returns the determinant of the given matrix.

Creates a transformation matrix from translation, rotation, and scale. The 'TRS' stands for 'Translate, Rotate, Scale'. It returns a Matrix4x4 built from the given Vector3 of position, Quaternion of rotation and another Vector3 of scale.

Computes the inverse of a given Matrix4x4. The inverse of a matrix is a matrix that, when multiplied with the original matrix, yields the identity matrix.

Creates the transpose of a given Matrix4x4. The transpose of a matrix is a new matrix whose rows are the columns of the original matrix and whose columns are the original's rows.

Creates an orthogonal projection matrix. The resulting matrix can be used to transform coordinates in 3D into a 2D projection. This is particularly useful in things like 2D games or interfaces.

#### Parameters

##### left

The value for the left vertical clipping plane.

##### right

The value for the right vertical clipping plane.

##### bottom

The value for the bottom horizontal clipping plane.

##### top

The value for the top horizontal clipping plane.

##### zNear

The value for the near depth clipping plane.

##### zFar

The value for the far depth clipping plane.

#### Returns

Returns an orthogonal projection matrix created from the specified parameters.

Creates a perspective projection matrix from field of view, aspect ratio, and near and far clipping planes. The resulting matrix can be used to transform 3D coordinates into a 2D perspective.

#### Parameters

##### fov

The field of view in the y direction, measured in degrees.

##### aspect

The aspect ratio, defined as width divided by height.

##### zNear

The value for the near depth clipping plane.

##### zFar

The value for the far depth clipping plane.

#### Returns

Returns a perspective projection matrix created from the specified parameters.

Creates a viewing matrix aimed at a target with a defined up direction. This method can be useful in a variety of situations, like setting the view matrix of a camera.

#### Parameters

#### Returns

Returns a viewing matrix aimed at the target from a set position and up direction.

Creates a perspective projection matrix that represents a view frustum. A frustum is a kind of pyramid with its top cut off. It is typically what a camera in 3D space sees with certain field of view and near and far clipping planes.

#### Parameters

##### left

The value for the left vertical clipping plane.

##### right

The value for the right vertical clipping plane.

##### bottom

The value for the bottom horizontal clipping plane.

##### top

The value for the top horizontal clipping plane.

##### zNear

The value for the near depth clipping plane.

##### zFar

The value for the far depth clipping plane.

#### Returns

Returns a perspective projection matrix that represents the specified view frustum.

Creates a scaling matrix from a given Vector3. The resulting matrix can be used to scale an object in 3D space by the specified vector.

Creates a translation matrix from a given Vector3. It can be used to move an object in 3D space by a specified vector.

Creates a rotation matrix from a Quaternion. The resulting matrix can be used to rotate an object in 3D space by the specified Quaternion.

#### Parameters

The quaternion by which to rotate.

#### Returns

Returns a rotation matrix created from the specified quaternion.