Matrix4f Class Reference

Represents a generic fourth-dimensional matrix. More...

General 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 fourth-dimensional matrix.

sIt 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.

\[\begin{bmatrix} r00 & r01 & r02 & tx \\ r10 & r11 & r22 & ty \\ r20 & r21 & r22 & tz \\ m30 & m31 & m32 & m33 \end{bmatrix} \]

Constructor and Destructor

Matrix4f ( )

Matrix4f default constructor.

Matrix4f ( float  data[])

Matrix4f copy constructor (deep copy).

Matrix4f ( const Matrix4f mat)

Matrix4f copy constructor (deep copy).

Parameters
mat: the Matrix4f to copy.

Functions

Matrix4f operator* ( const Matrix4f mat) const

brief Gives the result of the multiplication between two Matrix4f.

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

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

Matrix4f operator* ( const float &  scalar) const

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

Matrix4f operator+ ( const Matrix4f mat) const

brief Gives the result of the addition between two Matrix4f.

Matrix4f operator+ ( const float &  scalar) const

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

Matrix4f operator- ( const Matrix4f mat) const

brief Gives the result of the subtraction between two Matrix4f.

Matrix4f operator- ( const float &  scalar) const

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

bool operator== ( const Matrix4f mat) const

brief Tests two Matrix4f equality.

bool operator!= ( const Matrix4f mat) const

brief Tests two Matrix4f inequality.

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.
ERROR_CODE inverse ( )

Sets the Matrix4f to its inverse.

Returns
SUCCESS if the inverse has been computed, ERROR_CODE_FAILURE is not (det = 0).
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.
void transpose ( )

Sets the Matrix4f to its transpose.

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.
void setIdentity ( )

Sets the Matrix4f to identity.

static Matrix4f identity ( )
static

Creates an identity Matrix4f.

Returns
A Matrix4f set to identity.
void setZeros ( )

Sets the Matrix4f to zero.

static Matrix4f zeros ( )
static

Creates a Matrix4f filled with zeros.

Returns
A Matrix4f set to zero.
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.
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.
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.
String getInfos ( )

Returns the components of the Matrix4f in a String.

Returns
A String containing the components of the current Matrix4f.

Variables

String matrix_name

Name of the matrix (optional).