|
| constexpr | t_Matrix4 () |
| | Default constructor.
|
| |
| constexpr | t_Matrix4 (T v) |
| | Constructs a diagonal matrix with the same value on the diagonal.
|
| |
| constexpr | t_Matrix4 (T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15) |
| | Constructs a matrix from sixteen individual elements.
|
| |
| constexpr | t_Matrix4 (T v[16]) |
| | Constructs a matrix from an array of sixteen elements.
|
| |
| constexpr | t_Matrix4 (const t_Vector4< T > &c0, const t_Vector4< T > &c1, const t_Vector4< T > &c2, const t_Vector4< T > &c3) |
| | Constructs a matrix from four column vectors.
|
| |
| template<typename R > |
| | t_Matrix4 (const t_Matrix4< R > &rhs) |
| | Type-converting constructor.
|
| |
| constexpr size_t | size () const |
| | Gets the total number of elements in the matrix.
|
| |
| constexpr size_t | columns () const |
| | Gets the number of columns in the matrix.
|
| |
| constexpr size_t | rows () const |
| | Gets the number of rows in the matrix.
|
| |
| t_Vector4< T > & | operator[] (size_t c) |
| | Column access operator (mutable).
|
| |
| const t_Vector4< T > & | operator[] (size_t c) const |
| | Column access operator (const).
|
| |
| T & | operator() (size_t c, size_t r) |
| | Element access operator (mutable).
|
| |
| T | operator() (size_t c, size_t r) const |
| | Element access operator (const).
|
| |
| template<typename R > |
| t_Matrix4 & | operator= (const t_Matrix4< R > &rhs) |
| | Type-converting assignment operator.
|
| |
| void | set (T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15) |
| | Sets all sixteen matrix elements.
|
| |
| template<typename R > |
| void | set (const t_Matrix4< R > &rhs) |
| | Sets this matrix equal to another matrix.
|
| |
| T * | data () |
| | Gets a pointer to the underlying data.
|
| |
| const T * | data () const |
| | Gets a const pointer to the underlying data.
|
| |
| t_Matrix4 | operator* (T scalar) const |
| | Scalar multiplication operator.
|
| |
| t_Matrix4 & | operator*= (T scalar) |
| | Scalar multiplication assignment operator.
|
| |
| t_Matrix4 | operator* (const t_Matrix4 &rhs) const |
| | Matrix multiplication operator.
|
| |
| t_Matrix4 & | operator*= (const t_Matrix4 &rhs) |
| | Matrix multiplication assignment operator.
|
| |
| t_Vector4< T > | operator* (const t_Vector4< T > &v) const |
| | Matrix-vector multiplication operator.
|
| |
| t_Matrix4 | operator+ (const t_Matrix4 &rhs) const |
| | Matrix addition operator.
|
| |
| t_Matrix4 & | operator+= (const t_Matrix4 &rhs) |
| | Matrix addition assignment operator.
|
| |
| t_Matrix4 | operator- (const t_Matrix4 &rhs) const |
| | Matrix subtraction operator.
|
| |
| t_Matrix4 & | operator-= (const t_Matrix4 &rhs) |
| | Matrix subtraction assignment operator.
|
| |
| t_Matrix4 | operator/ (T scalar) const |
| | Scalar division operator.
|
| |
| t_Matrix4 & | operator/= (T scalar) |
| | Scalar division assignment operator.
|
| |
| bool | operator== (const t_Matrix4 &rhs) const |
| | Equality comparison operator.
|
| |
| bool | operator!= (const t_Matrix4 &rhs) const |
| | Inequality comparison operator.
|
| |
| bool | operator< (const t_Matrix4 &rhs) const |
| | Less-than comparison operator for ordering.
|
| |
| t_Matrix4 | transpose () const |
| | Computes the transpose of this matrix.
|
| |
| t_Matrix4 | operator- () const |
| | Unary negation operator.
|
| |
| | operator bool () const noexcept |
| | Boolean conversion operator.
|
| |
template<typename T>
struct Infinity::Types::Math::t_Matrix4< T >
Template structure representing a 4x4 matrix.
t_Matrix4 provides a column-major 4x4 matrix implementation for 3D transformations in homogeneous coordinates. This is the standard matrix for representing complete 3D transformations including translation, rotation, scale, and perspective projection. The matrix is stored as four column vectors, following the convention used by modern graphics APIs like OpenGL and Vulkan.
Common applications in procedural generation and 3D graphics:
- Complete 3D transformations (translation, rotation, scale combined)
- Model-view-projection matrices for rendering
- Camera transformations (view and projection matrices)
- Skeletal animation transformations (bone matrices)
- Coordinate space conversions (object to world, world to view, etc.)
- Perspective and orthographic projections
- Instance transformations for procedurally placed objects
Matrix layout (column-major):
t_Vector4< T > value[4]
Column vectors comprising the matrix.
Definition Matrix4.hpp:102
For typical 3D transformations, the upper-left 3x3 submatrix represents rotation and scale, the fourth column (value[3].xyz) represents translation, and the bottom row is typically [0, 0, 0, 1] for affine transformations.
The template parameter allows instantiation with different numeric types (float, double) to match precision requirements.
Example usage:
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
5, 10, 3, 1
);
2, 0, 0, 0,
0, 2, 0, 0,
0, 0, 2, 0,
0, 0, 0, 1
);
Matrix4 transform = translation * scale;
Vector4 transformed = transform * point;
Template structure representing a 4x4 matrix.
Definition Matrix4.hpp:93
t_Matrix4 transpose() const
Computes the transpose of this matrix.
Definition Matrix4.hpp:705
Template structure representing a 4-component vector.
Definition Vector4.hpp:85
- Template Parameters
-
| T | The numeric type for matrix elements (float, double). |
- Note
- Matrices are stored in column-major order for compatibility with OpenGL, Vulkan, and other modern graphics APIs.
-
Matrix-vector multiplication treats vectors as column vectors.
-
For affine transformations (translation, rotation, scale), the bottom row is typically [0, 0, 0, 1].
- See also
- Matrix4, Matrix4d
-
t_Vector4, t_Matrix3