Matrix4f Class Reference

Class representing a generic 4*4 matrix. More...

Functions

 Matrix4f ()
 Default constructor. More...
 
 Matrix4f (float data[])
 Copy constructor (deep copy). More...
 
 Matrix4f (const Matrix4f &mat)
 Copy constructor (deep copy). More...
 
Matrix4f operator* (const Matrix4f &mat) const
 Gives the result of the multiplication between two sl::Matrix4f. More...
 
Matrix4f operator* (const Vector4< float > &vect) const
 Gives the result of the multiplication between a sl::Matrix4f and a sl::float4. More...
 
Matrix4f operator* (const float &scalar) const
 Gives the result of the multiplication between a sl::Matrix4f and a scalar. More...
 
Matrix4f operator+ (const Matrix4f &mat) const
 Gives the result of the addition between two sl::Matrix4f. More...
 
Matrix4f operator+ (const float &scalar) const
 Gives the result of the addition between a sl::Matrix4f and a scalar. More...
 
Matrix4f operator- (const Matrix4f &mat) const
 Gives the result of the subtraction between two sl::Matrix4f. More...
 
Matrix4f operator- (const float &scalar) const
 Gives the result of the subtraction between a sl::Matrix4f and a scalar. More...
 
bool operator== (const Matrix4f &mat) const
 Tests two sl::Matrix4f equality. More...
 
bool operator!= (const Matrix4f &mat) const
 Tests two sl::Matrix4f inequality. More...
 
float & operator() (int u, int v)
 Gets access to a specific point in the sl::Matrix4f (read/write). More...
 
ERROR_CODE inverse ()
 Sets the sl::Matrix4f to its inverse. More...
 
void transpose ()
 Sets the sl::Matrix4f to its transpose. More...
 
void setIdentity ()
 Sets the sl::Matrix4f to identity. More...
 
void setZeros ()
 Sets the sl::Matrix4f to zero. More...
 
ERROR_CODE setSubMatrix3f (Matrix3f input, int row=0, int column=0)
 Sets a sl::Matrix3f inside the sl::Matrix4f. More...
 
ERROR_CODE setSubVector3f (Vector3< float > input, int column=3)
 Sets a sl::Vector3 inside the sl::Matrix4f at the specified column index. More...
 
ERROR_CODE setSubVector4f (Vector4< float > input, int column=3)
 Sets a sl::Vector4 inside the sl::Matrix4f at the specified column index. More...
 
String getInfos ()
 Returns the components of the sl::Matrix4f in a sl::String. More...
 

Static Functions

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

Attributes

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

Detailed Description

Class representing 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.
The data value of the matrix can be accessed with the 'm' ptr or by 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 ( )

Default constructor.

◆ Matrix4f() [2/3]

Matrix4f ( float  data[])

Copy constructor (deep copy).

◆ Matrix4f() [3/3]

Matrix4f ( const Matrix4f mat)

Copy constructor (deep copy).

Parameters
mat: sl::Matrix3f to copy.

Functions

◆ operator*() [1/3]

Matrix4f operator* ( const Matrix4f mat) const

Gives the result of the multiplication between two sl::Matrix4f.

◆ operator*() [2/3]

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

Gives the result of the multiplication between a sl::Matrix4f and a sl::float4.

◆ operator*() [3/3]

Matrix4f operator* ( const float &  scalar) const

Gives the result of the multiplication between a sl::Matrix4f and a scalar.

◆ operator+() [1/2]

Matrix4f operator+ ( const Matrix4f mat) const

Gives the result of the addition between two sl::Matrix4f.

◆ operator+() [2/2]

Matrix4f operator+ ( const float &  scalar) const

Gives the result of the addition between a sl::Matrix4f and a scalar.

◆ operator-() [1/2]

Matrix4f operator- ( const Matrix4f mat) const

Gives the result of the subtraction between two sl::Matrix4f.

◆ operator-() [2/2]

Matrix4f operator- ( const float &  scalar) const

Gives the result of the subtraction between a sl::Matrix4f and a scalar.

◆ operator==()

bool operator== ( const Matrix4f mat) const

Tests two sl::Matrix4f equality.

◆ operator!=()

bool operator!= ( const Matrix4f mat) const

Tests two sl::Matrix4f inequality.

◆ operator()()

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

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

Parameters
u: Row to get the value from.
v: Column to get the value from.
Returns
The value at the u, v coordinates.

◆ inverse() [1/2]

ERROR_CODE inverse ( )

Sets the sl::Matrix4f to its inverse.

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

◆ inverse() [2/2]

static Matrix4f inverse ( const Matrix4f mat)
static

Creates the inverse of a sl::Matrix4f.

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

◆ transpose() [1/2]

void transpose ( )

Sets the sl::Matrix4f to its transpose.

◆ transpose() [2/2]

static Matrix4f transpose ( const Matrix4f mat)
static

Creates the transpose of a sl::Matrix4f.

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

◆ setIdentity()

void setIdentity ( )

Sets the sl::Matrix4f to identity.

◆ identity()

static Matrix4f identity ( )
static

Creates an identity sl::Matrix4f.

Returns
A sl::Matrix4f set to identity.

◆ setZeros()

void setZeros ( )

Sets the sl::Matrix4f to zero.

◆ zeros()

static Matrix4f zeros ( )
static

Creates a sl::Matrix4f filled with zeros.

Returns
A sl::Matrix4f filled with zero.

◆ setSubMatrix3f()

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

Sets a sl::Matrix3f inside the sl::Matrix4f.

Note
Can be used to set the rotation matrix when the sl::Matrix4f is a pose or an isometric matrix.
Parameters
input: Sub-matrix to put inside the sl::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
sl::ERROR_CODE::SUCCESS if everything went well, sl::ERROR_CODE::FAILURE otherwise.

◆ setSubVector3f()

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

Sets a sl::Vector3 inside the sl::Matrix4f at the specified column index.

Note
Can be used to set the translation/position matrix when the sl::Matrix4f is a pose or an isometry.
Parameters
input: Sub-vector to put inside the sl::Matrix4f.
column: Index of the column to start the 3x3 block. By default, it is the last column (translation for a sl::Pose).
Returns
sl::ERROR_CODE::SUCCESS if everything went well, sl::ERROR_CODE::FAILURE otherwise.

◆ setSubVector4f()

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

Sets a sl::Vector4 inside the sl::Matrix4f at the specified column index.

Note
Can be used to set the translation/position matrix when the sl::Matrix4f is a pose or an isometry.
Parameters
input: Sub-vector to put inside the sl::Matrix4f.
column: Index of the column to start the 3x3 block. By default, it is the last column (translation for a sl::Pose).
Returns
sl::ERROR_CODE::SUCCESS if everything went well, sl::ERROR_CODE::FAILURE otherwise.

◆ getInfos()

String getInfos ( )

Returns the components of the sl::Matrix4f in a sl::String.

Returns
A sl::String containing the components of the current sl::Matrix4f.

Variables

◆ matrix_name

String matrix_name

Name of the matrix (optional).