Matrix

Fields

double

_mat

const Matrix

IDENTITY

const Matrix

ZERO

Functions

CID

GetClassID

void *

As

const void *

As

class T_As

As

class T_As

As

Matrix

Matrix

Matrix

Matrix

Matrix

Matrix

Matrix

Matrix

~Matrix

void

Reset

void

GetLineMajorMatrix

void

GetLineMajorMatrix

void

SetLineMajorMatrix

void

SetLineMajorMatrix

void

GetColumnMajorMatrix

void

GetColumnMajorMatrix

void

SetColumnMajorMatrix

void

SetColumnMajorMatrix

Vector4

GetColumn

void

GetColumn

void

GetColumn

void

SetColumn

void

SetColumn

void

SetColumn

void

SetColumn

Vector3

GetTranslation

void

GetTranslation

void

GetTranslation

void

SetTranslation

void

SetTranslation

void

SetTranslation

RED_RC

RotationAxisMatrix

RED_RC

RotationAxisMatrix

RED_RC

RotationAxisMatrix

void

ScalingAxisMatrix

void

ScalingAxisMatrix

void

ScalingAxisMatrix

RED_RC

RotationAngleMatrix

RED_RC

RotationAngleMatrix

RED_RC

RotationAngleMatrix

RED_RC

PerspectiveViewmappingMatrix

RED_RC

OrthographicViewmappingMatrix

Matrix

operator+

Matrix

operator-

void

operator+=

void

operator-=

Matrix

operator-

Matrix

operator*

void

operator*=

Vector4

operator*

Vector4

operator*

void

Multiply

void

Multiply

void

Multiply

void

Multiply

void

Multiply

void

Multiply

void

Multiply

void

Multiply4

void

Multiply4

void

Multiply4

void

Multiply4

void

Multiply4

void

Multiply4

void

Multiply4

void

Multiply4w1

void

Multiply4w1

void

Multiply4w1

void

Multiply4w1

void

Multiply4w1

void

Multiply4w1

Vector3

Rotate

void

Rotate

void

Rotate

void

Rotate

void

Rotate

void

Rotate

Vector3

RotateNormalize

void

RotateNormalize

void

RotateNormalize

void

RotateNormalize

void

RotateNormalize

void

RotateNormalize

RED_RC

Invert

RED_RC

GetInvert

void

Transpose

void

Scale

void

Scale

void

Scale

void

Translate

void

Translate

void

Translate

double

Determinant

double

Scaling

Vector3

AxisScaling

bool

IsIdentity

bool

IsDirect

bool

operator==

bool

operator!=

RED_RC

GetUVDecomposition

Detailed Description

class Matrix : public RED::Object

Homogeneous 4x4 Matrix for graphical operations.

@related class RED::Vector3, class RED::Vector4, Shapes Hierarchy

The RED::Matrix defines all transformations that are applicable to 3d objects using homogeneous coordinates.

Matrix coordinates are stored in a 4x4 float array.

Orientation convention is matx[row][column] (line major), so we access the following elements at these positions in the array:

(0,0)

(0,1)

(0,2)

(0,3)

(1,0)

(1,1)

(1,2)

(1,3)

(2,0)

(2,1)

(2,2)

(2,3)

(3,0)

(3,1)

(3,2)

(3,3)

Vectors are each representing one column. For example second matrix vector is made of [(0,1), (1,1), (2,1), (3,1)]. Translation is stored by [(0,3), (1,3), (2,3)].

The matrix is stored in double precision.

Public Functions

virtual void *As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

virtual const void *As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

template<class T_As>
inline T_As *As()
template<class T_As>
inline const T_As *As() const
Matrix()

Matrix construction method.

Builds an identity matrix.

Matrix(const float *iMat)

Matrix construction method from a floating point array.

Constructs a matrix given the ‘iMat’ array parameter. If the ‘iMat’ parameter is set to NULL, a zero matrix is constructed.

Parameters

iMat – A 16 float array that must respect the line major memory order: 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33.

Matrix(const double *iMat)

Matrix construction method from a double precision floating point array.

Constructs a matrix given the ‘iMat’ array parameter. If the ‘iMat’ parameter is set to NULL, a zero matrix is constructed.

Parameters

