Transform Class Reference

Class representing a transformation (translation and rotation) for the positional tracking module. More...

Functions

 Transform ()
 Default constructor. More...
 
 Transform (const Transform &motion)
 Copy constructor (deep copy). More...
 
 Transform (const Matrix4f &mat)
 Copy constructor (deep copy). More...
 
 Transform (const Rotation &rotation, const Translation &translation)
 Constructor from an sl::Rotation and a sl::Translation. More...
 
 Transform (const Orientation &orientation, const Translation &translation)
 Constructor from an sl::Orientation and a sl::Translation. More...
 
void setRotationMatrix (const Rotation &rotation)
 Sets the rotation component of the current sl::Transform from an sl::Rotation. More...
 
Rotation getRotationMatrix () const
 Returns the sl::Rotation corresponding to the current sl::Transform. More...
 
void setTranslation (const Translation &translation)
 Sets the translation component of the current sl::Transform from an sl::Translation. More...
 
Translation getTranslation () const
 Returns the sl::Translation corresponding to the current sl::Transform. More...
 
void setOrientation (const Orientation &orientation)
 Sets the orientation component of the current sl::Transform from an sl::Orientation. More...
 
Orientation getOrientation () const
 Returns the sl::Orientation corresponding to the current sl::Transform. More...
 
float3 getRotationVector () const
 Returns the 3x1 rotation vector obtained from 3x3 rotation matrix using Rodrigues formula. More...
 
void setRotationVector (const float3 &vec_rot)
 Sets the rotation component of the sl::Transform with a 3x1 rotation vector (using Rodrigues' transformation). More...
 
float3 getEulerAngles (bool radian=true) const
 Converts the rotation component of the sl::Transform into Euler angles. More...
 
void setEulerAngles (const float3 &euler_angles, bool radian=true)
 Sets the rotation component of the sl::Transform from Euler angles. 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 const u, int const v)
 Gets access to a specific point in the sl::Matrix4f (read/write). More...
 
float operator() (int const u, int const v) const
 Gets access to a specific point in the sl::Matrix4f (read). 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 transformation (translation and rotation) for the positional tracking module.

It can be used to create any type of Matrix4x4 or sl::Matrix4f that must be specifically used for handling a rotation and position information (OpenGL, Tracking, etc.).
It inherits from the generic sl::Matrix4f class.

Constructor and Destructor

◆ Transform() [1/5]

Transform ( )

Default constructor.

◆ Transform() [2/5]

Transform ( const Transform motion)

Copy constructor (deep copy).

Parameters
motion: sl::Transform to copy.

◆ Transform() [3/5]

Transform ( const Matrix4f &  mat)

Copy constructor (deep copy).

Parameters
mat: sl::Matrix4f to copy.

◆ Transform() [4/5]

Transform ( const Rotation rotation,
const Translation translation 
)

Constructor from an sl::Rotation and a sl::Translation.

Parameters
rotation: sl::Rotation to copy.
translation: sl::Translation to copy.

◆ Transform() [5/5]

Transform ( const Orientation orientation,
const Translation translation 
)

Constructor from an sl::Orientation and a sl::Translation.

Parameters
orientation: sl::Orientation to copy.
translation: sl::Translation to copy.

Functions

◆ setRotationMatrix()

void setRotationMatrix ( const Rotation rotation)

Sets the rotation component of the current sl::Transform from an sl::Rotation.

Parameters
rotation: sl::Rotation to be used.

◆ getRotationMatrix()

Rotation getRotationMatrix ( ) const

Returns the sl::Rotation corresponding to the current sl::Transform.

Returns
sl::Rotation created from the sl::Transform values.
Warning
The given sl::Rotation contains a copy of the sl::Transform values. Not references.

◆ setTranslation()

void setTranslation ( const Translation translation)

Sets the translation component of the current sl::Transform from an sl::Translation.

Parameters
translation: sl::Translation to be used.

◆ getTranslation()

Translation getTranslation ( ) const

Returns the sl::Translation corresponding to the current sl::Transform.

Returns
sl::Translation created from the sl::Transform values.
Warning
The given sl::Translation contains a copy of the sl::Transform values. Not references.

◆ setOrientation()

void setOrientation ( const Orientation orientation)

Sets the orientation component of the current sl::Transform from an sl::Orientation.

Parameters
orientation: sl::Orientation to be used.

◆ getOrientation()

Orientation getOrientation ( ) const

Returns the sl::Orientation corresponding to the current sl::Transform.

Returns
sl::Orientation created from the sl::Transform values.
Warning
The given sl::Orientation contains a copy of the sl::Transform values.

◆ getRotationVector()

float3 getRotationVector ( ) const

Returns the 3x1 rotation vector obtained from 3x3 rotation matrix using Rodrigues formula.

Returns
Rotation vector created from the sl::Transform values.

◆ setRotationVector()

void setRotationVector ( const float3 &  vec_rot)

Sets the rotation component of the sl::Transform with a 3x1 rotation vector (using Rodrigues' transformation).

Parameters
vec_rot: Vector containing the rotation value for each axis (rx, ry, rz).

◆ getEulerAngles()

float3 getEulerAngles ( bool  radian = true) const

Converts the rotation component of the sl::Transform into Euler angles.

Parameters
radian: Whether the angle will be returned in radian or degree.
Returns
Euler angles created from the sl::Transform values as a sl::float3 representing the rotations around the X, Y and Z axes using YZX convention.

◆ setEulerAngles()

void setEulerAngles ( const float3 &  euler_angles,
bool  radian = true 
)

Sets the rotation component of the sl::Transform from Euler angles.

Parameters
euler_angles: Euler angles (as a sl::float3) to update the sl::Transform.
radian: Whether the angle is in radian or degree.

◆ operator*() [1/3]

Matrix4f operator* ( const Matrix4f &  mat) const
inherited

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

◆ operator*() [2/3]

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

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

◆ operator*() [3/3]

Matrix4f operator* ( const float &  scalar) const
inherited

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

◆ operator+() [1/2]

Matrix4f operator+ ( const Matrix4f &  mat) const
inherited

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

◆ operator+() [2/2]

Matrix4f operator+ ( const float &  scalar) const
inherited

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

◆ operator-() [1/2]

Matrix4f operator- ( const Matrix4f &  mat) const
inherited

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

◆ operator-() [2/2]

Matrix4f operator- ( const float &  scalar) const
inherited

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

◆ operator==()

bool operator== ( const Matrix4f &  mat) const
inherited

Tests two sl::Matrix4f equality.

◆ operator!=()

bool operator!= ( const Matrix4f &  mat) const
inherited

Tests two sl::Matrix4f inequality.

◆ operator()() [1/2]

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

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.

◆ operator()() [2/2]

float operator() ( int const  u,
int const  v 
) const
inherited

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

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 ( )
inherited

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)
staticinherited

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 ( )
inherited

Sets the sl::Matrix4f to its transpose.

◆ transpose() [2/2]

static Matrix4f transpose ( const Matrix4f &  mat)
staticinherited

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 ( )
inherited

Sets the sl::Matrix4f to identity.

◆ identity()

static Matrix4f identity ( )
staticinherited

Creates an identity sl::Matrix4f.

Returns
A sl::Matrix4f set to identity.

◆ setZeros()

void setZeros ( )
inherited

Sets the sl::Matrix4f to zero.

◆ zeros()

static Matrix4f zeros ( )
staticinherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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 ( )
inherited

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
inherited

Name of the matrix (optional).