class RED::Matrix

Homogeneous 4x4 Matrix for graphical operations. More...

#include <REDMatrix.h>

Inherits: Object.

Public functions:

Matrix ( const RED::Vector3 & iCol0, const RED::Vector3 & iCol1, const RED::Vector3 & iCol2, const RED::Vector3 & iCol3 )
Matrix ( const RED::Vector4 & iCol0, const RED::Vector4 & iCol1, const RED::Vector4 & iCol2, const RED::Vector4 & iCol3 )
Matrix ( )
Matrix ( const float * iCol0, const float * iCol1, const float * iCol2, const float * iCol3 )
Matrix ( const double * iCol0, const double * iCol1, const double * iCol2, const double * iCol3 )
Matrix ( const float * iMat )
Matrix ( double iTranslationX, double iTranslationY, double iScaleX, double iScaleY, double iRotationZ )
Matrix ( const double * iMat )
virtual ~Matrix ( )
virtual void *As ( const RED::CID & iCID )
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > const T_As *As ( ) const
template< class T_As > T_As *As ( )
RED::Vector3AxisScaling ( ) const
doubleDeterminant ( ) const
RED::Vector4GetColumn ( int iColumn ) const
voidGetColumn ( float oColumn[4], int iColumn ) const
voidGetColumn ( double oColumn[4], int iColumn ) const
voidGetColumnMajorMatrix ( float oMat[16] ) const
voidGetColumnMajorMatrix ( double oMat[16] ) const
RED_RCGetInvert ( RED::Matrix & oInverted ) const
voidGetLineMajorMatrix ( double oMat[16] ) const
voidGetLineMajorMatrix ( float oMat[16] ) const
voidGetTranslation ( double oTranslation[3] ) const
RED::Vector3GetTranslation ( ) const
voidGetTranslation ( float oTranslation[3] ) const
RED_RCGetUVDecomposition ( double & oTranslationX, double & oTranslationY, double & oScalingX, double & oScalingY, double & oRotation ) const
RED_RCInvert ( )
boolIsDirect ( ) const
boolIsIdentity ( double iTolerance = 0.0 ) const
voidMultiply ( double oVector[3], const double iVector[3] ) const
voidMultiply ( double oVector[3], const float iVector[3] ) const
voidMultiply ( float oVector[3], const float iVector[3] ) const
voidMultiply ( double oVector[3], const RED::Vector3 & iVector ) const
voidMultiply ( double oVector[3], const RED::Vector4 & iVector ) const
voidMultiply ( float oVector[3], const RED::Vector3 & iVector ) const
voidMultiply ( float oVector[3], const RED::Vector4 & iVector ) const
voidMultiply4 ( double oVector[4], const float iVector[4] ) const
voidMultiply4 ( float oVector[4], const float iVector[4] ) const
voidMultiply4 ( double oVector[4], const RED::Vector3 & iVector ) const
voidMultiply4 ( double oVector[4], const RED::Vector4 & iVector ) const
voidMultiply4 ( float oVector[4], const RED::Vector3 & iVector ) const
voidMultiply4 ( float oVector[4], const RED::Vector4 & iVector ) const
voidMultiply4 ( double oVector[4], const double iVector[4] ) const
voidMultiply4w1 ( double oVector[4], const float iVector[3] ) const
voidMultiply4w1 ( double oVector[4], const RED::Vector3 & iVector ) const
voidMultiply4w1 ( float oVector[4], const float iVector[3] ) const
voidMultiply4w1 ( float oVector[4], const double iVector[3] ) const
voidMultiply4w1 ( float oVector[4], const RED::Vector3 & iVector ) const
voidMultiply4w1 ( double oVector[4], const double iVector[3] ) const
booloperator!= ( const RED::Matrix & iOperand ) const
RED::Matrixoperator* ( const RED::Matrix & iOperand ) const
RED::Vector4operator* ( const RED::Vector3 & iOperand ) const
RED::Vector4operator* ( const RED::Vector4 & iOperand ) const
voidoperator*= ( const RED::Matrix & iOperand )
RED::Matrixoperator+ ( const RED::Matrix & iOperand ) const
voidoperator+= ( const RED::Matrix & iOperand )
RED::Matrixoperator- ( ) const
RED::Matrixoperator- ( const RED::Matrix & iOperand ) const
voidoperator-= ( const RED::Matrix & iOperand )
booloperator== ( const RED::Matrix & iOperand ) const
RED_RCOrthographicViewmappingMatrix ( double iLeft, double iRight, double iBottom, double iTop, double iDNear, double iDFar )
RED_RCPerspectiveViewmappingMatrix ( double iLeft, double iRight, double iBottom, double iTop, double iDNear, double iDFar )
voidReset ( )
RED::Vector3Rotate ( const RED::Vector3 & iVector ) const
voidRotate ( double oVector[3], const double iVector[3] ) const
voidRotate ( double oVector[3], const float iVector[3] ) const
voidRotate ( double oVector[3], const RED::Vector3 & iVector ) const
voidRotate ( float oVector[3], const RED::Vector3 & iVector ) const
voidRotate ( float oVector[3], const float iVector[3] ) const
RED::Vector3RotateNormalize ( const RED::Vector3 & iVector ) const
voidRotateNormalize ( float oVector[3], const float iVector[3] ) const
voidRotateNormalize ( float oVector[3], const RED::Vector3 & iVector ) const
voidRotateNormalize ( double oVector[3], const double iVector[3] ) const
voidRotateNormalize ( double oVector[3], const float iVector[3] ) const
voidRotateNormalize ( double oVector[3], const RED::Vector3 & iVector ) const
RED_RCRotationAngleMatrix ( const double iCenter[3], double iAx, double iAy, double iAz )
RED_RCRotationAngleMatrix ( const float iCenter[3], float iAx, float iAy, float iAz )
RED_RCRotationAngleMatrix ( const RED::Vector3 & iCenter, float iAx, float iAy, float iAz )
RED_RCRotationAxisMatrix ( const RED::Vector3 & iCenter, const RED::Vector3 & iAxis, double iAngle )
RED_RCRotationAxisMatrix ( const double iCenter[3], const double iAxis[3], double iAngle )
RED_RCRotationAxisMatrix ( const float iCenter[3], const float iAxis[3], float iAngle )
voidScale ( const float iScale[3] )
voidScale ( const double iScale[3] )
voidScale ( const RED::Vector3 & iScale )
doubleScaling ( ) const
voidScalingAxisMatrix ( const float iCenter[3], const float iScale[3] )
voidScalingAxisMatrix ( const double iCenter[3], const double iScale[3] )
voidScalingAxisMatrix ( const RED::Vector3 & iCenter, const RED::Vector3 & iScale )
voidSetColumn ( int iColumn, const double iVector[4] )
voidSetColumn ( int iColumn, const RED::Vector3 & iVector )
voidSetColumn ( int iColumn, const RED::Vector4 & iVector )
voidSetColumn ( int iColumn, const float iVector[4] )
voidSetColumnMajorMatrix ( const float iMat[16] )
voidSetColumnMajorMatrix ( const double iMat[16] )
voidSetLineMajorMatrix ( const double iMat[16] )
voidSetLineMajorMatrix ( const float iMat[16] )
voidSetTranslation ( const double iTranslation[3] )
voidSetTranslation ( const RED::Vector3 & iTranslation )
voidSetTranslation ( const float iTranslation[3] )
voidTranslate ( const float iTranslate[3] )
voidTranslate ( const double iTranslate[3] )
voidTranslate ( const RED::Vector3 & iTranslate )
voidTranspose ( )

Public static functions:

static RED::CIDGetClassID ( )

Public variables:

double_mat [4][4]

Public static variables:

static const RED::MatrixIDENTITY
static const RED::MatrixZERO

Detailed description:

Homogeneous 4x4 Matrix for graphical operations.

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.

Functions documentation

public RED::Matrix::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).
public RED::Matrix::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 construction method.

Builds an identity matrix.

public RED::Matrix::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.
public RED::Matrix::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.
public RED::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.
public RED::Matrix::Matrix(doubleiTranslationX,
doubleiTranslationY,
doubleiScaleX,
doubleiScaleY,
doubleiRotationZ
)

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.
public RED::Matrix::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.
public virtual RED::Matrix::~Matrix()

Matrix destruction method.

public virtual void * RED::Matrix::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.

Reimplements: RED::Object::As.

public virtual const void * RED::Matrix::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.

Reimplements: RED::Object::As.

template< class T_As > public const T_As * RED::Matrix::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

template< class T_As > public T_As * RED::Matrix::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

Computes differential axis scaling.

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

Returns:

A vector with each axis scaling.
public double RED::Matrix::Determinant() const

Computes matrix determinant - rotation part.

Returns:

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

Retrieves a matrix column vector.

Parameters:

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

Returns:

The requested column vector.
public void RED::Matrix::GetColumn(floatoColumn[4],
intiColumn
)const

Retrieves a matrix column vector.

Parameters:

oColumn:The column vector.
iColumn:The column vector number in [0,3].
public void RED::Matrix::GetColumn(doubleoColumn[4],
intiColumn
)const

Retrieves a matrix column vector.

Parameters:

oColumn:The column vector.
iColumn:The column vector number in [0,3].
public void RED::Matrix::GetColumnMajorMatrix(floatoMat[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'.
public void RED::Matrix::GetColumnMajorMatrix(doubleoMat[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'.
public RED_RC RED::Matrix::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.
public void RED::Matrix::GetLineMajorMatrix(doubleoMat[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.
public void RED::Matrix::GetLineMajorMatrix(floatoMat[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.
public void RED::Matrix::GetTranslation(doubleoTranslation[3]) const

Gets the matrix translation vector.

Parameters:

oTranslation:The translation vector.

Gets the matrix translation vector.

Returns:

The translation vector.
public void RED::Matrix::GetTranslation(floatoTranslation[3]) const

Gets the matrix translation vector.

Parameters:

oTranslation:The translation vector.
public RED_RC RED::Matrix::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.

'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.
public bool RED::Matrix::IsDirect() const

Tests whether 'this' is direct or not.

Returns:

true if the matrix is direct (e.g. has a positive determinant), false otherwise.
public bool RED::Matrix::IsIdentity(doubleiTolerance = 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.
public void RED::Matrix::Multiply(doubleoVector[3],
const doubleiVector[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.
public void RED::Matrix::Multiply(doubleoVector[3],
const floatiVector[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.
public void RED::Matrix::Multiply(floatoVector[3],
const floatiVector[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.
public void RED::Matrix::Multiply(doubleoVector[3],
const RED::Vector3 &iVector
)const

Non homogeneous multiplication of a vector by the matrix.

Parameters:

oVector:The resulting vector.
iVector:The input vector.
public void RED::Matrix::Multiply(doubleoVector[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).
public void RED::Matrix::Multiply(floatoVector[3],
const RED::Vector3 &iVector
)const

Non homogeneous multiplication of a vector by the matrix.

Parameters:

oVector:The resulting vector.
iVector:The input vector.
public void RED::Matrix::Multiply(floatoVector[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).
public void RED::Matrix::Multiply4(doubleoVector[4],
const floatiVector[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.
public void RED::Matrix::Multiply4(floatoVector[4],
const floatiVector[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.
public void RED::Matrix::Multiply4(doubleoVector[4],
const RED::Vector3 &iVector
)const

Homogeneous multiplication of a vector by the matrix.

Parameters:

oVector:The resulting vector.
iVector:The input vector.
public void RED::Matrix::Multiply4(doubleoVector[4],
const RED::Vector4 &iVector
)const

Homogeneous multiplication of a vector by the matrix.

Parameters:

oVector:The resulting vector.
iVector:The input vector.
public void RED::Matrix::Multiply4(floatoVector[4],
const RED::Vector3 &iVector
)const

Homogeneous multiplication of a vector by the matrix.

Parameters:

oVector:The resulting vector.
iVector:The input vector.
public void RED::Matrix::Multiply4(floatoVector[4],
const RED::Vector4 &iVector
)const

Homogeneous multiplication of a vector by the matrix.

Parameters:

oVector:The resulting vector.
iVector:The input vector.
public void RED::Matrix::Multiply4(doubleoVector[4],
const doubleiVector[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.
public void RED::Matrix::Multiply4w1(doubleoVector[4],
const floatiVector[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).
public void RED::Matrix::Multiply4w1(doubleoVector[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).
public void RED::Matrix::Multiply4w1(floatoVector[4],
const floatiVector[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).
public void RED::Matrix::Multiply4w1(floatoVector[4],
const doubleiVector[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).
public void RED::Matrix::Multiply4w1(floatoVector[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).
public void RED::Matrix::Multiply4w1(doubleoVector[4],
const doubleiVector[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).
public bool RED::Matrix::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.
public RED::Matrix RED::Matrix::operator*(const RED::Matrix &iOperand) const

Matrix multiplication operator.

Returns:

the product of this * iOperand.
public RED::Vector4 RED::Matrix::operator*(const RED::Vector3 &iOperand) const

Homogeneous multiplication of a vector by the matrix.

Returns:

The product of this * iOperand.
public RED::Vector4 RED::Matrix::operator*(const RED::Vector4 &iOperand) const

Homogeneous multiplication of a vector by the matrix.

Returns:

The product of this * iOperand.
public void RED::Matrix::operator*=(const RED::Matrix &iOperand)

Matrix multiplication operator.

Multiplt this by iOperand.

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

Matrix addition operator.

Returns:

the sum of this + iOperand.
public void RED::Matrix::operator+=(const RED::Matrix &iOperand)

Matrix addition operator.

Adds the contents of iOperand to this.

Returns the opposite of the matrix.

Returns:

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

Matrix subtraction operator.

Returns:

the subtraction of this - iOperand.
public void RED::Matrix::operator-=(const RED::Matrix &iOperand)

Matrix subtraction operator.

Subtract the contents of iOperand to this.

public bool RED::Matrix::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.
public RED_RC RED::Matrix::OrthographicViewmappingMatrix(doubleiLeft,
doubleiRight,
doubleiBottom,
doubleiTop,
doubleiDNear,
doubleiDFar
)

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.
public RED_RC RED::Matrix::PerspectiveViewmappingMatrix(doubleiLeft,
doubleiRight,
doubleiBottom,
doubleiTop,
doubleiDNear,
doubleiDFar
)

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.
public void RED::Matrix::Reset()

Resets the matrix to the identity.

public RED::Vector3 RED::Matrix::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.
public void RED::Matrix::Rotate(doubleoVector[3],
const doubleiVector[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.
public void RED::Matrix::Rotate(doubleoVector[3],
const floatiVector[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.
public void RED::Matrix::Rotate(doubleoVector[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.
public void RED::Matrix::Rotate(floatoVector[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.
public void RED::Matrix::Rotate(floatoVector[3],
const floatiVector[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.

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.
public void RED::Matrix::RotateNormalize(floatoVector[3],
const floatiVector[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.
public void RED::Matrix::RotateNormalize(floatoVector[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.
public void RED::Matrix::RotateNormalize(doubleoVector[3],
const doubleiVector[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.
public void RED::Matrix::RotateNormalize(doubleoVector[3],
const floatiVector[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.
public void RED::Matrix::RotateNormalize(doubleoVector[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.
public RED_RC RED::Matrix::RotationAngleMatrix(const doubleiCenter[3],
doubleiAx,
doubleiAy,
doubleiAz
)

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.
public RED_RC RED::Matrix::RotationAngleMatrix(const floatiCenter[3],
floatiAx,
floatiAy,
floatiAz
)

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.
public RED_RC RED::Matrix::RotationAngleMatrix(const RED::Vector3 &iCenter,
floatiAx,
floatiAy,
floatiAz
)

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.
public RED_RC RED::Matrix::RotationAxisMatrix(const RED::Vector3 &iCenter,
const RED::Vector3 &iAxis,
doubleiAngle
)

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.
public RED_RC RED::Matrix::RotationAxisMatrix(const doubleiCenter[3],
const doubleiAxis[3],
doubleiAngle
)

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.
public RED_RC RED::Matrix::RotationAxisMatrix(const floatiCenter[3],
const floatiAxis[3],
floatiAngle
)

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.
public void RED::Matrix::Scale(const floatiScale[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:

iScale:RED::Vector3 scaling vector.
public void RED::Matrix::Scale(const doubleiScale[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:

iScale:RED::Vector3 scaling vector.
public void RED::Matrix::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:

iScale:RED::Vector3 scaling vector.
public double RED::Matrix::Scaling() const

Computes maximal matrix scaling.

Returns:

The maximal axial scaling value of the matrix is calculated.
public void RED::Matrix::ScalingAxisMatrix(const floatiCenter[3],
const floatiScale[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.
public void RED::Matrix::ScalingAxisMatrix(const doubleiCenter[3],
const doubleiScale[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.
public void RED::Matrix::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.
public void RED::Matrix::SetColumn(intiColumn,
const doubleiVector[4]
)

SetColumn: Set a matrix column vector.

Parameters:

iColumn:The column vector number in [0,3].
iVector:The column vector.
public void RED::Matrix::SetColumn(intiColumn,
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.
public void RED::Matrix::SetColumn(intiColumn,
const RED::Vector4 &iVector
)

Sets a matrix column vector.

Parameters:

iColumn:The column vector number in [0,3].
iVector:The column vector.
public void RED::Matrix::SetColumn(intiColumn,
const floatiVector[4]
)

Sets a matrix column vector.

Parameters:

iColumn:The column vector number in [0,3].
iVector:The column vector.
public void RED::Matrix::SetColumnMajorMatrix(const floatiMat[16])

Defines a matrix from a column major matrix array.

Parameters:

iMat:Column major matrix array.
public void RED::Matrix::SetColumnMajorMatrix(const doubleiMat[16])

Defines a matrix from a column major matrix array.

Parameters:

iMat:Column major matrix array.
public void RED::Matrix::SetLineMajorMatrix(const doubleiMat[16])

Defines a matrix from a line major matrix array.

Parameters:

iMat:Line major matrix array.
public void RED::Matrix::SetLineMajorMatrix(const floatiMat[16])

Defines a matrix from a line major matrix array.

Parameters:

iMat:Line major matrix array.
public void RED::Matrix::SetTranslation(const doubleiTranslation[3])

Sets the matrix translation column.

Parameters:

iTranslation:The translation vector.
public void RED::Matrix::SetTranslation(const RED::Vector3 &iTranslation)

Sets the matrix translation column.

Parameters:

iTranslation:The translation vector.
public void RED::Matrix::SetTranslation(const floatiTranslation[3])

Sets the matrix translation column.

Parameters:

iTranslation:The translation vector.
public void RED::Matrix::Translate(const floatiTranslate[3])

Translates the matrix by a translation vector.

Adds iTranslate to the current matrix translation.

Parameters:

iTranslate:Translation vector.
public void RED::Matrix::Translate(const doubleiTranslate[3])

Translates the matrix by a translation vector.

Adds iTranslate to the current matrix translation.

Parameters:

iTranslate:Translation vector.
public void RED::Matrix::Translate(const RED::Vector3 &iTranslate)

Translates the matrix by a translation vector.

Adds iTranslate to the current matrix translation.

Parameters:

iTranslate:Translation vector.

Transposition of the rotation part of the matrix.

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

Variables documentation

public double RED::Matrix::_mat[4][4]

Matrix elements.

Identity matrix.

public static const RED::Matrix RED::Matrix::ZERO

Zero matrix.