Public Member Functions

KFbxXMatrix Class Reference

This reference page is linked to from the following overview topics: List of Python FBX classes.


Search for all occurrences

Detailed Description

FBX SDK affine matrix class.

Matrices are defined using the Column Major scheme. When a KFbxXMatrix 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 KFbxMatrix 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/GetPosition.cxx, ViewScene/GetPosition.h, ViewScene/GlFunctions.cxx, ViewScene/GlFunctions.h, and ViewScene/SetCamera.cxx.

Definition at line 61 of file kfbxxmatrix.h.

#include <kfbxxmatrix.h>

Inheritance diagram for KFbxXMatrix:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void  CreateKFbxXMatrixRotation (double pX, double pY, double pZ)
void  V2M (KFbxXMatrix &pMatrix, const KFbxVector4 &pVector, ERotationOrder pRotationOrder)
void  M2V (KFbxVector4 &pVector, const KFbxXMatrix &pMatrix, ERotationOrder pRotationOrder)

Constructors and Destructor

  KFbxXMatrix ()
  Constructor.
  KFbxXMatrix (const KFbxXMatrix &pXMatrix)
  Copy constructor.
  KFbxXMatrix (const KFbxVector4 &pT, const KFbxVector4 &pR, const KFbxVector4 &pS)
  Constructor.
  ~KFbxXMatrix ()
  Destructor.

Access

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

Scalar Operations

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

Vector Operations

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

Matrix Operations

KFbxXMatrix  operator- () const
  Unary minus operator.
KFbxXMatrix  operator* (const KFbxXMatrix &pXMatrix) const
  Multiply two matrices together.
KFbxXMatrix operator*= (const KFbxXMatrix &pXMatrix)
  Multiply two matrices together.
KFbxXMatrix  Inverse () const
  Calculate the matrix inverse.
KFbxXMatrix  Transpose () const
  Calculate the matrix transpose.

Boolean Operations

bool  operator== (const KFbxXMatrix &pXMatrix) const
  Equivalence operator.
bool  operator!= (const KFbxXMatrix &pXMatrix) const
  Non-equivalence operator.

Casting

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

Internal Casting

KFbxXMatrix operator= (const KgeAMatrix &pAMatrix)
  operator KgeAMatrix & ()

Member Typedef Documentation

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

Define 4*4 array as a new type.

Definition at line 347 of file kfbxxmatrix.h.


Constructor & Destructor Documentation

Constructor.

KFbxXMatrix ( const KFbxXMatrix pXMatrix )

Copy constructor.

Parameters:
pXMatrix KFbxXMatrix copied to this one.
KFbxXMatrix ( const KFbxVector4 pT,
const KFbxVector4 pR,
const KFbxVector4 pS 
)

Constructor.

Parameters:
pT Translation vector.
pR Euler rotation vector.
pS Scale vector.

Destructor.


Member Function Documentation

double Get ( int  pY,
int  pX 
) const

Retrieve matrix element.

Parameters:
pY Row index.
pX Column index.
Returns:
Cell [ pX, pY ] value.
KFbxVector4 GetT ( ) const
KFbxVector4 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.
KFbxQuaternion GetQ ( ) const

Extract quaternion vector.

Returns:
Quaternion vector.
Examples:
ViewScene/DrawScene.cxx.
KFbxVector4 GetS ( ) const

Extract scale vector.

Returns:
Scale vector.
Examples:
ImportScene/DisplayLink.cxx, and StereoCamera/main.cxx.
KFbxVector4 GetRow ( int  pY ) const

Extract a row vector.

Parameters:
pY Row index.
Returns:
The row vector.
Examples:
ImportScene/DisplayPose.cxx, and Transformations/main.cxx.
KFbxVector4 GetColumn ( int  pX ) const

Extract a column vector.

Parameters:
pX Column index.
Returns:
The column vector.
void SetIdentity ( )

Set matrix to identity.

Examples:
ViewScene/DrawScene.cxx.
void SetT ( const KFbxVector4 pT )

Set matrix's translation.

Parameters:
pT Translation vector.
Examples:
ExportScene05/main.cxx, Transformations/main.cxx, ViewScene/GetPosition.cxx, and ViewScene/SetCamera.cxx.
void SetR ( const KFbxVector4 pR )

Set matrix's Euler rotation.

Parameters:
pR X, 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, ViewScene/GetPosition.cxx, and ViewScene/SetCamera.cxx.
void SetQ ( const KFbxQuaternion pQ )

Set matrix's quaternion.

Parameters:
pQ The new quaternion.
void SetS ( const KFbxVector4 pS )

Set matrix's scale.

Parameters:
pS X, Y and Z scaling factors expressed as a vector.
Examples:
ExportScene05/main.cxx, Transformations/main.cxx, and ViewScene/GetPosition.cxx.
void SetTRS ( const KFbxVector4 pT,
const KFbxVector4 pR,
const KFbxVector4 pS 
)

Set matrix.

Parameters:
pT Translation vector.
pR Rotation vector.
pS Scale vector.
void SetTQS ( const KFbxVector4 pT,
const KFbxQuaternion pQ,
const KFbxVector4 pS 
)

Set matrix.

Parameters:
pT Translation vector.
pQ Quaternion vector.
pS Scale vector.
KFbxXMatrix& operator= ( const KFbxXMatrix pM )

Assignment operator.

Parameters:
pM KFbxXMatrix assigned to this one.
KFbxXMatrix operator* ( double  pValue ) const

Multiply matrix by a scalar value.

Parameters:
pValue Scalar 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);
KFbxXMatrix operator/ ( double  pValue ) const

Divide matrix by a scalar value.

Parameters:
pValue Scalar 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);
KFbxXMatrix& operator*= ( double  pValue )

Multiply matrix by a scalar value.

Parameters:
pValue Scalar 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.
KFbxXMatrix& operator/= ( double  pValue )

Divide matrix by a scalar value.

Parameters:
pValue Scalar 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.
KFbxVector4 MultT ( const KFbxVector4 pVector4 ) const

Multiply matrix by a translation vector.

Parameters:
pVector4 Translation vector.
Returns:
t' = M * t
Examples:
Transformations/main.cxx, ViewScene/DrawScene.cxx, and ViewScene/SetCamera.cxx.
KFbxVector4 MultR ( const KFbxVector4 pVector4 ) const

Multiply matrix by an Euler rotation vector.

Parameters:
pVector4 Euler Rotation vector.
Returns:
r' = M * r
KFbxQuaternion MultQ ( const KFbxQuaternion pQuaternion ) const

Multiply matrix by a quaternion.

Parameters:
pQuaternion Rotation value.
Returns:
q' = M * q
KFbxVector4 MultS ( const KFbxVector4 pVector4 ) const

Multiply matrix by a scale vector.

Parameters:
pVector4 Scaling vector.
Returns:
s' = M * s
KFbxXMatrix operator- ( ) const

Unary minus operator.

Returns:
A matrix where each element is multiplied by -1.
KFbxXMatrix operator* ( const KFbxXMatrix pXMatrix ) const

Multiply two matrices together.

Parameters:
pXMatrix A 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.
  KFbxXMatrix lRotateXM, lRotateYM, lRotateZM, lRotateXYZM, lRotateM;
  // Construct rotation matrix around X, Y and Z axises separately and then combine them.
  KFbxVector4 lRotateX(10, 0, 0);
  KFbxVector4 lRotateY(0, 10, 0);
  KFbxVector4 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.
  KFbxVector4 lRotateXYZ (10, 10, 10);
  lRotateM.SetR(lRotateXYZ);
Note:
Please refer to the FBX SDK programmers guide for more details.
KFbxXMatrix& operator*= ( const KFbxXMatrix pXMatrix )

Multiply two matrices together.

Parameters:
pXMatrix A Matrix.
Returns:
this updated with the result of the multiplication.
KFbxXMatrix 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.
KFbxXMatrix Transpose ( ) const

Calculate the matrix transpose.

Returns:
The transposed matrix of this.
bool operator== ( const KFbxXMatrix pXMatrix ) const

Equivalence operator.

Parameters:
pXMatrix The matrix to be compared to this.
Returns:
true if the two matrices are equal (each element is within a 1.0e-6 tolerance) and false otherwise.
bool operator!= ( const KFbxXMatrix pXMatrix ) const

Non-equivalence operator.

Parameters:
pXMatrix The matrix to be compared to this.
Returns:
false if the two matrices are equal (each element is within a 1.0e-6 tolerance) and true otherwise.
operator double * ( )

Cast the matrix in a double pointer.

operator const double * ( ) const

Cast the matrix in a const double pointer.

kDouble44& Double44 ( ) const [inline]

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

Definition at line 349 of file kfbxxmatrix.h.

{ return *((kDouble44 *)&mData); }
void CreateKFbxXMatrixRotation ( double  pX,
double  pY,
double  pZ 
)
void V2M ( KFbxXMatrix pMatrix,
const KFbxVector4 pVector,
ERotationOrder  pRotationOrder 
)
void M2V ( KFbxVector4 pVector,
const KFbxXMatrix pMatrix,
ERotationOrder  pRotationOrder 
)
KFbxXMatrix& operator= ( const KgeAMatrix &  pAMatrix )
operator KgeAMatrix & ( )

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

KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix
KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix KFbxXMatrix