Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::MatrixMxN Class Referencefinal

Matrix with ROW_COUNT rows and COL_COUNT columns. More...

#include <MatrixMxN.h>

Public Member Functions

 AZ_TYPE_INFO (MatrixMxN, "{B751D885-87D0-40BF-A6B3-48EFF0147AFA}")
 
 MatrixMxN ()=default
 Default constructor for reflection and serialization support.
 
 MatrixMxN (AZStd::size_t rowCount, AZStd::size_t colCount)
 Default constructor does not initialize the matrix.
 
 MatrixMxN (AZStd::size_t rowCount, AZStd::size_t colCount, float value)
 Constructs a matrix with all components set to the specified value.
 
 MatrixMxN (const MatrixMxN &rhs)=default
 
 MatrixMxN (MatrixMxN &&rhs)
 
MatrixMxNoperator= (MatrixMxN &&)=default
 
MatrixMxNoperator= (const MatrixMxN &)=default
 
AZStd::size_t GetRowCount () const
 Returns the number of rows in the matrix.
 
AZStd::size_t GetColumnCount () const
 Returns the number of columns in the matrix.
 
void Resize (AZStd::size_t rowCount, AZStd::size_t colCount)
 Resizes the matrix to the provided row and column count.
 
float operator() (AZStd::size_t row, AZStd::size_t col) const
 Indexed access using operator().
 
MatrixMxN GetTranspose () const
 Returns the transpose of the matrix.
 
MatrixMxN GetAbs () const
 Returns a new MatrixMxN containing the absolute value of all elements in the source MatrixMxN.
 
MatrixMxN GetSquare () const
 Returns a new MatrixMxN containing the square of all elements in the source MatrixMxN.
 
void SetZero ()
 Quickly zeros all elements of the matrix to create a zero matrix.
 
AZStd::size_t GetRowGroups () const
 Returns the number blocks of 4x4 submatrices that span all the rows of the matrix.
 
AZStd::size_t GetColumnGroups () const
 Returns the number blocks of 4x4 submatrices that span all the columns of the matrix.
 
void FixUnusedElements ()
 Zeros out unused components of any submatrices.
 
float GetElement (AZStd::size_t row, AZStd::size_t col) const
 
void SetElement (AZStd::size_t row, AZStd::size_t col, float value)
 
MatrixMxN GetFloor () const
 
MatrixMxN GetCeil () const
 
MatrixMxN GetRound () const
 
MatrixMxN GetMin (const MatrixMxN &m) const
 
MatrixMxN GetMax (const MatrixMxN &m) const
 
MatrixMxN GetClamp (const MatrixMxN &min, const MatrixMxN &max) const
 
MatrixMxN operator- () const
 
MatrixMxN operator+ (const MatrixMxN &rhs) const
 
MatrixMxN operator- (const MatrixMxN &rhs) const
 
MatrixMxN operator* (const MatrixMxN &rhs) const
 
MatrixMxN operator* (float multiplier) const
 
MatrixMxN operator/ (float divisor) const
 
MatrixMxNoperator+= (const MatrixMxN &rhs)
 
MatrixMxNoperator-= (const MatrixMxN &rhs)
 
MatrixMxNoperator+= (float sum)
 
MatrixMxNoperator-= (float difference)
 
MatrixMxNoperator*= (float multiplier)
 
MatrixMxNoperator/= (float divisor)
 
const Matrix4x4GetSubmatrix (AZStd::size_t rowGroup, AZStd::size_t colGroup) const
 
Matrix4x4GetSubmatrix (AZStd::size_t rowGroup, AZStd::size_t colGroup)
 
void SetSubmatrix (AZStd::size_t rowGroup, AZStd::size_t colGroup, const Matrix4x4 &subMatrix)
 
AZStd::vector< Matrix4x4 > & GetMatrixElements ()
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 
static MatrixMxN CreateZero (AZStd::size_t rowCount, AZStd::size_t colCount)
 Creates an M by N matrix with all elements set to zero.
 
static MatrixMxN CreateFromPackedFloats (AZStd::size_t rowCount, AZStd::size_t colCount, const float *inputs)
 
static MatrixMxN CreateRandom (AZStd::size_t rowCount, AZStd::size_t colCount)
 Creates an M by N matrix with all elements set to random numbers in the range [0, 1).
 

Detailed Description

Matrix with ROW_COUNT rows and COL_COUNT columns.

Member Function Documentation

◆ CreateFromPackedFloats()

AZ_MATH_INLINE MatrixMxN AZ::MatrixMxN::CreateFromPackedFloats ( AZStd::size_t  rowCount,
AZStd::size_t  colCount,
const float *  inputs 
)
static

Creates an M by N matrix and loads the initial values from the packed float array. This assumes no padding of input elements to satisfy the 4x4 blocked matrix structure.

◆ GetElement()

AZ_MATH_INLINE float AZ::MatrixMxN::GetElement ( AZStd::size_t  row,
AZStd::size_t  col 
) const

Indexed accessor functions.

◆ GetFloor()

AZ_MATH_INLINE MatrixMxN AZ::MatrixMxN::GetFloor ( ) const

Floor/Ceil/Round functions, operate on each component individually, result will be a new MatrixMxN.

◆ GetMin()

AZ_MATH_INLINE MatrixMxN AZ::MatrixMxN::GetMin ( const MatrixMxN m) const

Min/Max functions, operate on each component individually, result will be a new MatrixMxN.

◆ GetSubmatrix()

AZ_MATH_INLINE const Matrix4x4 & AZ::MatrixMxN::GetSubmatrix ( AZStd::size_t  rowGroup,
AZStd::size_t  colGroup 
) const

Gets and sets individual 4x4 submatrices within the larger matrix.

◆ operator-()

AZ_MATH_INLINE MatrixMxN AZ::MatrixMxN::operator- ( ) const

Aside from multiplication, these operators perform basic arithmetic on the individual elements within the respective matrices.

◆ Reflect()

static void AZ::MatrixMxN::Reflect ( ReflectContext context)
static

AzCore Reflection.

Parameters
contextreflection context

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