Overview
Matrix4 is a 4x4 double-precision matrix used for affine transformations in 3D space. It is returned by Transform.getTransformMatrix() and GlobalTransform.getTransformMatrix(), and can be constructed from translation, rotation, and scale (TRS) decompositions.
Package: com.aspose.threed
Constructor
| Signature | Description |
|---|
Matrix4() | Constructs an identity matrix |
Matrix4(double m00, double m01, ... double m33) | Constructs from 16 individual elements (row-major) |
Static Fields
| Field | Type | Description |
|---|
IDENTITY | Matrix4 | The 4x4 identity matrix |
Public Fields (Element Access)
Matrix4 uses public fields for element access: m00, m01, … m33 (16 fields total, row-major layout).
| Field pattern | Type | Description |
|---|
m00 … m33 | double | Individual matrix elements as public fields. Access as mat.m00, mat.m01, etc. |
Translation components are in the last column: m03 (X), m13 (Y), m23 (Z).
Methods
| Method | Return Type | Description |
|---|
multiply(Matrix4 other) | Matrix4 | Matrix multiplication; returns a new matrix |
inverse() | Matrix4 | Returns the inverse matrix |
transpose() | Matrix4 | Returns the transposed matrix |
decompose(Vector3 translation, Vector3 scaling, Quaternion rotation) | boolean | Stub: always returns false. Intended to decompose the matrix into TRS components, but not yet implemented. |
determinant() | double | Returns the determinant of the matrix |
transformPoint(Vector3 point) | Vector3 | Transforms a point (applies full translation + rotation + scale) |
transformDirection(Vector3 direction) | Vector3 | Transforms a direction vector (applies rotation + scale, ignores translation) |
Static Methods
| Method | Return Type | Description |
|---|
Matrix4.translate(Vector3 t) | Matrix4 | Creates a translation matrix |
Matrix4.translate(double x, double y, double z) | Matrix4 | Creates a translation matrix from components |
Matrix4.scale(Vector3 s) | Matrix4 | Creates a scale matrix |
Matrix4.scale(double x, double y, double z) | Matrix4 | Creates a scale matrix from components |
Matrix4.rotateFromQuaternion(Quaternion q) | Matrix4 | Creates a rotation matrix from a quaternion |
Example
See Also