iMat – A 16 double precision float array that must respect the line major memory order: 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33.

Matrix(const RED::Vector3 &iCol0, const RED::Vector3 &iCol1, const RED::Vector3 &iCol2, const RED::Vector3 &iCol3)

Matrix construction method by column vectors.

Builds a matrix using the 4 provided column vectors. The 4-th column member is implicitly set to 0.0 for the 3 base columns and 1.0 for ‘iCol3’ (the translation).

Parameters
  • iCol0 – First matrix column: 00 10 20 (0.0f).

  • iCol1 – Second matrix column: 01 11 21 (0.0f).

  • iCol2 – Third matrix column: 02 12 22 (0.0f).

  • iCol3 – Fourth matrix column: 03 13 23 (1.0f).

Matrix(const RED::Vector4 &iCol0, const RED::Vector4 &iCol1, const RED::Vector4 &iCol2, const RED::Vector4 &iCol3)

Matrix construction method by column vectors.

Builds a matrix using the 4 provided column vectors.

Parameters
  • iCol0 – First matrix column.

  • iCol1 – Second matrix column.

  • iCol2 – Third matrix column

  • iCol3 – Fourth matrix column.

Matrix(const float *iCol0, const float *iCol1, const float *iCol2, const float *iCol3)

Matrix construction method by column vectors.

Builds a matrix using the 4 provided column vectors.

Parameters
  • iCol0 – First matrix column - 4 terms.

  • iCol1 – Second matrix column - 4 terms.

  • iCol2 – Third matrix column - 4 terms.

  • iCol3 – Fourth matrix column - 4 terms.

Matrix(const double *iCol0, const double *iCol1, const double *iCol2, const double *iCol3)

Matrix construction method by column vectors.

Builds a matrix using the 4 provided column vectors.

Parameters
  • iCol0 – First matrix column - 4 terms.

  • iCol1 – Second matrix column - 4 terms.

  • iCol2 – Third matrix column - 4 terms.

  • iCol3 – Fourth matrix column - 4 terms.

Matrix(double iTranslationX, double iTranslationY, double iScaleX, double iScaleY, double iRotationZ)

UV transformation matrix construction helper.

This method lets you create a ‘standard’ uv transformation matrix. The pivot of the concatenated transformations is hard-coded to be at (0.5, 0.5, 0.0), i.e the center of the texture.

Allowed operations are xy-translation, xy-scaling and z-rotation. Please, note that only positive (or null) scaling values are allowed.

This is the prefered method for creating uv transformation matrices as parameters can later be retrieved using the RED::Matrix::GetUVDecomposition method and mapped to material controller properties.

Parameters
  • iTranslationX – translation along the x-axis.

  • iTranslationY – translation along the y-axis.

  • iScaleX – scaling along the x-axis.

  • iScaleY – scaling along the y-axis.

  • iRotationZ – rotation angle in radians around the z-axis.

virtual ~Matrix()

Matrix destruction method.

void Reset()

Resets the matrix to the identity.

void GetLineMajorMatrix(float oMat[16]) const

Returns the matrix array using the line major convention.

This method returns the 16 float matrix tab under the line major convention.

Line major memory order: 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33.

Column major version of the same array: 00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33.

Parameters

oMat – A 16 float array filled with the matrix elements.

void GetLineMajorMatrix(double oMat[16]) const

Returns the matrix array using the line major convention.

This method returns the 16 float matrix tab under the line major convention.

Line major memory order: 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33.

Column major version of the same array: 00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33.

Parameters

oMat – A 16 float array filled with the matrix elements.

void SetLineMajorMatrix(const float iMat[16])

Defines a matrix from a line major matrix array.

Parameters

iMat – Line major matrix array.

void SetLineMajorMatrix(const double iMat[16])

Defines a matrix from a line major matrix array.

Parameters

iMat – Line major matrix array.

void GetColumnMajorMatrix(float oMat[16]) const

Returns the matrix under the column major convention.

This method returns the 16 float matrix tab under the column major convention.

Line major memory order: 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33.

Column major version of the same array: 00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33.

Parameters

oMat – Allocated 16 float array filled with the transposed ‘_mat’.

void GetColumnMajorMatrix(double oMat[16]) const

Returns the matrix under the column major convention.

This method returns the 16 float matrix tab under the column major convention.

Line major memory order: 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33.

Column major version of the same array: 00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33.

Parameters

oMat – Allocated 16 float array filled with the transposed ‘_mat’.

void SetColumnMajorMatrix(const float iMat[16])

Defines a matrix from a column major matrix array.

Parameters

iMat – Column major matrix array.

void SetColumnMajorMatrix(const double iMat[16])

Defines a matrix from a column major matrix array.

Parameters

iMat – Column major matrix array.

inline RED::Vector4 GetColumn(int iColumn) const

Retrieves a matrix column vector.

Parameters

iColumn – The column vector number in [0,3].

Returns

The requested column vector.

inline void GetColumn(float oColumn[4], int iColumn) const

Retrieves a matrix column vector.

Parameters
  • oColumn – The column vector.

  • iColumn – The column vector number in [0,3].

inline void GetColumn(double oColumn[4], int iColumn) const

Retrieves a matrix column vector.

Parameters
  • oColumn – The column vector.

  • iColumn – The column vector number in [0,3].

inline void SetColumn(int iColumn, const RED::Vector3 &iVector)

Sets a matrix column vector.

The 4th vector component is set to 0.0 for columns 0, 1, 2 and is set to 1.0 for the column number 3.

Parameters
  • iColumn – The column vector number in [0,3].

  • iVector – The column vector.

inline void SetColumn(int iColumn, const RED::Vector4 &iVector)

Sets a matrix column vector.

Parameters
  • iColumn – The column vector number in [0,3].

  • iVector – The column vector.

inline void SetColumn(int iColumn, const float iVector[4])

Sets a matrix column vector.

Parameters
  • iColumn – The column vector number in [0,3].

  • iVector – The column vector.

inline void SetColumn(int iColumn, const double iVector[4])

SetColumn: Set a matrix column vector.

Parameters
  • iColumn – The column vector number in [0,3].

  • iVector – The column vector.

inline RED::Vector3 GetTranslation() const

Gets the matrix translation vector.

Returns

The translation vector.

inline void GetTranslation(float oTranslation[3]) const

Gets the matrix translation vector.

Parameters

oTranslation – The translation vector.

inline void GetTranslation(double oTranslation[3]) const

Gets the matrix translation vector.

Parameters

oTranslation – The translation vector.

inline void SetTranslation(const RED::Vector3 &iTranslation)

Sets the matrix translation column.

Parameters

iTranslation – The translation vector.

inline void SetTranslation(const float iTranslation[3])

Sets the matrix translation column.

Parameters

iTranslation – The translation vector.

inline void SetTranslation(const double iTranslation[3])

Sets the matrix translation column.

Parameters

iTranslation – The translation vector.

RED_RC RotationAxisMatrix(const RED::Vector3 &iCenter, const RED::Vector3 &iAxis, double iAngle)

Sets the matrix to the definition of a central rotation.

This method sets all matrix parameters to the definition of an axial rotation around ‘iCenter’ / ‘iAxis’, rotating of ‘iAngle’.

Parameters
  • iCenter – The rotation axis definition point.

  • iAxis – The rotation axis definition direction.

  • iAngle – The angle of rotation around ( ‘iCenter’, ‘iAxis’ ) in radians.

Returns

RED_OK when the matrix could be built,

RED_FAIL if the method received invalid parameters.

RED_RC RotationAxisMatrix(const float iCenter[3], const float iAxis[3], float iAngle)

Sets the matrix to the definition of a central rotation.

This method sets all matrix parameters to the definition of an axial rotation around ‘iCenter’ / ‘iAxis’, rotating of ‘iAngle’.

Parameters
  • iCenter – The rotation axis definition point.

  • iAxis – The rotation axis definition direction.

  • iAngle – The angle of rotation around ( ‘iCenter’, ‘iAxis’ ) in radians.

Returns

RED_OK when the matrix could be built,

RED_FAIL if the method received invalid parameters.

RED_RC RotationAxisMatrix(const double iCenter[3], const double iAxis[3], double iAngle)

Sets the matrix to the definition of a central rotation.

This method sets all matrix parameters to the definition of an axial rotation around ‘iCenter’ / ‘iAxis’, rotating of ‘iAngle’.

Parameters
  • iCenter – The rotation axis definition point.

  • iAxis – The rotation axis definition direction.

  • iAngle – The angle of rotation around ( ‘iCenter’, ‘iAxis’ ) in radians.

Returns

RED_OK when the matrix could be built,

RED_FAIL if the method received invalid parameters.

void ScalingAxisMatrix(const RED::Vector3 &iCenter, const RED::Vector3 &iScale)

Defines a central scaling matrix.

This method sets a central scaling matrix around ‘iCenter’, of ‘iScale’ axial scaling.

Parameters
  • iCenter – The scaling center.

  • iScale – The axis scaling factor applied.

void ScalingAxisMatrix(const float iCenter[3], const float iScale[3])

Defines a central scaling matrix.

This method sets a central scaling matrix around ‘iCenter’, of ‘iScale’ axial scaling.

Parameters
  • iCenter – The scaling center.

  • iScale – The axis scaling factor applied.

void ScalingAxisMatrix(const double iCenter[3], const double iScale[3])

Defines a central scaling matrix.

This method sets a central scaling matrix around ‘iCenter’, of ‘iScale’ axial scaling.

Parameters
  • iCenter – The scaling center.

  • iScale – The axis scaling factor applied.

RED_RC RotationAngleMatrix(const RED::Vector3 &iCenter, float iAx, float iAy, float iAz)

Defines a cumulated rotation matrix around each axis.

This method sets the matrix parameters to a rotation matrix defined by three cumulated rotation operations. Let be (Mx,My,Mz) the three column vectors of the matrix. We perform the following operations:

  • A rotation around Mx of iAx, resulting in: (Mx,My’,Mz’).

  • A rotation around My’ of iAy, resulting in: (Mx’,My’,Mz’’).

  • A rotation around Mz’’ of iAz, resulting in: (Mx’’,My’’,Mz’’).

  • A translation of ‘iCenter’.

Parameters
  • iCenter – Center of the rotation matrix.

  • iAx – Angle of rotation around Mx in radians.

  • iAy – Angle of rotation around My’ in radians.

  • iAz – Angle of rotation around Mz’’ in radians.

Returns

RED_OK when the matrix could be built,

RED_FAIL if the method received invalid parameters.

RED_RC RotationAngleMatrix(const float iCenter[3], float iAx, float iAy, float iAz)

Defines a cumulated rotation matrix around each axis.

This method sets the matrix parameters to a rotation matrix defined by three cumulated rotation operations. Let be (Mx,My,Mz) the three column vectors of the matrix. We perform the following operations:

  • A rotation around Mx of iAx, resulting in: (Mx,My’,Mz’).

  • A rotation around My’ of iAy, resulting in: (Mx’,My’,Mz’’).

  • A rotation around Mz’’ of iAz, resulting in: (Mx’’,My’’,Mz’’).

  • A translation of ‘iCenter’.

Parameters
  • iCenter – Center of the rotation matrix.

  • iAx – Angle of rotation around Mx in radians.

  • iAy – Angle of rotation around My’ in radians.

  • iAz – Angle of rotation around Mz’’ in radians.

Returns

RED_OK when the matrix could be built,

RED_FAIL if the method received invalid parameters.

RED_RC RotationAngleMatrix(const double iCenter[3], double iAx, double iAy, double iAz)

Defines a cumulated rotation matrix around each axis.

This method sets the matrix parameters to a rotation matrix defined by three cumulated rotation operations. Let be (Mx,My,Mz) the three column vectors of the matrix. We perform the following operations:

  • A rotation around Mx of iAx, resulting in: (Mx,My’,Mz’).

  • A rotation around My’ of iAy, resulting in: (Mx’,My’,Mz’’).

  • A rotation around Mz’’ of iAz, resulting in: (Mx’’,My’’,Mz’’).

  • A translation of ‘iCenter’.

Parameters
  • iCenter – Center of the rotation matrix.

  • iAx – Angle of rotation around Mx in radians.

  • iAy – Angle of rotation around My’ in radians.

  • iAz – Angle of rotation around Mz’’ in radians.

Returns

RED_OK when the matrix could be built,

RED_FAIL if the method received invalid parameters.

RED_RC PerspectiveViewmappingMatrix(double iLeft, double iRight, double iBottom, double iTop, double iDNear, double iDFar)

Sets the matrix to a perspective frustum viewmapping transformation matrix.

This method sets the content of This to define a perspective viewmapping transformation. The content of the matrix is as follows, provided a frustum defined by (l,r,b,t,n,f):

2n/(r-l)

0

(r+l)/(r-l)

0

0

2n/(t-b)

(t+b)/(t-b)

0

0

0

-(f+n)/(f-n)

-2fn/(f-n)

0

0

-1

0

Where (l,b,n) is the coordinate set of the lower left near corner of the viewing pyramid, and (r,t,f) the coordinates of it’s top right far corner (that are coordinates of the pyramid clip planes either).

Parameters
  • iLeft – Coordinate of the left vertical clipping plane.

  • iRight – Coordinate of the right vertical clipping plane.

  • iBottom – Coordinate of the bottom horizontal clipping plane.

  • iTop – Coordinate of the top horizontal clipping plane.

  • iDNear – Distance to the near depth clipping plane.

  • iDFar – Distance to the far depth clipping plane.

RED_RC OrthographicViewmappingMatrix(double iLeft, double iRight, double iBottom, double iTop, double iDNear, double iDFar)

Sets the matrix to a parallel viewmapping transformation matrix.

This method sets the content of This to define a parallel viewmapping transformation. The content of the matrix is as follows, provided a frustum defined by (l,r,b,t,n,f):

2/(r-l)

0

0

-(r+l)/(r-l)

0

2/(t-b)

0

-(t+b)/(t-b)

0

0

-2/(f-n)

-(f+n)/(f-n)

0

0

0

1

Where (l,b,n) is the coordinate set of the lower left near corner of the viewing parallelogram, and (r,t,f) the coordinates of it’s top right far corner (that are coordinates of the pyramid clip planes either).

Parameters
  • iLeft – Coordinate of the left vertical clipping plane.

  • iRight – Coordinate of the right vertical clipping plane.

  • iBottom – Coordinate of the bottom horizontal clipping plane.

  • iTop – Coordinate of the top horizontal clipping plane.

  • iDNear – Distance to the near depth clipping plane.

  • iDFar – Distance to the far depth clipping plane.

RED::Matrix operator+(const RED::Matrix &iOperand) const

Matrix addition operator.

Returns

the sum of ‘this’ + iOperand.

RED::Matrix operator-(const RED::Matrix &iOperand) const

Matrix subtraction operator.

Returns

the subtraction of ‘this’ - iOperand.

void operator+=(const RED::Matrix &iOperand)

Matrix addition operator.

Adds the contents of iOperand to ‘this’.

void operator-=(const RED::Matrix &iOperand)

Matrix subtraction operator.

Subtract the contents of iOperand to ‘this’.

RED::Matrix operator-() const

Returns the opposite of the matrix.

Returns

-‘this’

RED::Matrix operator*(const RED::Matrix &iOperand) const

Matrix multiplication operator.

Returns

the product of ‘this’ * iOperand.

void operator*=(const RED::Matrix &iOperand)

Matrix multiplication operator.

Multiplt ‘this’ by iOperand.

inline RED::Vector4 operator*(const RED::Vector3 &iOperand) const

Homogeneous multiplication of a vector by the matrix.

Returns

The product of ‘this’ * iOperand.

inline RED::Vector4 operator*(const RED::Vector4 &iOperand) const

Homogeneous multiplication of a vector by the matrix.

Returns

The product of ‘this’ * iOperand.

inline void Multiply(double oVector[3], const double iVector[3]) const

Non homogeneous multiplication of a vector by the matrix.

The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply(double oVector[3], const float iVector[3]) const

Non homogeneous multiplication of a vector by the matrix.

The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply(float oVector[3], const float iVector[3]) const

Non homogeneous multiplication of a vector by the matrix.

The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply(double oVector[3], const RED::Vector3 &iVector) const

Non homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply(double oVector[3], const RED::Vector4 &iVector) const

Non homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (the w component is ignored).

inline void Multiply(float oVector[3], const RED::Vector3 &iVector) const

Non homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply(float oVector[3], const RED::Vector4 &iVector) const

Non homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (the w component is ignored).

inline void Multiply4(double oVector[4], const double iVector[4]) const

Homogeneous multiplication of a vector by the matrix.

The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply4(double oVector[4], const float iVector[4]) const

Homogeneous multiplication of a vector by the matrix.

The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply4(float oVector[4], const float iVector[4]) const

Homogeneous multiplication of a vector by the matrix.

The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply4(double oVector[4], const RED::Vector3 &iVector) const

Homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply4(double oVector[4], const RED::Vector4 &iVector) const

Homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply4(float oVector[4], const RED::Vector3 &iVector) const

Homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply4(float oVector[4], const RED::Vector4 &iVector) const

Homogeneous multiplication of a vector by the matrix.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector.

inline void Multiply4w1(double oVector[4], const float iVector[3]) const

Homogeneous multiplication of a vector by the matrix.

iVector is assumed to have a homogeneous coordinate equal to 1.0.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (x,y,z,1).

inline void Multiply4w1(double oVector[4], const double iVector[3]) const

Homogeneous multiplication of a vector by the matrix.

iVector is assumed to have a homogeneous coordinate equal to 1.0.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (x,y,z,1).

inline void Multiply4w1(double oVector[4], const RED::Vector3 &iVector) const

Homogeneous multiplication of a vector by the matrix.

iVector is assumed to have a homogeneous coordinate equal to 1.0.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (x,y,z,1).

inline void Multiply4w1(float oVector[4], const float iVector[3]) const

Homogeneous multiplication of a vector by the matrix.

iVector is assumed to have a homogeneous coordinate equal to 1.0.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (x,y,z,1).

inline void Multiply4w1(float oVector[4], const double iVector[3]) const

Homogeneous multiplication of a vector by the matrix.

iVector is assumed to have a homogeneous coordinate equal to 1.0.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (x,y,z,1).

inline void Multiply4w1(float oVector[4], const RED::Vector3 &iVector) const

Homogeneous multiplication of a vector by the matrix.

iVector is assumed to have a homogeneous coordinate equal to 1.0.

Parameters
  • oVector – The resulting vector.

  • iVector – The input vector (x,y,z,1).

inline RED::Vector3 Rotate(const RED::Vector3 &iVector) const

Rotation of the source vector by the matrix.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector.

Parameters

iVector – The input vector.

Returns

The resulting rotated vector.

inline void Rotate(double oVector[3], const double iVector[3]) const

Rotation of the source vector by the matrix.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector. The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void Rotate(double oVector[3], const float iVector[3]) const

Rotation of the source vector by the matrix.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector. The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void Rotate(float oVector[3], const float iVector[3]) const

Rotation of the source vector by the matrix.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector. The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void Rotate(double oVector[3], const RED::Vector3 &iVector) const

Rotation of the source vector by the matrix.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector. The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void Rotate(float oVector[3], const RED::Vector3 &iVector) const

Rotation of the source vector by the matrix.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline RED::Vector3 RotateNormalize(const RED::Vector3 &iVector) const

Rotation of the source vector by the matrix, normalization of the result.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector.

Parameters

iVector – The input vector.

Returns

The resulting rotated vector.

inline void RotateNormalize(double oVector[3], const double iVector[3]) const

Rotation of the source vector by the matrix, normalization of the result.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector. The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void RotateNormalize(double oVector[3], const float iVector[3]) const

Rotation of the source vector by the matrix, normalization of the result.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector. The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void RotateNormalize(float oVector[3], const float iVector[3]) const

Rotation of the source vector by the matrix, normalization of the result.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector. The destination address can’t be the same as the source address.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void RotateNormalize(double oVector[3], const RED::Vector3 &iVector) const

Rotation of the source vector by the matrix, normalization of the result.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

inline void RotateNormalize(float oVector[3], const RED::Vector3 &iVector) const

Rotation of the source vector by the matrix, normalization of the result.

The matrix is reduced to a [3x3] rotation matrix and is applied to iVector.

Parameters
  • oVector – The resulting rotated vector.

  • iVector – The input vector.

RED_RC Invert()

‘In-place’ inversion of ‘this’.

Computes the inverse of ‘this’, replacing the previous matrix contents.

Returns

RED_OK if the inverted matrix was correctly computed, RED_FAIL otherwise.

RED_RC GetInvert(RED::Matrix &oInverted) const

Gets the inverted matrix.

Computes and sets oInverted to the inverted matrix of ‘this’.

Parameters

oInverted – The inverted matrix of ‘this’.

Returns

RED_OK if the inverted matrix was correctly computed, RED_FAIL otherwise.

void Transpose()

Transposition of the rotation part of the matrix.

Computes the transposed matrix of ‘this’, replacing the previous matrix contents.

void Scale(const RED::Vector3 &iScale)

Scales the matrix by a per-vector component.

This method multiplies each column of the matrix (excepted the translation) by the provided axial scaling vector.

Parameters

iScaleRED::Vector3 scaling vector.

void Scale(const float iScale[3])

Scales the matrix by a per-vector component.

This method multiplies each column of the matrix (excepted the translation) by the provided axial scaling vector.

Parameters

iScaleRED::Vector3 scaling vector.

void Scale(const double iScale[3])

Scales the matrix by a per-vector component.

This method multiplies each column of the matrix (excepted the translation) by the provided axial scaling vector.

Parameters

iScaleRED::Vector3 scaling vector.

void Translate(const RED::Vector3 &iTranslate)

Translates the matrix by a translation vector.

Adds iTranslate to the current matrix translation.

Parameters

iTranslate – Translation vector.

void Translate(const float iTranslate[3])

Translates the matrix by a translation vector.

Adds iTranslate to the current matrix translation.

Parameters

iTranslate – Translation vector.

void Translate(const double iTranslate[3])

Translates the matrix by a translation vector.

Adds iTranslate to the current matrix translation.

Parameters

iTranslate – Translation vector.

double Determinant() const

Computes matrix determinant - rotation part.

Returns

The matrix determinant corresponding to the rotation part of the matrix.

double Scaling() const

Computes maximal matrix scaling.

Returns

The maximal axial scaling value of the matrix is calculated.

RED::Vector3 AxisScaling() const

Computes differential axis scaling.

Returns the per axis (e.g. column vector) scaling of the matrix.

Returns

A vector with each axis scaling.

bool IsIdentity(double iTolerance = 0.0) const

Tests whether ‘this’ is equal to the identity matrix or not.

Parameters

iTolerance – Perform the comparison at a given tolerance.

Returns

true if the matrix is equal to the identity, false otherwise.

bool IsDirect() const

Tests whether ‘this’ is direct or not.

Returns

true if the matrix is direct (e.g. has a positive determinant), false otherwise.

bool operator==(const RED::Matrix &iOperand) const

Equality test operator.

Parameters

iOperand – The source matrix compared to this.

Returns

true if the two matrices are identical, false otherwise.

bool operator!=(const RED::Matrix &iOperand) const

Difference test operator.

Parameters

iOperand – The source matrix compared to this.

Returns

true if the two matrices are different, false otherwise.

RED_RC GetUVDecomposition(double &oTranslationX, double &oTranslationY, double &oScalingX, double &oScalingY, double &oRotation) const

Returns the xy-offset, xy-scaling and z-rotation informations from a uv coordinates transform matrix.

When using matrices for uv mapping transformations, it may be useful to extract back the offset, scaling and rotation informations (to be used along with a material controller for example).

This method works only for matrices encoding 2D scaling (along x & y), 2D translation (along x & y) and rotation around the z-axis. If a matrix encoding another kind of transformation is used as input to the method, the result will be undetermined.

Parameters
  • oTranslationX – reference to the returned translation along the x-axis.

  • oTranslationY – reference to the returned translation along the y-axis.

  • oScalingX – reference to the returned scaling along the x-axis (should be positive or null).

  • oScalingY – reference to the returned scaling along the y-axis (should be positive or null).

  • oRotation – reference to the returned z-rotation angle in radians.

Returns

RED_OK on success,

RED_FAIL otherwise.

Public Members

double _mat[4][4]

Matrix elements.

Public Static Functions

static inline RED::CID GetClassID()

Public Static Attributes

static const RED::Matrix IDENTITY

Identity matrix.

static const RED::Matrix ZERO

Zero matrix.