Matrix4f Class Reference

Represents a generic 4*4 matrix. More...

Functions

 Matrix4f ()
 Matrix4f default constructor. More...
 
 Matrix4f (float data[])
 Matrix4f copy constructor (deep copy). More...
 
 Matrix4f (const Matrix4f &mat)
 Matrix4f copy constructor (deep copy). More...
 
Matrix4f operator* (const Matrix4f &mat) const
 
Matrix4f operator* (const Vector4< float > &vect) const
 
Matrix4f operator* (const float &scalar) const
 
Matrix4f operator+ (const Matrix4f &mat) const
 
Matrix4f operator+ (const float &scalar) const
 
Matrix4f operator- (const Matrix4f &mat) const
 
Matrix4f operator- (const float &scalar) const
 
bool operator== (const Matrix4f &mat) const
 
bool operator!= (const Matrix4f &mat) const
 
float & operator() (int u, int v)
 Gets access to a specific point in the Matrix4f (read / write). More...
 
ERROR_CODE inverse ()
 Sets the Matrix4f to its inverse. More...
 
void transpose ()
 Sets the Matrix4f to its transpose. More...
 
void setIdentity ()
 Sets the Matrix4f to identity. More...
 
void setZeros ()
 Sets the Matrix4f to zero. More...
 
ERROR_CODE setSubMatrix3f (Matrix3f input, int row=0, int column=0)
 Sets a 3x3 Matrix inside the Matrix4f. More...
 
ERROR_CODE setSubVector3f (Vector3< float > input, int column=3)
 Sets a 3x1 Vector inside the Matrix4f at the specified column index. More...
 
ERROR_CODE setSubVector4f (Vector4< float > input, int column=3)
 Sets a 4x1 Vector inside the Matrix4f at the specified column index. More...
 
String getInfos ()
 Returns the components of the Matrix4f in a String. More...
 

Static Functions

static Matrix4f inverse (const Matrix4f &mat)
 Creates the inverse of a Matrix4f. More...
 
static Matrix4f transpose (const Matrix4f &mat)
 Creates the transpose of a Matrix4f. More...
 
static Matrix4f identity ()
 Creates an identity Matrix4f. More...
 
static Matrix4f zeros ()
 Creates a Matrix4f filled with zeros. More...
 

Attributes

String matrix_name
 Name of the matrix (optional). More...
 

Detailed Description

Represents a generic 4*4 matrix.

It is defined in a row-major order, it means that, in the value buffer, the entire first row is stored first, followed by the entire second row, and so on. You can access the data by the 'm' ptr or by the element attribute.

r00 r01 r02 tx
r10 r11 r12 ty
r20 r21 r22 tz
m30 m31 m32 m33

Constructor and Destructor

◆ Matrix4f() [1/3]

Matrix4f ( )

Matrix4f default constructor.

◆ Matrix4f() [2/3]

Matrix4f ( float  data[])

Matrix4f copy constructor (deep copy).

◆ Matrix4f() [3/3]

Matrix4f ( const Matrix4f mat)

Matrix4f copy constructor (deep copy).

Parameters
mat: the Matrix4f to copy.

Functions

◆ operator*() [1/3]

Matrix4f operator* ( const Matrix4f mat) const

brief Gives the result of the multiplication between two Matrix4f.

◆ operator*() [2/3]

Matrix4f operator* ( const Vector4< float > &  vect) const

brief Gives the result of the multiplication between a Matrix4f and a float4.

◆ operator*() [3/3]

Matrix4f operator* ( const float &  scalar) const

brief Gives the result of the multiplication between a Matrix4f and a scalar.

◆ operator+() [1/2]

Matrix4f operator+ ( const Matrix4f mat) const

brief Gives the result of the addition between two Matrix4f.

◆ operator+() [2/2]

Matrix4f operator+ ( const float &  scalar) const

brief Gives the result of the addition between a Matrix4f and a scalar.

◆ operator-() [1/2]

Matrix4f operator- ( const Matrix4f mat) const

brief Gives the result of the subtraction between two Matrix4f.

◆ operator-() [2/2]

Matrix4f operator- ( const float &  scalar) const

brief Gives the result of the subtraction between a Matrix4f and a scalar.

◆ operator==()

bool operator== ( const Matrix4f mat) const

brief Tests two Matrix4f equality.

◆ operator!=()

bool operator!= ( const Matrix4f mat) const

brief Tests two Matrix4f inequality.

◆ operator()()

float& operator() ( int  u,
int  v 
)

Gets access to a specific point in the Matrix4f (read / write).

Parameters
u: specify the row.
v: specify the column.
Returns
The value at the u, v coordinates.

◆ inverse() [1/2]

ERROR_CODE inverse ( )

Sets the Matrix4f to its inverse.

Returns
SUCCESS if the inverse has been computed, ERROR_CODE.FAILURE is not (det = 0).

◆ inverse() [2/2]

static Matrix4f inverse ( const Matrix4f mat)
static

Creates the inverse of a Matrix4f.

Parameters
mat: the Matrix4f to compute the inverse from.
Returns
The inverse of the given Matrix4f.

◆ transpose() [1/2]

void transpose ( )

Sets the Matrix4f to its transpose.

◆ transpose() [2/2]

static Matrix4f transpose ( const Matrix4f mat)
static

Creates the transpose of a Matrix4f.

Parameters
mat: the Matrix4f to compute the transpose from.
Returns
The transpose of the given Matrix4f.

◆ setIdentity()

void setIdentity ( )

Sets the Matrix4f to identity.

◆ identity()

static Matrix4f identity ( )
static

Creates an identity Matrix4f.

Returns
A Matrix4f set to identity.

◆ setZeros()

void setZeros ( )

Sets the Matrix4f to zero.

◆ zeros()

static Matrix4f zeros ( )
static

Creates a Matrix4f filled with zeros.

Returns
A Matrix4f set to zero.

◆ setSubMatrix3f()

ERROR_CODE setSubMatrix3f ( Matrix3f  input,
int  row = 0,
int  column = 0 
)

Sets a 3x3 Matrix inside the Matrix4f.

Note
Can be used to set the rotation matrix when the matrix4f is a pose or an isometric matrix.
Parameters
input: sub matrix to put inside the Matrix4f.
row: index of the row to start the 3x3 block. Must be 0 or 1.
column: index of the column to start the 3x3 block. Must be 0 or 1.
Returns
SUCCESS if everything went well, ERROR_CODE_FAILURE otherwise.

◆ setSubVector3f()

ERROR_CODE setSubVector3f ( Vector3< float >  input,
int  column = 3 
)

Sets a 3x1 Vector inside the Matrix4f at the specified column index.

Note
Can be used to set the Translation/Position matrix when the matrix4f is a pose or an isometry.
Parameters
input: sub vector to put inside the Matrix4f.
column: index of the column to start the 3x3 block. By default, it is the last column (translation for a Pose).
Returns
SUCCESS if everything went well, ERROR_CODE_FAILURE otherwise.

◆ setSubVector4f()

ERROR_CODE setSubVector4f ( Vector4< float >  input,
int  column = 3 
)

Sets a 4x1 Vector inside the Matrix4f at the specified column index.

Note
Can be used to set the Translation/Position matrix when the matrix4f is a pose or an isometry.
Parameters
input: sub vector to put inside the Matrix4f.
column: index of the column to start the 3x3 block. By default, it is the last column (translation for a Pose).
Returns
SUCCESS if everything went well, ERROR_CODE_FAILURE otherwise.

◆ getInfos()

String getInfos ( )

Returns the components of the Matrix4f in a String.

Returns
A String containing the components of the current Matrix4f.

Variables

◆ matrix_name

String matrix_name

Name of the matrix (optional).