Plasma Engine  2.0
Loading...
Searching...
No Matches
plMat3Template< Type > Class Template Reference

A 3x3 component matrix class. More...

#include <Mat3.h>

Public Types

using ComponentType = Type
 

Public Member Functions

 PL_DECLARE_POD_TYPE ()
 
PL_ALWAYS_INLINE Type & Element (plInt32 iColumn, plInt32 iRow)
 
PL_ALWAYS_INLINE Type Element (plInt32 iColumn, plInt32 iRow) const
 
 plMat3Template ()
 Default Constructor DOES NOT INITIALIZE the matrix, at all.
 
void GetAsArray (Type *out_pData, plMatrixLayout::Enum layout) const
 Copies the 9 values of this matrix into the given array. 'layout' defines whether the data should end up in column-major or row-major format.
 
void SetZero ()
 Sets all elements to zero.
 
void SetIdentity ()
 Sets all elements to zero, except the diagonal, which is set to one.
 
void Transpose ()
 Transposes this matrix.
 
const plMat3Template< Type > GetTranspose () const
 Returns the transpose of this matrix.
 
plResult Invert (Type fEpsilon=plMath::SmallEpsilon< Type >())
 Inverts this matrix. Return value indicates whether the matrix could be Inverted.
 
const plMat3Template< Type > GetInverse (Type fEpsilon=plMath::SmallEpsilon< Type >()) const
 Returns the inverse of this matrix.
 
bool IsZero (Type fEpsilon=plMath::DefaultEpsilon< Type >()) const
 Checks whether all elements are zero.
 
bool IsIdentity (Type fEpsilon=plMath::DefaultEpsilon< Type >()) const
 Checks whether this is an identity matrix.
 
bool IsValid () const
 Checks whether all components are finite numbers.
 
bool IsNaN () const
 Checks whether any component is NaN.
 
plVec3Template< Type > GetRow (plUInt32 uiRow) const
 Returns all 3 components of the i-th row.
 
void SetRow (plUInt32 uiRow, const plVec3Template< Type > &vRow)
 Sets all 3 components of the i-th row.
 
plVec3Template< Type > GetColumn (plUInt32 uiColumn) const
 Returns all 3 components of the i-th column.
 
void SetColumn (plUInt32 uiColumn, const plVec3Template< Type > &vColumn)
 Sets all 3 components of the i-th column.
 
plVec3Template< Type > GetDiagonal () const
 Returns all 3 components on the diagonal of the matrix.
 
void SetDiagonal (const plVec3Template< Type > &vDiag)
 Sets all 3 components on the diagonal of the matrix.
 
const plVec3Template< Type > GetScalingFactors () const
 Returns the 3 scaling factors that are encoded in the matrix.
 
plResult SetScalingFactors (const plVec3Template< Type > &vXYZ, Type fEpsilon=plMath::DefaultEpsilon< Type >())
 Tries to set the three scaling factors in the matrix. Returns PL_FAILURE if the matrix columns cannot be normalized and thus no rescaling is possible.
 
Type GetDeterminant () const
 Computes the determinant of the matrix.
 
const plVec3Template< Type > TransformDirection (const plVec3Template< Type > &v) const
 Matrix-vector multiplication, assuming the 4th component of the vector is zero. So, rotation/scaling only. Useful as an optimization.
 
void operator*= (Type f)
 Component-wise multiplication (commutative)
 
void operator/= (Type f)
 Component-wise division.
 
bool IsIdentical (const plMat3Template< Type > &rhs) const
 Equality Check.
 
bool IsEqual (const plMat3Template< Type > &rhs, Type fEpsilon) const
 Equality Check with epsilon.
 

Static Public Member Functions

static plMat3Template< Type > MakeZero ()
 Returns a zero matrix.
 
static plMat3Template< Type > MakeIdentity ()
 Returns an identity matrix.
 
static plMat3Template< Type > MakeFromRowMajorArray (const Type *const pData)
 Creates a matrix from 9 values that are in row-major layout.
 
static plMat3Template< Type > MakeFromColumnMajorArray (const Type *const pData)
 Creates a matrix from 9 values that are in column-major layout.
 
static plMat3Template< Type > MakeFromValues (Type c1r1, Type c2r1, Type c3r1, Type c1r2, Type c2r2, Type c3r2, Type c1r3, Type c2r3, Type c3r3)
 Creates a matrix from 9 values. Naming is "column-n row-m".
 
static plMat3Template< Type > MakeScaling (const plVec3Template< Type > &vScale)
 Creates a matrix with all zero values, except along the diagonal, which is set to x,y,z.
 
static plMat3Template< Type > MakeRotationX (plAngle angle)
 Creates a matrix that is a rotation matrix around the X-axis.
 
static plMat3Template< Type > MakeRotationY (plAngle angle)
 Creates a matrix that is a rotation matrix around the Y-axis.
 
static plMat3Template< Type > MakeRotationZ (plAngle angle)
 Creates a matrix that is a rotation matrix around the Z-axis.
 
static plMat3Template< Type > MakeAxisRotation (const plVec3Template< Type > &vAxis, plAngle angle)
 Creates a matrix that is a rotation matrix around the given axis.
 

Public Attributes

Type m_fElementsCM [9]
 The matrix as a 9-element Type array (column-major)
 

Detailed Description

template<typename Type>
class plMat3Template< Type >

A 3x3 component matrix class.


The documentation for this class was generated from the following files: