Isle
|
4x4 Matrix class with virtual interface for manipulation and transformation. More...
#include <matrix.h>
Public Member Functions | |
Matrix4 (float(*p_data)[4]) | |
Constructs a Matrix4 object referring to the given 4x4 float array. More... | |
virtual void | Equals (float(*p_data)[4]) |
Set the matrix elements from a 4x4 float array. More... | |
virtual void | Equals (const Matrix4 &p_matrix) |
Copies the matrix from another Matrix4. More... | |
virtual void | SetData (float(*p_data)[4]) |
Set this matrix instance to use/point to a new 4x4 data block. More... | |
virtual void | SetData (UnknownMatrixType &p_matrix) |
Copies the matrix data from a raw UnknownMatrixType instance. More... | |
virtual float(* | GetData ())[4] |
Gets modifiable access to the 4x4 float matrix. More... | |
virtual float(* | GetData () const)[4] |
Gets read-only access to the 4x4 float matrix data. More... | |
virtual float * | Element (int p_row, int p_col) |
Accesses an individual element of the matrix in writable form. More... | |
virtual const float * | Element (int p_row, int p_col) const |
Accesses an individual element in read-only form. More... | |
virtual void | Clear () |
Sets every element of the matrix to zero. More... | |
virtual void | SetIdentity () |
Sets this matrix to identity (diagonal 1, others 0). More... | |
virtual void | operator= (const Matrix4 &p_matrix) |
Assign/copy another matrix's values into this one. More... | |
virtual Matrix4 & | operator+= (float(*p_data)[4]) |
In-place matrix addition with external float[4][4]. More... | |
virtual void | TranslateBy (const float &p_x, const float &p_y, const float &p_z) |
Applies translation by amounts along X, Y, Z axes. More... | |
virtual void | SetTranslation (const float &p_x, const float &p_y, const float &p_z) |
Overwrites the translation part of the matrix (last column). More... | |
virtual void | Product (float(*p_a)[4], float(*p_b)[4]) |
Multiplies two 4x4 float matrices, storing result in this. More... | |
virtual void | Product (const Matrix4 &p_a, const Matrix4 &p_b) |
Multiplies two Matrix4s, storing result in this matrix. More... | |
virtual void | ToQuaternion (Vector4 &p_resultQuat) |
Converts the 3x3 rotation part of this matrix to a quaternion (Vector4). More... | |
virtual int | FromQuaternion (const Vector4 &p_vec) |
Initializes the matrix from a quaternion (Vector4). More... | |
void | Scale (const float &p_x, const float &p_y, const float &p_z) |
Applies scaling factors along X, Y, and Z axes. More... | |
void | RotateX (const float &p_angle) |
Applies a rotation (in radians or degrees, depending on implementation) about the X axis. More... | |
void | RotateY (const float &p_angle) |
Applies a rotation (in radians or degrees, depending on implementation) about the Y axis. More... | |
void | RotateZ (const float &p_angle) |
Applies a rotation (in radians or degrees) about the Z axis. More... | |
int | BETA_1005a590 (Matrix4 &p_mat) |
[AI] Appears to perform some operation using another matrix, but function/purpose unknown. More... | |
void | Swap (int p_d1, int p_d2) |
Swaps the data between two rows/columns (presumably). More... | |
float * | operator[] (int idx) |
Array subscript operator for modifiable row access. More... | |
const float * | operator[] (int idx) const |
Const array subscript operator for readonly row access. More... | |
Protected Attributes | |
float(* | m_data )[4] |
Pointer to 4x4 float array, owns or refers to matrix data. More... | |
4x4 Matrix class with virtual interface for manipulation and transformation.
[AI]
[AI] Abstracts a 4x4 matrix (typically for geometric use, such as transformations in 3D graphics). Provides various matrix operations, including assignment, translation, scaling, rotation, product (multiplication), identity creation, conversion to and from quaternion, and data access. Designed for polymorphic use with virtual methods, which is important for engine extensibility.
|
inline |
|
inline |
[AI] Appears to perform some operation using another matrix, but function/purpose unknown.
[AI] Calculates the inverse of this matrix and stores it in p_mat.
p_mat | Reference to another Matrix4. [AI] |
[AI]
p_mat | Reference to output matrix that receives the inverse. [AI] |
[AI] Uses partial pivoting and Gaussian elimination for inversion.
|
inlinevirtual |
Sets every element of the matrix to zero.
[AI] Sets all matrix elements to zero.
[AI]
[AI]
[AI] Effectively zeros out the entire matrix.
|
inlinevirtual |
Accesses an individual element of the matrix in writable form.
[AI] Returns a pointer to the element at (row, col) in the matrix.
[AI]
p_row | Row index (0-3). [AI] |
p_col | Column index (0-3). [AI] |
[AI]
p_row | Row index (0-3). [AI] |
p_col | Column index (0-3). [AI] |
|
inlinevirtual |
Accesses an individual element in read-only form.
[AI] Const overload.
[AI]
p_row | Row index. [AI] |
p_col | Column index. [AI] |
Returns a pointer to the (row, col) element in the matrix. [AI]
p_row | Row index (0-3). [AI] |
p_col | Column index (0-3). [AI] |
|
inlinevirtual |
|
inlinevirtual |
Set the matrix elements from a 4x4 float array.
[AI] Copies a 4x4 matrix from an external float array to the internal matrix data.
[AI]
p_data | Pointer to an external 4x4 float data array. [AI] |
p_data | 4x4 float array (column-major order) to copy into this matrix. [AI] |
[AI] Performs a memory copy of the input data to the matrix's internal storage.
|
inlinevirtual |
Initializes the matrix from a quaternion (Vector4).
[AI] Sets this matrix from a quaternion representing rotation.
[AI]
p_vec | Quaternion as Vector4. [AI] |
[AI]
p_vec | Quaternion (Vector4, x,y,z,w) to construct a rotation matrix. [AI] |
|
inlinevirtual |
Gets read-only access to the 4x4 float matrix data.
[AI]
|
inlinevirtual |
Gets modifiable access to the 4x4 float matrix.
[AI] Const overload for retrieving matrix data pointer.
[AI] Returns a pointer to the raw 4x4 float matrix data.
[AI]
[AI]
|
inlinevirtual |
In-place matrix addition with external float[4][4].
[AI] Adds all corresponding elements of a float[4][4] to this matrix.
[AI]
p_data | Flat pointer to matrix to sum. [AI] |
p_data | Source float[4][4] whose elements are added to the matrix. [AI] |
[AI] Adds raw values in-place compared to array-style addition.
|
inlinevirtual |
Assign/copy another matrix's values into this one.
[AI] Assigns all values from another matrix to this one.
[AI]
p_matrix | Source matrix to assign from. [AI] |
p_matrix | Source matrix whose values will be copied. [AI] |
[AI] Equivalent to Equals(const Matrix4&).
Reimplemented in MxMatrix.
|
inline |
|
inline |
Multiplies two Matrix4s, storing result in this matrix.
[AI] Multiplies two Matrix4 objects and stores result in this matrix.
[AI]
p_a | First operand Matrix4. [AI] |
p_b | Second operand Matrix4. [AI] |
p_a | First operand matrix. [AI] |
p_b | Second operand matrix. [AI] |
[AI] Internally calls Product() with their data pointers.
|
inlinevirtual |
Multiplies two 4x4 float matrices, storing result in this.
[AI] Multiplies two 4x4 float matrices, storing result in this matrix.
[AI]
p_a | First matrix operand (left-hand side). [AI] |
p_b | Second matrix operand (right-hand side). [AI] |
[AI]
p_a | Pointer to first operand 4x4 matrix. [AI] |
p_b | Pointer to second operand 4x4 matrix. [AI] |
[AI] Standard matrix multiplication: this = p_a * p_b.
|
inline |
Applies a rotation (in radians or degrees, depending on implementation) about the X axis.
[AI] Rotates the matrix around the X axis by the specified angle (in radians).
[AI]
p_angle | Angle of rotation (in radians/degrees as used in implementation). [AI] |
[AI]
p_angle | Angle in radians to rotate. [AI] |
[AI] Modifies relevant elements in place using the rotation formula.
|
inline |
Applies a rotation (in radians or degrees, depending on implementation) about the Y axis.
[AI] Rotates the matrix around the Y axis by the specified angle (in radians).
[AI]
p_angle | Angle of rotation. [AI] |
[AI]
p_angle | Angle in radians. [AI] |
|
inline |
Applies a rotation (in radians or degrees) about the Z axis.
[AI] Rotates the matrix around the Z axis by the specified angle (in radians).
[AI]
p_angle | Angle of rotation. [AI] |
[AI]
p_angle | Angle in radians. [AI] |
|
inline |
Applies scaling factors along X, Y, and Z axes.
[AI] Scales the matrix by the given x, y, z factors along each respective axis.
[AI]
p_x | Scale factor for X axis. [AI] |
p_y | Scale factor for Y axis. [AI] |
p_z | Scale factor for Z axis. [AI] |
[AI]
p_x | Scaling factor for X dimension. [AI] |
p_y | Scaling factor for Y dimension. [AI] |
p_z | Scaling factor for Z dimension. [AI] |
[AI] Multiplies the respective matrix columns by the factors.
|
inlinevirtual |
Set this matrix instance to use/point to a new 4x4 data block.
[AI] Sets the internal matrix storage pointer to the given array.
[AI]
p_data | Pointer to a new 4x4 float array. [AI] |
(No copy: shallow set) [AI]
p_data | Pointer to the new 4x4 float array to use as matrix data. [AI] |
[AI] This does not copy the values. Use with care regarding data ownership.
|
inlinevirtual |
Copies the matrix data from a raw UnknownMatrixType instance.
[AI] Sets the internal matrix storage pointer from an UnknownMatrixType.
[AI]
p_matrix | Source UnknownMatrixType containing a 4x4 float array. [AI] |
(No copy: shallow set) [AI]
p_matrix | Source unknown matrix type whose internal data will be used for this matrix. [AI] |
[AI] This operation sets the internal data pointer directly.
|
inlinevirtual |
Sets this matrix to identity (diagonal 1, others 0).
[AI] Sets this matrix to the identity matrix.
[AI]
[AI]
[AI] Clears the matrix and sets the main diagonal to 1.
|
inlinevirtual |
Overwrites the translation part of the matrix (last column).
[AI] Sets the translation portion of the matrix to specified values.
[AI]
p_x | New translation X. [AI] |
p_y | New translation Y. [AI] |
p_z | New translation Z. [AI] |
[AI]
p_x | X translation value. [AI] |
p_y | Y translation value. [AI] |
p_z | Z translation value. [AI] |
[AI] Directly writes the values rather than incrementing (see TranslateBy).
|
inline |
Swaps the data between two rows/columns (presumably).
[AI] Swaps two matrix rows.
[AI]
p_d1 | First index (row/column). [AI] |
p_d2 | Second index (row/column). [AI] |
[AI]
p_d1 | First row to swap. [AI] |
p_d2 | Second row to swap. [AI] |
[AI] Used primarily by matrix inversion algorithms for row operations.
|
inlinevirtual |
Converts the 3x3 rotation part of this matrix to a quaternion (Vector4).
[AI] Converts this rotation/transform matrix to a quaternion.
[AI]
p_resultQuat | Reference to destination quaternion (Vector4). [AI] |
p_outQuat | Output quaternion (Vector4 format: x,y,z,w), filled by the function. [AI] |
[AI] Handles both general and edge cases for numerical consistency. Assumes the matrix represents a rotation. [AI]
|
inlinevirtual |
Applies translation by amounts along X, Y, Z axes.
[AI] Adds a translation vector to the translation row of the matrix (usually row 3).
[AI]
p_x | Amount to translate along X. [AI] |
p_y | Amount to translate along Y. [AI] |
p_z | Amount to translate along Z. [AI] |
[AI]
p_x | X component of translation. [AI] |
p_y | Y component of translation. [AI] |
p_z | Z component of translation. [AI] |
[AI] Adjusts only the translation part of the matrix.
|
protected |