A 4x4 matrix class. More...
#include "murl_math_matrix.h"
Public Types | |
enum | Component { } |
Enumeration of the components raw data index. More... | |
enum | ComponentMask { MASK_NONE , MASK_XX , MASK_YX , MASK_ZX , MASK_WX , MASK_XY , MASK_YY , MASK_ZY , MASK_WY , MASK_XZ , MASK_YZ , MASK_ZZ , MASK_WZ , MASK_XW , MASK_YW , MASK_ZW , MASK_WW , MASK_ALL } |
Enumeration of the components' bit masks. More... | |
enum | PredefinedType { UNINITIALIZED , ZERO , IDENTITY } |
Enumeration of the predefined initialization types for constructing a Matrix(PredefinedType type). More... | |
enum | HintFlags { FLAG_TRANSLATION , FLAG_ROTATION , FLAG_SCALE , FLAG_ARBITRARY , FLAG_NO_HINTS } |
Enumeration of hint flags. More... | |
using | ValueType = DataType |
The template parameter value type. | |
Public Member Functions | |
Matrix () | |
The default constructor, creating an identity matrix. More... | |
Matrix (PredefinedType type) | |
Constructor to create a matrix from a predefined type. More... | |
template<class DataType2 > | |
Matrix (const Matrix< DataType2 > &matrix) | |
The copy constructor using a Matrix of different type. More... | |
UInt32 | GetHints () const |
Get the hint flags. More... | |
void | SetHints (UInt32 mask) |
Set the hint flags. More... | |
void | ClearHints (UInt32 mask) |
Clear hint flags. More... | |
void | EnableHints (Bool autoDetect) |
Enable hints. More... | |
void | DisableHints () |
Disable hints. | |
DataType | operator[] (UInt32 index) const |
Get a component element. More... | |
DataType & | operator[] (UInt32 index) |
Get a writeable reference to a component element. More... | |
const DataType * | GetPointer () const |
Get a const pointer to the raw data. More... | |
DataType * | GetPointer () |
Get a writeable pointer to the raw data. More... | |
Matrix & | operator*= (const Matrix &m) |
In-place matrix-matrix multiplication operator. More... | |
Matrix | operator* (const Matrix &rhs) const |
Matrix-matrix multiplication operator. More... | |
Vector< DataType > | operator* (const Vector< DataType > &rhs) const |
Matrix-vector multiplication operator. More... | |
void | Clear () |
Clear all components of the matrix instance. More... | |
void | SetIdentity () |
Load the identity matrix to the current instance. | |
void | SetIdentityRotation () |
Load the identity matrix to the upper 3x3 matrix. | |
void | Set (const Matrix &m) |
Copy the content of a source matrix to the matrix instance. More... | |
void | SetTranslationComponent (const Vector< DataType > &v) |
Set the translation component to a given vector. More... | |
void | SetTranslationComponent (DataType x, DataType y, DataType z) |
Set the translation component to given values. More... | |
void | SetTranslationComponentX (DataType x) |
Set the translation X component. More... | |
void | SetTranslationComponentY (DataType y) |
Set the translation Y component. More... | |
void | SetTranslationComponentZ (DataType z) |
Set the translation Z component. More... | |
const Vector< DataType > & | GetTranslationComponent () const |
Get the translation component vector. More... | |
DataType | GetTranslationComponentX () const |
Get the translation component's X value. More... | |
DataType | GetTranslationComponentY () const |
Get the translation component's Y value. More... | |
DataType | GetTranslationComponentZ () const |
Get the translation component's Z value. More... | |
void | SetScalingComponent (const Vector< DataType > &v) |
Set the scaling component using a vector. More... | |
void | SetScalingComponent (DataType x, DataType y, DataType z) |
Set the scaling component using three distinct values. More... | |
Vector< DataType > | GetScalingComponent () const |
Get a vector containing the X, Y and Z scaling components of the matrix. More... | |
DataType | GetScalingComponentX () const |
Get the X scale value of the matrix. More... | |
DataType | GetScalingComponentY () const |
Get the Y scale value of the matrix. More... | |
DataType | GetScalingComponentZ () const |
Get the Z scale value of the matrix. More... | |
void | SetRotationComponent (const Vector< DataType > &axisAngle) |
Set the rotation component by a vector. More... | |
void | SetRotationComponent (DataType angle, const Vector< DataType > &axis) |
Set the rotation component by an angle and vector. More... | |
void | SetRotationComponentAxisAngle (DataType angle, DataType ax, DataType ay, DataType az) |
Set the rotation component by an angle and vector components. More... | |
void | SetRotationComponent (DataType angleX, DataType angleY, DataType angleZ) |
Set the rotation component by euler angles. More... | |
void | SetRotationComponentXYZ (const Vector< DataType > &angles, IEnums::RotationOrder rotationOrder) |
Set the rotation component by euler angles with a given rotation order. More... | |
void | SetRotationComponentXYZ (DataType angleX, DataType angleY, DataType angleZ, IEnums::RotationOrder rotationOrder) |
Set the rotation component by euler angles with a given rotation order. More... | |
void | SetRotationComponentX (DataType angleX) |
Set the rotation component of the transformation matrix to only rotate around the X axis. More... | |
void | SetRotationComponentY (DataType angleY) |
Set the rotation component of the transformation matrix to only rotate around the Y axis. More... | |
void | SetRotationComponentZ (DataType angleZ) |
Set the rotation component of the transformation matrix to only rotate around the Z axis. More... | |
Vector< DataType > | GetEulerRotation () const |
Get the euler rotation angles. More... | |
void | SetRotationComponent (const Quaternion< DataType > &q) |
Set the rotation component by a quaternion. More... | |
void | SetRotationComponent (const Matrix< DataType > &rotationMatrix) |
Set the rotation component by a rotation matrix. More... | |
Matrix< DataType > | GetRotationAndScalingComponent () const |
Extract the rotation and scaling component of the matrix. More... | |
const Vector< DataType > & | GetColumnVector (UInt32 columnIndex) const |
Get the vector of a specified column. More... | |
void | SetColumnVector (UInt32 columnIndex, const Vector< DataType > &vec) |
Set a specified column by a vector. More... | |
Vector< DataType > | GetRowVector (UInt32 rowIndex) const |
Get the vector of a specified row. More... | |
void | SetRowVector (UInt32 rowIndex, const Vector< DataType > vec) |
Set a specified row by a vector. More... | |
void | MultiplySelf (const Matrix &m) |
In-place matrix-matrix multiplication. More... | |
void | MultiplySelfReverse (const Matrix &m) |
In-place reverse matrix-matrix multiplication. More... | |
void | TransposeSelf () |
In-place transpose of the matrix. | |
void | InvertSelf () |
In-place inversion of the matrix. | |
Vector< DataType > | Transform (const Vector< DataType > &v) const |
Transform (multiply) a vector by the matrix. More... | |
Vector< DataType > | Rotate (const Vector< DataType > &v) const |
Rotate a vector by the matrix. More... | |
Vector< DataType > | Translate (const Vector< DataType > &v) const |
Translate a vector by the matrix (add the translation component). More... | |
Matrix | Multiply (const Matrix &m) const |
Multiply a matrix by the matrix. More... | |
Vector< DataType > | Multiply (const Vector< DataType > &v) const |
Multiply a vector by the matrix. More... | |
Matrix | Transpose () const |
Get the transposed matrix. More... | |
Matrix | InvertTransRot () const |
Fast inversion of a rotation/translation matrix. More... | |
Matrix | InvertTransRotScl () const |
Fast inversion of a rotation/translation/scaling matrix. More... | |
Matrix | Invert () const |
Matrix inversion. More... | |
Vector< DataType > | Solve (const Vector< DataType > &v) const |
Solve the matrix by a vector. More... | |
void | SetElementAt (UInt32 row, UInt32 col, DataType value) |
Set a component element. More... | |
DataType | GetElementAt (UInt32 row, UInt32 col) const |
Get a component element. More... | |
DataType & | GetElementAt (UInt32 row, UInt32 col) |
Get a writeable reference to a component element. More... | |
void | SetElement (Component element, DataType value) |
Set a component element. More... | |
DataType | GetElement (Component element) const |
Get a component element. More... | |
DataType & | GetElement (Component element) |
Get a writeable reference to a component element. More... | |
void | SetXX (DataType value) |
Set the XX component. More... | |
void | SetXY (DataType value) |
Set the XY component. More... | |
void | SetXZ (DataType value) |
Set the XZ component. More... | |
void | SetXW (DataType value) |
Set the XW component. More... | |
void | SetYX (DataType value) |
Set the YX component. More... | |
void | SetYY (DataType value) |
Set the YY component. More... | |
void | SetYZ (DataType value) |
Set the YZ component. More... | |
void | SetYW (DataType value) |
Set the YW component. More... | |
void | SetZX (DataType value) |
Set the ZX component. More... | |
void | SetZY (DataType value) |
Set the ZY component. More... | |
void | SetZZ (DataType value) |
Set the ZZ component. More... | |
void | SetZW (DataType value) |
Set the ZW component. More... | |
void | SetWX (DataType value) |
Set the WX component. More... | |
void | SetWY (DataType value) |
Set the WY component. More... | |
void | SetWZ (DataType value) |
Set the WZ component. More... | |
void | SetWW (DataType value) |
Set the WW component. More... | |
DataType | GetXX () const |
Get the XX component. More... | |
DataType | GetXY () const |
Get the XY component. More... | |
DataType | GetXZ () const |
Get the XZ component. More... | |
DataType | GetXW () const |
Get the XW component. More... | |
DataType | GetYX () const |
Get the YX component. More... | |
DataType | GetYY () const |
Get the YY component. More... | |
DataType | GetYZ () const |
Get the YZ component. More... | |
DataType | GetYW () const |
Get the YW component. More... | |
DataType | GetZX () const |
Get the ZX component. More... | |
DataType | GetZY () const |
Get the ZY component. More... | |
DataType | GetZZ () const |
Get the ZZ component. More... | |
DataType | GetZW () const |
Get the ZW component. More... | |
DataType | GetWX () const |
Get the WX component. More... | |
DataType | GetWY () const |
Get the WY component. More... | |
DataType | GetWZ () const |
Get the WZ component. More... | |
DataType | GetWW () const |
Get the WW component. More... | |
Bool | IsEqual (const Matrix &m) const |
Check if the matrix is equal to a given matrix. More... | |
Bool | IsEqual (const Matrix &m, DataType epsilon) const |
Check if the matrix is equal to a given matrix. More... | |
Bool | IsIdentity () const |
Check if the matrix is equal to the identity matrix. More... | |
Bool | IsIdentity (DataType epsilon) const |
Check if the matrix is equal to the identity matrix. More... | |
String | ToString () const |
Get the string representation of the object. More... | |
SInt32 | GetCount () const |
Get the number of elements in the object. More... | |
Static Public Member Functions | |
static Matrix | LookAt (const Vector< DataType > ¢er, const Vector< DataType > &target, const Vector< DataType > &up) |
Create a look-at matrix from a given center point, target point and up vector. More... | |
Public Attributes | |
union { | |
DataType mComponents [NUM_COMPONENTS] | |
The components data array. | |
struct { | |
} | |
The components member struct. | |
}; | |
The components storage union overlaps the raw data array mComponents and the component structure. | |
Friends | |
bool | operator== (const Matrix< DataType > &lhs, const Matrix< DataType > &rhs) |
Equal to comparison operator. More... | |
bool | operator!= (const Matrix< DataType > &lhs, const Matrix< DataType > &rhs) |
Not equal to comparison operator. More... | |
Detailed Description
template<class DataType>
class Murl::Math::Matrix< DataType >
A 4x4 matrix class.
Member Enumeration Documentation
◆ Component
enum Murl::Math::Matrix::Component |
◆ ComponentMask
enum Murl::Math::Matrix::ComponentMask |
Enumeration of the components' bit masks.
◆ PredefinedType
enum Murl::Math::Matrix::PredefinedType |
Enumeration of the predefined initialization types for constructing a Matrix(PredefinedType type).
Enumerator | |
---|---|
UNINITIALIZED | Create an uninitialized instance. |
ZERO | Initialize with zero. |
IDENTITY | Initialize with the identity matrix. |
◆ HintFlags
enum Murl::Math::Matrix::HintFlags |
Enumeration of hint flags.
Hints are used internally to optimize several operations.
Constructor & Destructor Documentation
◆ Matrix() [1/3]
|
inline |
The default constructor, creating an identity matrix.
Hints are disabled by default.
References Murl::Math::Matrix< DataType >::SetIdentity().
◆ Matrix() [2/3]
|
inline |
Constructor to create a matrix from a predefined type.
Hints are disabled by default.
- Parameters
-
type The predefined type.
References Murl::Math::Matrix< DataType >::Clear(), Murl::Math::Matrix< DataType >::FLAG_NO_HINTS, Murl::Math::Matrix< DataType >::IDENTITY, Murl::Math::Matrix< DataType >::SetIdentity(), Murl::Math::Matrix< DataType >::UNINITIALIZED, and Murl::Math::Matrix< DataType >::ZERO.
◆ Matrix() [3/3]
|
inline |
The copy constructor using a Matrix of different type.
- Parameters
-
matrix The Matrix to copy.
References Murl::Math::Matrix< DataType >::GetPointer(), Murl::Math::Matrix< DataType >::mComponents, and Murl::Math::Matrix< DataType >::NUM_COMPONENTS.
Member Function Documentation
◆ LookAt()
|
inlinestatic |
Create a look-at matrix from a given center point, target point and up vector.
- Parameters
-
center The center point position vector. target The target point position vector. up The up direction vector.
- Returns
- The calculated matrix.
References Murl::Math::Vector< DataType >::Cross(), Murl::Math::Vector< DataType >::Normalize(), Murl::Math::Matrix< DataType >::SetWW(), Murl::Math::Matrix< DataType >::SetXX(), Murl::Math::Matrix< DataType >::SetXY(), Murl::Math::Matrix< DataType >::SetXZ(), Murl::Math::Matrix< DataType >::SetYX(), Murl::Math::Matrix< DataType >::SetYY(), Murl::Math::Matrix< DataType >::SetYZ(), Murl::Math::Matrix< DataType >::SetZX(), Murl::Math::Matrix< DataType >::SetZY(), Murl::Math::Matrix< DataType >::SetZZ(), Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, Murl::Math::Vector< DataType >::z, and Murl::Math::Matrix< DataType >::ZERO.
◆ GetHints()
|
inline |
Get the hint flags.
- Returns
- The bit-mask of hints.
◆ SetHints()
|
inline |
Set the hint flags.
- Parameters
-
mask The bit-mask of hints to set.
References Murl::Math::Matrix< DataType >::FLAG_NO_HINTS.
◆ ClearHints()
|
inline |
Clear hint flags.
- Parameters
-
mask The bit-mask of hints to clear.
References Murl::Math::Matrix< DataType >::FLAG_NO_HINTS.
◆ EnableHints()
|
inline |
Enable hints.
Enabling hints requires good knowlede of the entire Matrix class e.g. several setter methods do not consider hints.
- Parameters
-
autoDetect Evaluate the correct hints if true.
References Murl::Math::Matrix< DataType >::FLAG_ARBITRARY, Murl::Math::Matrix< DataType >::FLAG_ROTATION, Murl::Math::Matrix< DataType >::FLAG_SCALE, and Murl::Math::Matrix< DataType >::FLAG_TRANSLATION.
◆ operator[]() [1/2]
|
inline |
Get a component element.
- Parameters
-
index The component index, see enum Component.
- Returns
- The component value.
◆ operator[]() [2/2]
|
inline |
Get a writeable reference to a component element.
- Parameters
-
index The component index, see enum Component.
- Returns
- The component value reference.
◆ GetPointer() [1/2]
|
inline |
Get a const pointer to the raw data.
- Returns
- Const pointer to the raw data.
References Murl::Math::Matrix< DataType >::mComponents.
Referenced by Murl::Math::Matrix< DataType >::Matrix().
◆ GetPointer() [2/2]
|
inline |
Get a writeable pointer to the raw data.
- Returns
- Pointer to the raw data.
References Murl::Math::Matrix< DataType >::mComponents.
◆ operator*=()
|
inline |
In-place matrix-matrix multiplication operator.
- Parameters
-
m The matrix to multiply.
- Returns
- The object itself.
References Murl::Math::Matrix< DataType >::MultiplySelf().
◆ operator*() [1/2]
|
inline |
Matrix-matrix multiplication operator.
- Parameters
-
rhs The right hand side matrix.
- Returns
- The multiplied matrix.
References Murl::Math::Matrix< DataType >::Multiply().
◆ operator*() [2/2]
|
inline |
Matrix-vector multiplication operator.
- Parameters
-
rhs The right hand side vector.
- Returns
- The multiplied vector.
References Murl::Math::Matrix< DataType >::Multiply().
◆ Clear()
|
inline |
Clear all components of the matrix instance.
Set the component data array to zero.
References Murl::Math::Matrix< DataType >::FLAG_ARBITRARY, Murl::Math::Matrix< DataType >::FLAG_ROTATION, Murl::Math::Matrix< DataType >::FLAG_SCALE, Murl::Math::Matrix< DataType >::FLAG_TRANSLATION, Murl::Math::Matrix< DataType >::mComponents, and Murl::Util::MemSet().
Referenced by Murl::Math::Matrix< DataType >::Matrix().
◆ Set()
|
inline |
Copy the content of a source matrix to the matrix instance.
- Parameters
-
m The matrix to copy from.
Referenced by Murl::Math::Matrix< DataType >::InvertSelf(), Murl::Math::Matrix< DataType >::MultiplySelf(), and Murl::Math::Matrix< DataType >::MultiplySelfReverse().
◆ SetTranslationComponent() [1/2]
|
inline |
Set the translation component to a given vector.
- Parameters
-
v The vector to set the translation component.
◆ SetTranslationComponent() [2/2]
|
inline |
Set the translation component to given values.
- Parameters
-
x The X translation component. y The Y translation component. z The Z translation component.
References Murl::Math::Matrix< DataType >::FLAG_TRANSLATION.
◆ SetTranslationComponentX()
|
inline |
Set the translation X component.
- Parameters
-
x The X translation component.
References Murl::Math::Matrix< DataType >::FLAG_TRANSLATION.
◆ SetTranslationComponentY()
|
inline |
Set the translation Y component.
- Parameters
-
y The Y translation component.
References Murl::Math::Matrix< DataType >::FLAG_TRANSLATION.
◆ SetTranslationComponentZ()
|
inline |
Set the translation Z component.
- Parameters
-
z The Z translation component.
References Murl::Math::Matrix< DataType >::FLAG_TRANSLATION.
◆ GetTranslationComponent()
|
inline |
Get the translation component vector.
- Returns
- The translation component vector.
◆ GetTranslationComponentX()
|
inline |
Get the translation component's X value.
- Returns
- The X value.
◆ GetTranslationComponentY()
|
inline |
Get the translation component's Y value.
- Returns
- The Y value.
◆ GetTranslationComponentZ()
|
inline |
Get the translation component's Z value.
- Returns
- The Z value.
◆ SetScalingComponent() [1/2]
|
inline |
Set the scaling component using a vector.
This method only sets the upper 3 diagonal elements of the matrix, so it should only be applied to matrices without rotation.
- Parameters
-
v The vector containing X, Y and Z scaling components.
◆ SetScalingComponent() [2/2]
|
inline |
Set the scaling component using three distinct values.
This method only sets the upper 3 diagonal elements of the matrix, so it should only be applied to matrices without rotation.
- Parameters
-
x The X scaling factor. y The Y scaling factor. z The Z scaling factor.
References Murl::Math::Matrix< DataType >::FLAG_SCALE.
◆ GetScalingComponent()
|
inline |
Get a vector containing the X, Y and Z scaling components of the matrix.
- Returns
- The scaling components.
References Murl::Math::Sqrt(), and Murl::Math::Vector< DataType >::x.
◆ GetScalingComponentX()
|
inline |
◆ GetScalingComponentY()
|
inline |
◆ GetScalingComponentZ()
|
inline |
◆ SetRotationComponent() [1/5]
|
inline |
Set the rotation component by a vector.
- Parameters
-
axisAngle The vector of the rotation including the angle in w component in radiants.
References Murl::Math::Matrix< DataType >::SetRotationComponentAxisAngle(), Murl::Math::Vector< DataType >::w, Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, and Murl::Math::Vector< DataType >::z.
◆ SetRotationComponent() [2/5]
|
inline |
Set the rotation component by an angle and vector.
- Parameters
-
angle The angle of the rotation in radiants. axis The vector of the rotation.
References Murl::Math::Matrix< DataType >::SetRotationComponentAxisAngle(), Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, and Murl::Math::Vector< DataType >::z.
◆ SetRotationComponentAxisAngle()
|
inline |
Set the rotation component by an angle and vector components.
- Parameters
-
angle The angle of the rotation in radiants. ax The x-component of the rotation vector. ay The y-component of the rotation vector. az The z-component of the rotation vector.
References Murl::Math::Cos(), Murl::Math::Matrix< DataType >::FLAG_ROTATION, Murl::Math::Matrix< DataType >::FLAG_SCALE, Murl::Math::Matrix< DataType >::SetIdentityRotation(), and Murl::Math::Sin().
Referenced by Murl::Math::Matrix< DataType >::SetRotationComponent().
◆ SetRotationComponent() [3/5]
|
inline |
Set the rotation component by euler angles.
The default axis rotation order is IEnums::ROTATION_ORDER_ZYX.
- Parameters
-
angleX The x-axis angle in radiants. angleY The y-axis angle in radiants. angleZ The z-axis angle in radiants.
References Murl::IEnums::ROTATION_ORDER_ZYX, and Murl::Math::Matrix< DataType >::SetRotationComponentXYZ().
◆ SetRotationComponentXYZ() [1/2]
|
inline |
Set the rotation component by euler angles with a given rotation order.
- Parameters
-
angles A vector containing the X, Y and Z angles in radiants. rotationOrder The axis rotation order.
References Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, and Murl::Math::Vector< DataType >::z.
Referenced by Murl::Math::Matrix< DataType >::SetRotationComponent().
◆ SetRotationComponentXYZ() [2/2]
|
inline |
Set the rotation component by euler angles with a given rotation order.
- Parameters
-
angleX The x-axis angle in radiants. angleY The y-axis angle in radiants. angleZ The z-axis angle in radiants. rotationOrder The axis rotation order.
References Murl::Math::Cos(), Murl::Math::Matrix< DataType >::FLAG_ROTATION, Murl::Math::Matrix< DataType >::FLAG_SCALE, Murl::IEnums::ROTATION_ORDER_XYZ, Murl::IEnums::ROTATION_ORDER_XZY, Murl::IEnums::ROTATION_ORDER_YXZ, Murl::IEnums::ROTATION_ORDER_YZX, Murl::IEnums::ROTATION_ORDER_ZXY, Murl::IEnums::ROTATION_ORDER_ZYX, Murl::Math::Matrix< DataType >::SetIdentityRotation(), and Murl::Math::Sin().
◆ SetRotationComponentX()
|
inline |
Set the rotation component of the transformation matrix to only rotate around the X axis.
This method directly overwrites the upper 3x3 matrix of the internal transformation by calculating and applying a rotation around the unit X axis. The angle value must be given in radians. A positive value result in a clockwise rotation.
- Parameters
-
angleX The x-axis angle in radiants.
References Murl::Math::Cos(), Murl::Math::Matrix< DataType >::FLAG_ROTATION, Murl::Math::Matrix< DataType >::FLAG_SCALE, Murl::Math::Matrix< DataType >::SetIdentityRotation(), and Murl::Math::Sin().
◆ SetRotationComponentY()
|
inline |
Set the rotation component of the transformation matrix to only rotate around the Y axis.
This method directly overwrites the upper 3x3 matrix of the internal transformation by calculating and applying a rotation around the unit Y axis. The angle value must be given in radians. A positive value result in a clockwise rotation.
- Parameters
-
angleY The y-axis angle in radiants.
References Murl::Math::Cos(), Murl::Math::Matrix< DataType >::FLAG_ROTATION, Murl::Math::Matrix< DataType >::FLAG_SCALE, Murl::Math::Matrix< DataType >::SetIdentityRotation(), and Murl::Math::Sin().
◆ SetRotationComponentZ()
|
inline |
Set the rotation component of the transformation matrix to only rotate around the Z axis.
This method directly overwrites the upper 3x3 matrix of the internal transformation by calculating and applying a rotation around the unit Z axis. The angle value must be given in radians. A positive value result in a clockwise rotation.
- Parameters
-
angleZ The z-axis angle in radiants.
References Murl::Math::Cos(), Murl::Math::Matrix< DataType >::FLAG_ROTATION, Murl::Math::Matrix< DataType >::FLAG_SCALE, Murl::Math::Matrix< DataType >::SetIdentityRotation(), and Murl::Math::Sin().
◆ GetEulerRotation()
|
inline |
Get the euler rotation angles.
Extract the euer rotation angles based on https://d3cw3dd2w32x2b.cloudfront.net/wp-content/uploads/2012/07/euler-angles.pdf
- Returns
- The euler rotation angles in radiants. The vector members x, y and z corresponds to the axis angles.
References Murl::Math::ArcTan2(), Murl::Math::Cos(), Murl::Math::Sin(), Murl::Math::Sqrt(), Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, and Murl::Math::Vector< DataType >::z.
◆ SetRotationComponent() [4/5]
|
inline |
Set the rotation component by a quaternion.
- Parameters
-
q The quaternion.
References Murl::Math::Matrix< DataType >::FLAG_ROTATION, and Murl::Math::Matrix< DataType >::FLAG_SCALE.
◆ SetRotationComponent() [5/5]
|
inline |
Set the rotation component by a rotation matrix.
- Parameters
-
rotationMatrix The rotation matrix.
References Murl::Math::Matrix< DataType >::FLAG_ROTATION, and Murl::Math::Matrix< DataType >::FLAG_SCALE.
◆ GetRotationAndScalingComponent()
|
inline |
Extract the rotation and scaling component of the matrix.
- Returns
- A matrix containing only scaling and rotation.
References Murl::Math::Matrix< DataType >::FLAG_TRANSLATION.
◆ GetColumnVector()
|
inline |
Get the vector of a specified column.
- Parameters
-
columnIndex The column index in range [0 .. 3].
- Returns
- The vector of the colum at the specified index.
◆ SetColumnVector()
|
inline |
Set a specified column by a vector.
Hints are not considered.
- Parameters
-
columnIndex The column index in range [0 .. 3]. vec The vector to set the colum at the specified index.
◆ GetRowVector()
|
inline |
Get the vector of a specified row.
- Parameters
-
rowIndex The row index in range [0 .. 3].
- Returns
- The vector of the row at the specified index.
◆ SetRowVector()
|
inline |
Set a specified row by a vector.
Hints are not considered.
- Parameters
-
rowIndex The row index in range [0 .. 3]. vec The vector to set the row at the specified index.
◆ MultiplySelf()
|
inline |
In-place matrix-matrix multiplication.
- Parameters
-
m The matrix to multiply.
References Murl::Math::Matrix< DataType >::Multiply(), and Murl::Math::Matrix< DataType >::Set().
Referenced by Murl::Math::Matrix< DataType >::operator*=().
◆ MultiplySelfReverse()
|
inline |
In-place reverse matrix-matrix multiplication.
- Parameters
-
m The matrix to multiply.
References Murl::Math::Matrix< DataType >::Multiply(), and Murl::Math::Matrix< DataType >::Set().
◆ Transform()
|
inline |
Transform (multiply) a vector by the matrix.
- Parameters
-
v The vector to mulitply.
- Returns
- The multiplied vector.
References Murl::Math::Matrix< DataType >::Multiply().
◆ Rotate()
|
inline |
Rotate a vector by the matrix.
- Parameters
-
v The vector to rotate.
- Returns
- The rotated vector.
References Murl::Math::Vector< DataType >::w, Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, and Murl::Math::Vector< DataType >::z.
◆ Translate()
|
inline |
Translate a vector by the matrix (add the translation component).
- Parameters
-
v The vector to translate.
- Returns
- The translated vector.
◆ Multiply() [1/2]
|
inline |
Multiply a matrix by the matrix.
- Parameters
-
m The matrix to mulitply.
- Returns
- The multiplied matrix.
References Murl::Math::Matrix< DataType >::FLAG_TRANSLATION, and Murl::Math::Matrix< DataType >::UNINITIALIZED.
Referenced by Murl::Math::Matrix< DataType >::MultiplySelf(), Murl::Math::Matrix< DataType >::MultiplySelfReverse(), Murl::Math::Matrix< DataType >::operator*(), and Murl::Math::Matrix< DataType >::Transform().
◆ Multiply() [2/2]
|
inline |
Multiply a vector by the matrix.
- Parameters
-
v The vector to mulitply.
- Returns
- The multiplied vector.
References Murl::Math::Matrix< DataType >::FLAG_TRANSLATION, Murl::Math::Vector< DataType >::w, Murl::Math::Vector< DataType >::x, Murl::Math::Vector< DataType >::y, and Murl::Math::Vector< DataType >::z.
◆ Transpose()
|
inline |
Get the transposed matrix.
- Returns
- The transposed matrix.
References Murl::Math::Matrix< DataType >::FLAG_ARBITRARY.
◆ InvertTransRot()
|
inline |
Fast inversion of a rotation/translation matrix.
This method can be used to quickly invert a given matrix that is only made up from rotation and translation operations. If the matrix also contains any scaling operations, use InvertTransRotScl() instead. For general 4x4 matrices, use Invert().
- Returns
- The inverted rotation/translation matrix.
◆ InvertTransRotScl()
|
inline |
Fast inversion of a rotation/translation/scaling matrix.
This method can be used to quickly invert a given matrix that is only made up from rotation, translation and scaling operations. If only rotation and translation is present, use InvertTransRot(). For general 4x4 matrices, use Invert() instead.
- Returns
- The inverted rotation/translation/scaling matrix.
◆ Invert()
|
inline |
Matrix inversion.
This method can be used to calculate the inverse of a general 4x4 matrix. In case the matrix is only made up from rotation and translation operations, it is possible to use InvertTransRot() instead. If it also contains additional scaling operations, InvertTransRotScl() can be used; both alternative methods show better overall performance.
- Returns
- The inverted matrix.
References Murl::Math::Abs(), Murl::Math::Limits< DataType >::Epsilon(), Murl::Math::Matrix< DataType >::FLAG_ARBITRARY, Murl::Math::Matrix< DataType >::GetElementAt(), and Murl::Math::Matrix< DataType >::SetElementAt().
Referenced by Murl::Math::Matrix< DataType >::InvertSelf().
◆ Solve()
|
inline |
Solve the matrix by a vector.
- Parameters
-
v The vector to solve.
- Returns
- The solved vector.
References Murl::Math::Abs(), Murl::Math::Limits< DataType >::Epsilon(), Murl::Math::Matrix< DataType >::GetElementAt(), and Murl::Math::Vector< DataType >::mComponents.
◆ SetElementAt()
|
inline |
Set a component element.
Hints are not considered.
- Parameters
-
row The row in range [0 .. 3]. col The column in range [0 .. 3]. value The value to set.
Referenced by Murl::Math::Matrix< DataType >::Invert().
◆ GetElementAt() [1/2]
|
inline |
Get a component element.
- Parameters
-
row The row in range [0 .. 3]. col The column in range [0 .. 3].
- Returns
- The value at the given position.
Referenced by Murl::Math::Matrix< DataType >::Invert(), and Murl::Math::Matrix< DataType >::Solve().
◆ GetElementAt() [2/2]
|
inline |
Get a writeable reference to a component element.
- Parameters
-
row The row in range [0 .. 3]. col The column in range [0 .. 3].
- Returns
- The value at the given position.
◆ SetElement()
|
inline |
Set a component element.
Hints are not considered.
- Parameters
-
element The element value The value to set.
◆ GetElement() [1/2]
|
inline |
Get a component element.
- Parameters
-
element The element's component.
- Returns
- The value at the given position.
◆ GetElement() [2/2]
|
inline |
Get a writeable reference to a component element.
- Parameters
-
element The element's component.
- Returns
- The value at the given position.
◆ SetXX()
|
inline |
Set the XX component.
Hints are not considered.
- Parameters
-
value The XX component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetXY()
|
inline |
Set the XY component.
Hints are not considered.
- Parameters
-
value The XY component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetXZ()
|
inline |
Set the XZ component.
Hints are not considered.
- Parameters
-
value The XZ component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetXW()
|
inline |
Set the XW component.
Hints are not considered.
- Parameters
-
value The XW component value to set.
◆ SetYX()
|
inline |
Set the YX component.
Hints are not considered.
- Parameters
-
value The YX component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetYY()
|
inline |
Set the YY component.
Hints are not considered.
- Parameters
-
value The YY component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetYZ()
|
inline |
Set the YZ component.
Hints are not considered.
- Parameters
-
value The YZ component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetYW()
|
inline |
Set the YW component.
Hints are not considered.
- Parameters
-
value The YW component value to set.
◆ SetZX()
|
inline |
Set the ZX component.
Hints are not considered.
- Parameters
-
value The ZX component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetZY()
|
inline |
Set the ZY component.
Hints are not considered.
- Parameters
-
value The ZY component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetZZ()
|
inline |
Set the ZZ component.
Hints are not considered.
- Parameters
-
value The ZZ component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ SetZW()
|
inline |
Set the ZW component.
Hints are not considered.
- Parameters
-
value The ZW component value to set.
◆ SetWX()
|
inline |
Set the WX component.
Hints are not considered.
- Parameters
-
value The WX component value to set.
◆ SetWY()
|
inline |
Set the WY component.
Hints are not considered.
- Parameters
-
value The WY component value to set.
◆ SetWZ()
|
inline |
Set the WZ component.
Hints are not considered.
- Parameters
-
value The WZ component value to set.
◆ SetWW()
|
inline |
Set the WW component.
Hints are not considered.
- Parameters
-
value The WW component value to set.
Referenced by Murl::Math::Matrix< DataType >::LookAt().
◆ GetXX()
|
inline |
Get the XX component.
- Returns
- The XX component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetXY()
|
inline |
Get the XY component.
- Returns
- The XY component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetXZ()
|
inline |
Get the XZ component.
- Returns
- The XZ component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetXW()
|
inline |
Get the XW component.
- Returns
- The XW component value.
Referenced by Murl::Math::Frustum< DataType >::Set().
◆ GetYX()
|
inline |
Get the YX component.
- Returns
- The YX component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetYY()
|
inline |
Get the YY component.
- Returns
- The YY component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetYZ()
|
inline |
Get the YZ component.
- Returns
- The YZ component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetYW()
|
inline |
Get the YW component.
- Returns
- The YW component value.
Referenced by Murl::Math::Frustum< DataType >::Set().
◆ GetZX()
|
inline |
Get the ZX component.
- Returns
- The ZX component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetZY()
|
inline |
Get the ZY component.
- Returns
- The ZY component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetZZ()
|
inline |
Get the ZZ component.
- Returns
- The ZZ component value.
Referenced by Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Frustum< DataType >::Set().
◆ GetZW()
|
inline |
Get the ZW component.
- Returns
- The ZW component value.
Referenced by Murl::Math::Frustum< DataType >::Set().
◆ GetWX()
|
inline |
Get the WX component.
- Returns
- The WX component value.
Referenced by Murl::Math::Frustum< DataType >::Set().
◆ GetWY()
|
inline |
Get the WY component.
- Returns
- The WY component value.
Referenced by Murl::Math::Frustum< DataType >::Set().
◆ GetWZ()
|
inline |
Get the WZ component.
- Returns
- The WZ component value.
Referenced by Murl::Math::Frustum< DataType >::Set().
◆ GetWW()
|
inline |
Get the WW component.
- Returns
- The WW component value.
Referenced by Murl::Math::Frustum< DataType >::Set().
◆ IsEqual() [1/2]
|
inline |
Check if the matrix is equal to a given matrix.
Compares all values within the default epsilon range Limits::Epsilon().
- Parameters
-
m The matrix to compare.
- Returns
- true if all components are exactly the same.
Referenced by Murl::Math::Matrix< DataType >::IsIdentity().
◆ IsEqual() [2/2]
|
inline |
Check if the matrix is equal to a given matrix.
Compares all values within a given epsilon range.
- Parameters
-
m The matrix to compare. epsilon The epsilon to compare.
- Returns
- true if equal.
References Murl::Math::Abs(), Murl::Math::Matrix< DataType >::mComponents, and Murl::Math::Matrix< DataType >::NUM_COMPONENTS.
◆ IsIdentity() [1/2]
|
inline |
Check if the matrix is equal to the identity matrix.
Performs a test without an epsilon range.
- Returns
- true if equal.
References Murl::Math::StaticMatrix< DataType >::Identity().
◆ IsIdentity() [2/2]
|
inline |
Check if the matrix is equal to the identity matrix.
Compares all values within a given epsilon range.
- Parameters
-
epsilon The epsilon to compare.
- Returns
- true if equal.
References Murl::Math::Matrix< DataType >::IsEqual().
◆ ToString()
|
inline |
Get the string representation of the object.
- Returns
- The string representation of the object.
References Murl::Util::PrintToString().
◆ GetCount()
|
inline |
Get the number of elements in the object.
- Returns
- The number of elements in the object.
References Murl::Math::Matrix< DataType >::NUM_COMPONENTS.
Friends And Related Function Documentation
◆ operator==
|
friend |
Equal to comparison operator.
Performs a test without an epsilon range, which can be used for detecting changes i.e. DoubleBuffer<Matrix> class. To compare within an epsilon range use Matrix::IsEqual().
- Parameters
-
lhs The left hand side matrix to compare. rhs The right hand side matrix to compare.
- Returns
- true if all components are exactly the same.
◆ operator!=
|
friend |
Not equal to comparison operator.
Performs a test without an epsilon range, which can be used for detecting changes i.e. DoubleBuffer<Matrix> class. To compare within an epsilon range use Matrix::IsEqual().
- Parameters
-
lhs The left hand side matrix to compare. rhs The right hand side matrix to compare.
- Returns
- true if all components are not exactly the same.
The documentation for this class was generated from the following files:
- murl_app_types.h
- murl_math_matrix.h