A 3x3 floating-point matrix with SSE-accelerated operations. More...
#include <matrix3x3.h>
Public Member Functions | |
| Matrix3x3 () | |
| Constructs a zero-initialized matrix. | |
| Matrix3x3 (float val[3][3]) | |
| Constructs a matrix from a 3x3 float array. | |
| Matrix3x3 | operator+ (const Matrix3x3 &other) const |
| Returns the element-wise sum of two matrices. | |
| Matrix3x3 | operator- (const Matrix3x3 &other) const |
| Returns the element-wise difference of two matrices. | |
| Matrix3x3 | operator* (const Matrix3x3 &other) const |
| Returns the matrix product of two matrices. | |
| float | dot (int row1, int row2) const |
| Computes the dot product of two rows in this matrix. | |
| void | zero () |
| Sets all matrix elements to zero. | |
| void | set (float val[3][3]) |
| Copies values from a 3x3 float array into this matrix. | |
| Matrix3x3 | transpose () const |
| Returns the transpose of this matrix. | |
| float | determinant () const |
| Computes the determinant of this matrix. | |
| Matrix3x3 | inverse () const |
| Computes the inverse of this matrix. | |
| float | trace () const |
| Computes the trace (sum of diagonal elements) of this matrix. | |
| Matrix3x3 | operator* (float scalar) const |
| Multiplies every element by a scalar. | |
| Matrix3x3 | operator/ (float scalar) const |
| Divides every element by a scalar. | |
| bool | operator== (const Matrix3x3 &other) const |
| Returns true if all elements are equal to the other matrix. | |
| bool | operator!= (const Matrix3x3 &other) const |
| Returns true if any element differs from the other matrix. | |
| float | get (int row, int col) const |
| Returns the element at the given row and column. | |
| void | set (int row, int col, float value) |
| Sets the element at the given row and column. | |
| Matrix3x3 | elementMultiply (const Matrix3x3 &other) const |
| Returns the Hadamard (element-wise) product of two matrices. | |
| Matrix3x3 | elementDivide (const Matrix3x3 &other) const |
| Returns the element-wise quotient of two matrices. | |
| void | vectorTransform (float vector[3]) const |
| Transforms a 3-element vector by this matrix in place. | |
Static Public Member Functions | |
| static Matrix3x3 | scalingMatrix (float scale_x, float scale_y, float scale_z) |
| Creates a diagonal scaling matrix. | |
| static Matrix3x3 | rotationMatrix (float angle, char axis) |
| Creates a rotation matrix around the specified axis. | |
Static Public Attributes | |
| static constexpr float | IdentityMatrix [3][3] |
| The 3x3 identity matrix constant. | |
A 3x3 floating-point matrix with SSE-accelerated operations.
Provides standard linear algebra operations including addition, subtraction, multiplication, transpose, inverse, and determinant. Element-wise operations and vector transforms are also supported. Uses SSE intrinsics where beneficial.
|
inline |
Constructs a matrix from a 3x3 float array.
| val | The source array to copy values from. |
|
inline |
Computes the determinant of this matrix.
|
inline |
Computes the dot product of two rows in this matrix.
| row1 | Index of the first row (0-2). |
| row2 | Index of the second row (0-2). |
Returns the element-wise quotient of two matrices.
Division by zero for individual elements produces zero rather than NaN.
| other | The divisor matrix. |
Returns the Hadamard (element-wise) product of two matrices.
| other | The matrix to multiply element-wise. |
|
inline |
Returns the element at the given row and column.
| row | The row index (0-2). |
| col | The column index (0-2). |
|
inline |
Computes the inverse of this matrix.
Returns the matrix product of two matrices.
| other | The right-hand matrix. |
Multiplies every element by a scalar.
| scalar | The scalar multiplier. |
Returns the element-wise sum of two matrices.
| other | The matrix to add. |
Returns the element-wise difference of two matrices.
| other | The matrix to subtract. |
Divides every element by a scalar.
| scalar | The scalar divisor. Returns a zero matrix if zero. |
Creates a rotation matrix around the specified axis.
| angle | The rotation angle in radians. |
| axis | The axis of rotation ('x', 'y', or 'z'). Returns identity for invalid axes. |
|
inlinestatic |
Creates a diagonal scaling matrix.
| scale_x | Scale factor along the X axis. |
| scale_y | Scale factor along the Y axis. |
| scale_z | Scale factor along the Z axis. |
Copies values from a 3x3 float array into this matrix.
| val | The source array. |
Sets the element at the given row and column.
| row | The row index (0-2). |
| col | The column index (0-2). |
| value | The value to set. Ignored if indices are out of range. |
|
inline |
Computes the trace (sum of diagonal elements) of this matrix.
|
inline |
Returns the transpose of this matrix.
Transforms a 3-element vector by this matrix in place.
| vector | A 3-element float array that is multiplied by this matrix. |
The 3x3 identity matrix constant.