FBX C++ API Reference
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FbxAMatrix Class Reference

#include <fbxaffinematrix.h>

Class Description

FBX SDK affine matrix class.

Matrices are defined using the Column Major scheme. When a FbxAMatrix represents a transformation (translation, rotation and scale), the last row of the matrix represents the translation part of the transformation.

Remarks
It is important to realize that an affine matrix must respect a certain structure. To be sure the structure is respected, use SetT, SetR, SetS, SetQ, SetTRS or SetTQS. If by mistake bad data is entered in this affine matrix, some functions such as Inverse() will yield wrong results. If a matrix is needed to hold values that aren't associate with an affine matrix, please use FbxMatrix instead.
Examples:
ExportScene01/main.cxx, ExportScene05/main.cxx, ImportScene/DisplayLink.cxx, ImportScene/DisplayPose.cxx, Pivot/main.cxx, StereoCamera/main.cxx, SwitchBinding/main.cxx, Transformations/main.cxx, ViewScene/DrawScene.cxx, ViewScene/DrawScene.h, ViewScene/GetPosition.cxx, ViewScene/GetPosition.h, ViewScene/GlFunctions.cxx, ViewScene/GlFunctions.h, ViewScene/SceneContext.cxx, ViewScene/SceneContext.h, and ViewScene/SetCamera.cxx.

Definition at line 31 of file fbxaffinematrix.h.

+ Inheritance diagram for FbxAMatrix:

Public Member Functions

bool IsIdentity (const double pThreshold=(1.0e-6))
 Find out if the matrix is equal to identity matrix. More...
 
- Public Member Functions inherited from FbxVectorTemplate4< T >
 FbxVectorTemplate4 ()
 
 FbxVectorTemplate4 (T pValue)
 
 FbxVectorTemplate4 (T pData0, T pData1, T pData2, T pData3)
 
 ~FbxVectorTemplate4 ()
 
T & operator[] (int pIndex)
 
const T & operator[] (int pIndex) const
 
 operator FbxVectorTemplate3< T > & () const
 
FbxVectorTemplate4< T > & operator= (const T &pValue)
 
FbxVectorTemplate4< T > & operator= (const FbxVectorTemplate3< T > &pValue)
 
FbxVectorTemplate4< T > & operator= (const FbxVectorTemplate4< T > &pVector)
 
bool operator== (const FbxVectorTemplate4< T > &pVector) const
 
bool operator!= (const FbxVectorTemplate4< T > &pVector) const
 
T * Buffer ()
 
const T * Buffer () const
 

Constructors and Destructor

 FbxAMatrix ()
 Constructor. More...
 
 FbxAMatrix (const FbxAMatrix &pOther)
 Copy constructor. More...
 
 FbxAMatrix (const FbxVector4 &pT, const FbxVector4 &pR, const FbxVector4 &pS)
 Constructor. More...
 
 ~FbxAMatrix ()
 Destructor. More...
 

Access

double Get (int pY, int pX) const
 Retrieve matrix element. More...
 
FbxVector4 GetT () const
 Extract translation vector. More...
 
FbxVector4 GetR () const
 Extract rotation vector. More...
 
FbxQuaternion GetQ () const
 Extract quaternion vector. More...
 
FbxVector4 GetS () const
 Extract scale vector. More...
 
FbxVector4 GetRow (int pY) const
 Extract a row vector. More...
 
FbxVector4 GetColumn (int pX) const
 Extract a column vector. More...
 
void SetIdentity ()
 Set matrix to identity. More...
 
void SetT (const FbxVector4 &pT)
 Set matrix's translation. More...
 
void SetR (const FbxVector4 &pR)
 Set matrix's Euler rotation. More...
 
void SetQ (const FbxQuaternion &pQ)
 Set matrix's quaternion. More...
 
void SetS (const FbxVector4 &pS)
 Set matrix's scale. More...
 
void SetTRS (const FbxVector4 &pT, const FbxVector4 &pR, const FbxVector4 &pS)
 Set matrix. More...
 
void SetTQS (const FbxVector4 &pT, const FbxQuaternion &pQ, const FbxVector4 &pS)
 Set matrix. More...
 
FbxAMatrixoperator= (const FbxAMatrix &pM)
 Assignment operator. More...
 

Scalar Operations

FbxAMatrix operator* (double pValue) const
 Multiply matrix by a scalar value. More...
 
FbxAMatrix operator/ (double pValue) const
 Divide matrix by a scalar value. More...
 
FbxAMatrixoperator*= (double pValue)
 Multiply matrix by a scalar value. More...
 
FbxAMatrixoperator/= (double pValue)
 Divide matrix by a scalar value. More...
 

Vector Operations

FbxVector4 MultT (const FbxVector4 &pVector4) const
 Multiply matrix by a translation vector. More...
 
FbxVector4 MultR (const FbxVector4 &pVector4) const
 Multiply matrix by an Euler rotation vector. More...
 
FbxQuaternion MultQ (const FbxQuaternion &pQuaternion) const
 Multiply matrix by a quaternion. More...
 
FbxVector4 MultS (const FbxVector4 &pVector4) const
 Multiply matrix by a scale vector. More...
 

Matrix Operations

FbxAMatrix operator- () const
 Unary minus operator. More...
 
FbxAMatrix operator* (const FbxAMatrix &pOther) const
 Multiply two matrices together. More...
 
FbxAMatrixoperator*= (const FbxAMatrix &pOther)
 Multiply two matrices together. More...
 
FbxAMatrix Inverse () const
 Calculate the matrix inverse. More...
 
FbxAMatrix Transpose () const
 Calculate the matrix transpose. More...
 
FbxAMatrix Slerp (const FbxAMatrix &pOther, double pWeight) const
 Calculate a spherical linear interpolation matrix. More...
 

Boolean Operations

bool operator== (const FbxAMatrix &pOther) const
 Equivalence operator. More...
 
bool operator!= (const FbxAMatrix &pOther) const
 Non-equivalence operator. More...
 

Casting

typedef const double(kDouble44)[4][4]
 Define 4*4 array as a new type. More...
 
 operator double * ()
 Cast the matrix in a double pointer. More...
 
 operator const double * () const
 Cast the matrix in a const double pointer. More...
 
kDouble44 & Double44 () const
 Cast the matrix in a reference to a 4*4 array. More...
 

Additional Inherited Members

- Public Attributes inherited from FbxVectorTemplate4< T >
mData [4]
 

Member Typedef Documentation

◆ double

typedef const double(kDouble44)[4][4]

Define 4*4 array as a new type.

Definition at line 303 of file fbxaffinematrix.h.

Constructor & Destructor Documentation

◆ FbxAMatrix() [1/3]

Constructor.

◆ FbxAMatrix() [2/3]

FbxAMatrix ( const FbxAMatrix pOther)

Copy constructor.

Parameters
pOtherFbxAMatrix copied to this one.

◆ FbxAMatrix() [3/3]

FbxAMatrix ( const FbxVector4 pT,
const FbxVector4 pR,
const FbxVector4 pS 
)

Constructor.

Parameters
pTTranslation vector.
pREuler rotation vector.
pSScale vector.

◆ ~FbxAMatrix()

~FbxAMatrix ( )

Destructor.

Member Function Documentation

◆ Get()

double Get ( int  pY,
int  pX 
) const

Retrieve matrix element.

Parameters
pYRow index.
pXColumn index.
Returns
Cell [ pX, pY ] value.

◆ GetT()

◆ GetR()

FbxVector4 GetR ( ) const

Extract rotation vector.

Returns
Rotation vector.
Remarks
The returned rotation vector is in Euler angle and the rotation order is XYZ.
Examples:
ImportScene/DisplayLink.cxx, StereoCamera/main.cxx, and Transformations/main.cxx.

◆ GetQ()

FbxQuaternion GetQ ( ) const

Extract quaternion vector.

Returns
Quaternion vector.
Examples:
ViewScene/DrawScene.cxx.

◆ GetS()

FbxVector4 GetS ( ) const

Extract scale vector.

Returns
Scale vector.
Examples:
ImportScene/DisplayLink.cxx, and StereoCamera/main.cxx.

◆ GetRow()

FbxVector4 GetRow ( int  pY) const

Extract a row vector.

Parameters
pYRow index.
Returns
The row vector.
Examples:
ImportScene/DisplayPose.cxx, and Transformations/main.cxx.

◆ GetColumn()

FbxVector4 GetColumn ( int  pX) const

Extract a column vector.

Parameters
pXColumn index.
Returns
The column vector.

◆ SetIdentity()

void SetIdentity ( )

Set matrix to identity.

Examples:
Transformations/main.cxx, and ViewScene/DrawScene.cxx.

◆ SetT()

void SetT ( const FbxVector4 pT)

Set matrix's translation.

Parameters
pTTranslation vector.
Examples:
ExportScene05/main.cxx, Transformations/main.cxx, and ViewScene/SetCamera.cxx.

◆ SetR()

void SetR ( const FbxVector4 pR)

Set matrix's Euler rotation.

Parameters
pRX, Y and Z rotation values expressed as a vector.
Remarks
The rotation transform is constructed in rotation order XYZ.
Examples:
ExportScene05/main.cxx, Transformations/main.cxx, ViewScene/DrawScene.cxx, and ViewScene/SetCamera.cxx.

◆ SetQ()

void SetQ ( const FbxQuaternion pQ)

Set matrix's quaternion.

Parameters
pQThe new quaternion.

◆ SetS()

void SetS ( const FbxVector4 pS)

Set matrix's scale.

Parameters
pSX, Y and Z scaling factors expressed as a vector.
Examples:
ExportScene05/main.cxx, and Transformations/main.cxx.

◆ SetTRS()

void SetTRS ( const FbxVector4 pT,
const FbxVector4 pR,
const FbxVector4 pS 
)

Set matrix.

Parameters
pTTranslation vector.
pRRotation vector.
pSScale vector.

◆ SetTQS()

void SetTQS ( const FbxVector4 pT,
const FbxQuaternion pQ,
const FbxVector4 pS 
)

Set matrix.

Parameters
pTTranslation vector.
pQQuaternion vector.
pSScale vector.

◆ operator=()

FbxAMatrix& operator= ( const FbxAMatrix pM)

Assignment operator.

Parameters
pMFbxAMatrix assigned to this one.

◆ operator*() [1/2]

FbxAMatrix operator* ( double  pValue) const

Multiply matrix by a scalar value.

Parameters
pValueScalar value.
Returns
The scaled matrix.
Remarks
The passed value is not checked. This operator operates on the first three rows and columns of the matrix. So only the rotation and scaling are scaled, not the translation part. After operation, the translation vector will be set as (0,0,0,1);

◆ operator/()

FbxAMatrix operator/ ( double  pValue) const

Divide matrix by a scalar value.

Parameters
pValueScalar value.
Returns
The divided matrix.
Remarks
The passed value is not checked. This operator operates on the first three rows and columns of the matrix. So only the rotation and scaling are scaled, not the translation part. After operation, the translation vector will be set as (0,0,0,1);

◆ operator*=() [1/2]

FbxAMatrix& operator*= ( double  pValue)

Multiply matrix by a scalar value.

Parameters
pValueScalar value.
Returns
this updated with the result of the multiplication.
Remarks
The passed value is not checked. This operator operates on the first three rows and columns of the matrix. So only the rotation and scaling are scaled, not the translation part. After operation, the translation vector will keep original value.

◆ operator/=()

FbxAMatrix& operator/= ( double  pValue)

Divide matrix by a scalar value.

Parameters
pValueScalar value.
Returns
this updated with the result of the division.
Remarks
The passed value is not checked. This operator operates on the first three rows and columns of the matrix. So only the rotation and scaling are scaled, not the translation part. After operation, the translation vector will keep original value.

◆ MultT()

FbxVector4 MultT ( const FbxVector4 pVector4) const

Multiply matrix by a translation vector.

Parameters
pVector4Translation vector.
Returns
t' = M * t
Examples:
Transformations/main.cxx, ViewScene/DrawScene.cxx, and ViewScene/SetCamera.cxx.

◆ MultR()

FbxVector4 MultR ( const FbxVector4 pVector4) const

Multiply matrix by an Euler rotation vector.

Parameters
pVector4Euler Rotation vector.
Returns
r' = M * r

◆ MultQ()

FbxQuaternion MultQ ( const FbxQuaternion pQuaternion) const

Multiply matrix by a quaternion.

Parameters
pQuaternionRotation value.
Returns
q' = M * q

◆ MultS()

FbxVector4 MultS ( const FbxVector4 pVector4) const

Multiply matrix by a scale vector.

Parameters
pVector4Scaling vector.
Returns
s' = M * s

◆ operator-()

FbxAMatrix operator- ( ) const

Unary minus operator.

Returns
A matrix where each element is multiplied by -1.

◆ operator*() [2/2]

FbxAMatrix operator* ( const FbxAMatrix pOther) const

Multiply two matrices together.

Parameters
pOtherA Matrix.
Returns
this * pMatrix.
Remarks
Transformations are pre-multiplied. That means to scale, then rotate, and then translate a vector V, the transform should be T * R * S * V.
Below is an example of code that shows how to construct rotation transform in XYZ rotation order.
FbxAMatrix lRotateXM, lRotateYM, lRotateZM, lRotateXYZM, lRotateM;
// Construct rotation matrix around X, Y and Z axises separately and then combine them.
FbxVector4 lRotateX(10, 0, 0);
FbxVector4 lRotateY(0, 10, 0);
FbxVector4 lRotateZ(0, 0, 10);
lRotateXM.SetR(lRotateX);
lRotateYM.SetR(lRotateY);
lRotateZM.SetR(lRotateZ);
lRotateXYZM = lRotateZM * lRotateYM * lRotateXM;
// Alternatively, we can use SetR() directly.
// lRotateXYZM and lRotateM will be the same.
FbxVector4 lRotateXYZ (10, 10, 10);
lRotateM.SetR(lRotateXYZ);
Note
Please refer to the FBX SDK programmers guide for more details.

◆ operator*=() [2/2]

FbxAMatrix& operator*= ( const FbxAMatrix pOther)

Multiply two matrices together.

Parameters
pOtherA Matrix.
Returns
this updated with the result of the multiplication.

◆ Inverse()

FbxAMatrix Inverse ( ) const

Calculate the matrix inverse.

Returns
The inverse matrix of this.
Examples:
ExportScene05/main.cxx, Transformations/main.cxx, ViewScene/DrawScene.cxx, and ViewScene/SetCamera.cxx.

◆ Transpose()

FbxAMatrix Transpose ( ) const

Calculate the matrix transpose.

Returns
The transposed matrix of this.

◆ Slerp()

FbxAMatrix Slerp ( const FbxAMatrix pOther,
double  pWeight 
) const

Calculate a spherical linear interpolation matrix.

Parameters
pOtherThe other rotation matrix to interpolate with.
pWeightA value between 0.0 and 1.0 to specify the interpolation amount.
Remarks
This matrix and other matrix should contain only rotations, otherwise result may be undefined.

◆ operator==()

bool operator== ( const FbxAMatrix pOther) const

Equivalence operator.

Parameters
pOtherThe matrix to be compared to this.
Returns
true if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance) and false otherwise.

◆ operator!=()

bool operator!= ( const FbxAMatrix pOther) const

Non-equivalence operator.

Parameters
pOtherThe matrix to be compared to this.
Returns
false if the two matrices are equal (each element is within a FBXSDK_TOLERANCE tolerance) and true otherwise.

◆ operator double *()

operator double * ( )

Cast the matrix in a double pointer.

◆ operator const double *()

operator const double * ( ) const

Cast the matrix in a const double pointer.

◆ Double44()

kDouble44& Double44 ( ) const
inline

Cast the matrix in a reference to a 4*4 array.

Definition at line 305 of file fbxaffinematrix.h.

305 { return *((kDouble44 *)&mData[0][0]); }

◆ IsIdentity()

bool IsIdentity ( const double  pThreshold = (1.0e-6))

Find out if the matrix is equal to identity matrix.

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

The documentation for this class was generated from the following file: