Cumulia Illustrator Rendering Engine v1.1.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
cil::Matrix4f Class Referencefinal

The Matrix4f class is 4 X 4 matrix. More...

#include <matrix.h>

Inheritance diagram for cil::Matrix4f:
cil::Matrix< Matrix4f > cil::Tuple< float > cil::Variant

Public Member Functions

 Matrix4f ()
 Constructs a 4 X 4 matrix objects, initializing elements on the diagonal to 1 and all others to 0.
 
 Matrix4f (float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13, float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33)
 Constructs a 4 X 4 matrix objects, and sets the elements with the input fload parameters.
 
 Matrix4f (const Vector4f &c0, const Vector4f &c1, const Vector4f &c2, const Vector4f &c3)
 Constructs a 4 X 4 matrix object by setting the vector c0 to the first column, c1 to the second column, c2 to the third column and c3 to the fourth column.

 
 Matrix4f (const Matrix2f &other)
 Constructs a 4 X 4 matrix object, and sets its 2 X 2 submatrix with another 2 X 2 matrix, remaining the other elements as their initialized values.
 
 Matrix4f (const Matrix3f &other)
 Constructs a 4 X 4 matrix object, and sets its 3 X 3 submatrix with another 3 X 3 matrix, remaining the other elements as their initialized values.
 
 Matrix4f (const Matrix4f &other)
 Constructs a 4 X 4 matrix object by copying the elements of another 4 X 4 matrix.

 
Matrix4f operator* (const Matrix4f &other) const
 Returns a new Matrix object that is formed by matrix multiplication between the current Matrix and another matrix.
 
Vector4f operator* (const Vector4f &other) const
 Returns a new Vector4 object that is formed by multiplication between this Matrix and a Vector4 object.
 
void set (float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13, float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33)
 Sets the elements of this 4 X 4 matrix object.
 
float determinant () const
 Returns the determinant of the Matrix4f object.
 
bool invert ()
 Inverts this matrix. Returns a boolean value of true if success(non-singular). If the determinant is zero(singular matrix), sets the matrix to identity and returns false.
 
Quaternion toRotation () const
 Extracts the rotation quaternion from this matrix object.
 
Vector3f toScaling () const
 Extracts the scaling vector3 object from this matrix4 object.
 
Vector3f toTranslation () const
 Extracts the translation vector3 object from this matrix object.
 
void rotate (const Quaternion &r)
 Rotates this matrix by the specified quaternion.
 
void scale (const Vector3f &s)
 Scales this matrix by the specified vector3.
 
void translate (const Vector3f &t)
 Translates this matrix by the specified vector3.
 
- Public Member Functions inherited from cil::Matrix< Matrix4f >
 Matrix (int dim)
 Constructs a dim X dim Matrix object, initializing elements on the diagonal to 1 and all others to 0.
 
const float * operator[] (int index) const
 Returns a constant pointer to the first element in the column of index of this matrix, providing a read-only access.
 
float * operator[] (int index)
 Returns a pointer to the first element in the column of index of this matrix, providing a read-write access.
 
Matrixoperator+= (const Matrix &other)
 Performs element-wise addition between the current Matrix and another matrix.
 
Matrix< Matrix4f > & operator-= (const Matrix &other)
 Performs element-wise subtraction between the current Matrix and another matrix.
 
Matrix< Matrix4f > & operator*= (const Matrix &other)
 Performs right matrix multiplication of the current matrix with another matrix.
 
Matrix4f operator+ (const Matrix4f &other) const
 Returns a new Matrix object that is formed by element-wise addition between the current matrix and another matrix.
 
Matrix4f operator- (const Matrix4f &other) const
 Returns a new Matrix object that is formed by element-wise subtraction between the current matrix and another matrix.
 
Matrix4f operator* (const Matrix4f &other) const
 Returns a new Matrix object that is formed by matrix multiplication between the current Matrix and another matrix.
 
void setIdentity ()
 Sets elements on the diagonal of this matrix to 1 and all others to 0.
 
void transpose ()
 Transpose this matrix.
 
- Public Member Functions inherited from cil::Tuple< float >
 Tuple (int size)
 Constructs a Tuple object with a specified number of elements, and initialize all elements to 0.
 
virtual ~Tuple ()
 
int size () const
 Gets the number of elements of the Tuple.
 
float * data ()
 Gets the data array of the Tuple.
 
const float * data () const
 Gets the data array of the Tuple, and the data could not be modified upon which this function is called.
 
void setData (const float *data)
 Sets the data array of the Variant.
 
Tuple< float > & operator= (const Tuple &other)
 Copys the data of another Tuple to the one on which the operator is invoked.
 
bool operator== (const Tuple &other) const
 Compares the Tuple with another one, and returns true if they are equal, otherwise returns false.
 
bool operator!= (const Tuple &other) const
 Compares the Tuple with another one, and returns false if they are equal, otherwise returns true.
 
- Public Member Functions inherited from cil::Variant
 Variant ()
 
virtual ~Variant ()
 
const std::string & type () const
 

Static Public Member Functions

static Matrix4f fromRotation (const Quaternion &r)
 Returns a 4 X 4 matrix objects representing a rotation around an axis by a specified angle.
 
static Matrix4f fromScaling (const Vector3f &s)
 Returns a 4 X 4 matrix objects representing a scaling transformation by vector3.
 
static Matrix4f fromTranslation (const Vector3f &t)
 Returns a 4 X 4 matrix objects representing a translation by vector3.
 

Additional Inherited Members

- Protected Attributes inherited from cil::Matrix< Matrix4f >
int m_dim
 The dimension of the Matrix.
 
- Protected Attributes inherited from cil::Tuple< float >
float * m_data
 The data array of the Tuple.
 
int m_size
 The number of elements that the data array of the Tuple holds.
 
- Protected Attributes inherited from cil::Variant
std::string m_type
 

Detailed Description

The Matrix4f class is 4 X 4 matrix.

Constructor & Destructor Documentation

◆ Matrix4f() [1/6]

cil::Matrix4f::Matrix4f ( )

Constructs a 4 X 4 matrix objects, initializing elements on the diagonal to 1 and all others to 0.

See also
Matrix(int dim)

◆ Matrix4f() [2/6]

cil::Matrix4f::Matrix4f ( float e00,
float e01,
float e02,
float e03,
float e10,
float e11,
float e12,
float e13,
float e20,
float e21,
float e22,
float e23,
float e30,
float e31,
float e32,
float e33 )

Constructs a 4 X 4 matrix objects, and sets the elements with the input fload parameters.

The first column of the matrix is {e00, e01, e02, e03}, the second column is {e10, e11, e12, e13}, the third column is {e20, e21, e22, e23} and the fourth column is {e30, e31, e32, e33}.

◆ Matrix4f() [3/6]

cil::Matrix4f::Matrix4f ( const Vector4f & c0,
const Vector4f & c1,
const Vector4f & c2,
const Vector4f & c3 )

Constructs a 4 X 4 matrix object by setting the vector c0 to the first column, c1 to the second column, c2 to the third column and c3 to the fourth column.

◆ Matrix4f() [4/6]

cil::Matrix4f::Matrix4f ( const Matrix2f & other)

Constructs a 4 X 4 matrix object, and sets its 2 X 2 submatrix with another 2 X 2 matrix, remaining the other elements as their initialized values.

◆ Matrix4f() [5/6]

cil::Matrix4f::Matrix4f ( const Matrix3f & other)

Constructs a 4 X 4 matrix object, and sets its 3 X 3 submatrix with another 3 X 3 matrix, remaining the other elements as their initialized values.

◆ Matrix4f() [6/6]

cil::Matrix4f::Matrix4f ( const Matrix4f & other)

Constructs a 4 X 4 matrix object by copying the elements of another 4 X 4 matrix.

Member Function Documentation

◆ determinant()

float cil::Matrix4f::determinant ( ) const

Returns the determinant of the Matrix4f object.

◆ fromRotation()

static Matrix4f cil::Matrix4f::fromRotation ( const Quaternion & r)
static

Returns a 4 X 4 matrix objects representing a rotation around an axis by a specified angle.

◆ fromScaling()

static Matrix4f cil::Matrix4f::fromScaling ( const Vector3f & s)
static

Returns a 4 X 4 matrix objects representing a scaling transformation by vector3.

◆ fromTranslation()

static Matrix4f cil::Matrix4f::fromTranslation ( const Vector3f & t)
static

Returns a 4 X 4 matrix objects representing a translation by vector3.

◆ invert()

bool cil::Matrix4f::invert ( )

Inverts this matrix. Returns a boolean value of true if success(non-singular). If the determinant is zero(singular matrix), sets the matrix to identity and returns false.

◆ operator*() [1/2]

Matrix4f cil::Matrix4f::operator* ( const Matrix4f & other) const

Returns a new Matrix object that is formed by matrix multiplication between the current Matrix and another matrix.

Returns A * B, where A represents this matrix and B represents the other.

◆ operator*() [2/2]

Vector4f cil::Matrix4f::operator* ( const Vector4f & other) const

Returns a new Vector4 object that is formed by multiplication between this Matrix and a Vector4 object.

Returns A * V, where A represents this matrix and V represents the other vector4.

◆ rotate()

void cil::Matrix4f::rotate ( const Quaternion & r)

Rotates this matrix by the specified quaternion.

◆ scale()

void cil::Matrix4f::scale ( const Vector3f & s)

Scales this matrix by the specified vector3.

◆ set()

void cil::Matrix4f::set ( float e00,
float e01,
float e02,
float e03,
float e10,
float e11,
float e12,
float e13,
float e20,
float e21,
float e22,
float e23,
float e30,
float e31,
float e32,
float e33 )

Sets the elements of this 4 X 4 matrix object.

The first column of the matrix is {e00, e01, e02, e03}, the second column is {e10, e11, e12, e13}, the third column is {e20, e21, e22, e23} and the fourth column is {e30, e31, e32, e33}.

◆ toRotation()

Quaternion cil::Matrix4f::toRotation ( ) const

Extracts the rotation quaternion from this matrix object.

◆ toScaling()

Vector3f cil::Matrix4f::toScaling ( ) const

Extracts the scaling vector3 object from this matrix4 object.

◆ toTranslation()

Vector3f cil::Matrix4f::toTranslation ( ) const

Extracts the translation vector3 object from this matrix object.

◆ translate()

void cil::Matrix4f::translate ( const Vector3f & t)

Translates this matrix by the specified vector3.