fbmath.h File Reference


Detailed Description

fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h fbmath.h
Contains routines for vector and matrix manipulation.

Definition in file fbmath.h.

#include <kaydaradef.h>
#include <fbsdk/fbtypes.h>

Include dependency graph for fbmath.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Defines

#define  FBSDK_DLL   K_DLLIMPORT
  Be sure that FBSDK_DLL is defined only once.

Enumerations

enum   FBRotationOrder {
   kFBXYZ,
   kFBXZY,
   kFBYXZ,
   kFBYZX,
   kFBZXY,
   kFBZYX
}
  Specify the Euler rotation order. More...

Functions

K_DLLIMPORT void  FBMatrixInverse (FBMatrix &pMatrix, FBMatrix &pSrc)
  Invert a matrix.
K_DLLIMPORT void  FBMatrixTranspose (FBMatrix &pMatrix, FBMatrix &pSrc)
  Transpose a matrix.
K_DLLIMPORT void  FBMatrixMult (FBMatrix &pMatrix, FBMatrix &pA, FBMatrix &pB)
  Multiply two matrices.
K_DLLIMPORT void  FBVertexMatrixMult (FBVertex &pOutVertex, FBMatrix &pMatrix, FBVertex &pVertex)
  Multiply a vertex by a matrix.
K_DLLIMPORT void  FBVectorMatrixMult (FBVector4d &pOutVector, FBMatrix &pMatrix, FBVector4d &pVector)
  Multiply a vector by a matrix.
K_DLLIMPORT void  FBTranslationToMatrix (FBMatrix &pMatrix, FBTVector pVector)
  Convert a translation vector to a matrix.
K_DLLIMPORT void  FBRotationToMatrix (FBMatrix &pMatrix, FBRVector pVector, FBRotationOrder pRotationOrder=kFBXYZ)
  Convert a rotation vector to a matrix.
K_DLLIMPORT void  FBScalingToMatrix (FBMatrix &pMatrix, FBSVector pVector)
  Convert a scaling vector to a matrix.
K_DLLIMPORT void  FBTRSToMatrix (FBMatrix &pMatrix, FBTVector pTVector, FBRVector pRVector, FBSVector pSVector)
  Convert translation, rotation, and scaling vectors to a matrix.
K_DLLIMPORT void  FBMatrixToTranslation (FBTVector &pVector, FBMatrix pMatrix)
  Obtain translation vector from a matrix.
K_DLLIMPORT void  FBMatrixToRotation (FBRVector &pVector, FBMatrix pMatrix, FBRotationOrder pRotationOrder=kFBXYZ)
  Obtain rotation vector from a matrix.
K_DLLIMPORT void  FBMatrixToScaling (FBSVector &pVector, FBMatrix pMatrix)
  Obtain scaling vector from a matrix.
K_DLLIMPORT void  FBMatrixToTRS (FBTVector &pTVector, FBRVector &pRVector, FBSVector &pSVector, FBMatrix pMatrix)
  Obtain translation, rotation, and scaling vectors from a matrix.
K_DLLIMPORT void  FBRotationToQuaternion (FBQuaternion &pQuaternion, FBRVector pVector, FBRotationOrder pRotationOrder=kFBXYZ)
  Get a quaternion from a rotation vector.
K_DLLIMPORT void  FBQuaternionToRotation (FBRVector &pVector, FBQuaternion pQuaternion, FBRotationOrder pRotationOrder=kFBXYZ)
  Get a rotation vector from a quaternion vector.
K_DLLIMPORT void  FBGetLocalMatrix (FBMatrix &pMatrix, FBMatrix pMatrixParent, FBMatrix pMatrixChild)
  Get local matrix from parent and child matrices.
K_DLLIMPORT void  FBGetGlobalMatrix (FBMatrix &pMatrix, FBMatrix pMatrixParent, FBMatrix pLocalMatrix)
  Get global matrix from parent and child matrices.
K_DLLIMPORT void  FBMatrixOrthogonalize (FBMatrix &pMatrix)
  Get global matrix from parent and child matrices.
K_DLLIMPORT void  FBAdd (FBTVector &pResult, FBTVector &pV1, FBTVector &pV2)
  Add two vectors together (pResult = pV1 + pV2).
K_DLLIMPORT void  FBSub (FBTVector &pResult, FBTVector &pV1, FBTVector &pV2)
  Subtract pV2 from pV1 (pResult = pV1 - pV2).
K_DLLIMPORT void  FBMult (FBTVector &pResult, FBTVector &pV1, double pV2)
  Multiply pV2 from pV1 (pResult = pV1 * pV2).
K_DLLIMPORT void  FBMult (FBTVector &pResult, FBTVector &pV1, FBTVector &pV2)
  Calculate the cross product of two vectors.
K_DLLIMPORT void  FBMult (FBMatrix &pResult, FBMatrix &pM, FBSVector &pV)
  Calculate the cross product of a Matrix and Scale Vector.
K_DLLIMPORT double  FBDot (FBTVector &pV1, FBTVector &pV2)
  Calculate the dot product of two vectors.
K_DLLIMPORT double  FBLength (FBTVector &pV)
  Get the length of a vector.
K_DLLIMPORT void  FBQAdd (FBQuaternion &pResult, const FBQuaternion &pQ1, const FBQuaternion &pQ2)
  Add two quaternions together (pResult = pQ1 + pQ2).
K_DLLIMPORT void  FBQSub (FBQuaternion &pResult, const FBQuaternion &pQ1, const FBQuaternion &pQ2)
  Subtract pQ2 from pQ1 (pResult = pQ1 - pQ2).
K_DLLIMPORT void  FBQMult (FBQuaternion &pResult, const FBQuaternion &pQ1, double pQ2)
  Multiply pQ2 from pQ1 (pResult = pQ1 * pQ2).
K_DLLIMPORT void  FBQMult (FBQuaternion &pResult, const FBQuaternion &pQ1, const FBQuaternion &pQ2)
  Calculate the cross product of two quaternions.
K_DLLIMPORT double  FBQDot (const FBQuaternion &pQ1, const FBQuaternion &pQ2)
  Calculate the dot product of two quaternions.
K_DLLIMPORT double  FBQLength (const FBQuaternion &pQ)
  Get the length of a quaternion.
K_DLLIMPORT double  FBLength (FBVertex &pV)
  Get the length of a vertex (from origin).
K_DLLIMPORT void  FBInterpolateRotation (FBRVector &pROut, const FBRVector &pR0, const FBRVector &pR1, double pU)
  Interpolate a rotation in Euler space.
K_DLLIMPORT void  FBInterpolateRotation (FBQuaternion &pQOut, const FBQuaternion &pQ0, const FBQuaternion &pQ1, double pU)
  Interpolate a rotation in Quaternion.
K_DLLIMPORT void  FBGetContinuousRotation (FBRVector &pROut, FBRVector &pR0, FBRVector &pR1)
  Get a continuous rotation in Euler space.
K_DLLIMPORT double  FBClamp (double pV, double pL, double pH)
  Clamp value.
K_DLLIMPORT void  FBBigEndianToNative (unsigned short &pV)
  Change from big endian to native format.
K_DLLIMPORT void  FBLittleEndianToNative (unsigned short &pV)
  Change from little endian to native format.

Define Documentation

#define FBSDK_DLL   K_DLLIMPORT

Be sure that FBSDK_DLL is defined only once.

..

Definition at line 48 of file fbmath.h.


Enumeration Type Documentation

enum FBRotationOrder

Specify the Euler rotation order.

Enumerator:
kFBXYZ  XYZ.
kFBXZY  XZY.
kFBYXZ  YXZ.
kFBYZX  YZX.
kFBZXY  ZXY.
kFBZYX  ZYX.

Definition at line 58 of file fbmath.h.


Function Documentation

K_DLLIMPORT void FBAdd ( FBTVector pResult,
FBTVector pV1,
FBTVector pV2  
)

Add two vectors together (pResult = pV1 + pV2).

Return values:
pResult  Resulting vector.
Parameters:
pV1  1st vector.
pV2  2nd vector.

K_DLLIMPORT void FBBigEndianToNative ( unsigned short &  pV  ) 

Change from big endian to native format.

Parameters:
pV  Value to modify.

K_DLLIMPORT double FBClamp ( double  pV,
double  pL,
double  pH  
)

Clamp value.

Parameters:
pV  Value to clamp.
pL  Low limit.
pH  High limit.
Returns:
Clamped value.

K_DLLIMPORT double FBDot ( FBTVector pV1,
FBTVector pV2  
)

Calculate the dot product of two vectors.

Parameters:
pV1  1st vector.
pV2  2nd vector.
Returns:
Dot product.

K_DLLIMPORT void FBGetContinuousRotation ( FBRVector pROut,
FBRVector pR0,
FBRVector pR1  
)

Get a continuous rotation in Euler space.

This routine will help to avoid gimble locks due to interpolation.

Return values:
pROut  Successful continuous rotation (gimble-lock free).
Parameters:
pR0  Suggested next rotation.
pR1  Previous rotation.

K_DLLIMPORT void FBGetGlobalMatrix ( FBMatrix pMatrix,
FBMatrix  pMatrixParent,
FBMatrix  pLocalMatrix  
)

Get global matrix from parent and child matrices.

From an input referential, this function will calculate the global matrix corresponding to the input local matrix (which is with respect to the parent matrix).

Return values:
pMatrix  Calculated local matrix.
Parameters:
pMatrixParent  Parent matrix.
pLocalMatrix  Local matrix.

K_DLLIMPORT void FBGetLocalMatrix ( FBMatrix pMatrix,
FBMatrix  pMatrixParent,
FBMatrix  pMatrixChild  
)

Get local matrix from parent and child matrices.

Will calculate the local matrix from two global matrices. The resulting matrix will be a local matrix containing the local transformations to go from the parent referentialto the child referential.

Return values:
pMatrix  Calculated local matrix.
Parameters:
pMatrixParent  Parent matrix (new base referential).
pMatrixChild  Child matrix.

K_DLLIMPORT void FBInterpolateRotation ( FBQuaternion pQOut,
const FBQuaternion pQ0,
const FBQuaternion pQ1,
double  pU  
)

Interpolate a rotation in Quaternion.

Return values:
pQOut  Resulting, interpolated rotation.
Parameters:
pQ0  1st rotation.
pQ1  2nd rotation.
pU  Interpolation ratio.

K_DLLIMPORT void FBInterpolateRotation ( FBRVector pROut,
const FBRVector pR0,
const FBRVector pR1,
double  pU  
)

Interpolate a rotation in Euler space.

Return values:
pROut  Resulting, interpolated rotation.
Parameters:
pR0  1st rotation.
pR1  2nd rotation.
pU  Interpolation ratio.

K_DLLIMPORT double FBLength ( FBVertex pV  ) 

Get the length of a vertex (from origin).

Parameters:
pV  Vertex for which length is to be measured.
Returns:
Length of vertex (from origin).

K_DLLIMPORT double FBLength ( FBTVector pV  ) 

Get the length of a vector.

Parameters:
pV  Vector to calculate length for.
Returns:
Length of vector pV.

K_DLLIMPORT void FBLittleEndianToNative ( unsigned short &  pV  ) 

Change from little endian to native format.

Parameters:
pV  Value to modify.

K_DLLIMPORT void FBMatrixInverse ( FBMatrix pMatrix,
FBMatrix pSrc  
)

Invert a matrix.

Return values:
pMatrix  Calculated inverse matrix.
Parameters:
pSrc  Source matrix to invert.

K_DLLIMPORT void FBMatrixMult ( FBMatrix pMatrix,
FBMatrix pA,
FBMatrix pB  
)

Multiply two matrices.

Return values:
pMatrix  Calculated resulting matrix.
Parameters:
pA  1st matrix.
pB  2nd matrix.

K_DLLIMPORT void FBMatrixOrthogonalize ( FBMatrix pMatrix  ) 

Get global matrix from parent and child matrices.

From an input referential, this function will calculate the global matrix corresponding to the input local matrix (which is with respect to the parent matrix).

Return values:
pMatrix  Orthogonalized matrix.
Parameters:
pMatrix  Rotation Matrix to Orthogonalize.

K_DLLIMPORT void FBMatrixToRotation ( FBRVector pVector,
FBMatrix  pMatrix,
FBRotationOrder  pRotationOrder = kFBXYZ  
)

Obtain rotation vector from a matrix.

Return values:
pVector  Extracted rotation vector.
Parameters:
pMatrix  Input matrix.
pRotationOrder  Rotation Order.
Warning:
Rotation is in EulerXYZ or EulerZYX only

K_DLLIMPORT void FBMatrixToScaling ( FBSVector pVector,
FBMatrix  pMatrix  
)

Obtain scaling vector from a matrix.

Return values:
pVector  Extracted scaling vector.
Parameters:
pMatrix  Input matrix.

K_DLLIMPORT void FBMatrixToTranslation ( FBTVector pVector,
FBMatrix  pMatrix  
)

Obtain translation vector from a matrix.

Return values:
pVector  Extracted translation vector.
Parameters:
pMatrix  Input matrix.

K_DLLIMPORT void FBMatrixToTRS ( FBTVector pTVector,
FBRVector pRVector,
FBSVector pSVector,
FBMatrix  pMatrix  
)

Obtain translation, rotation, and scaling vectors from a matrix.

Return values:
pTVector  Extracted translation vector.
pRVector  Extracted rotation vector.
pSVector  Extracted scaling vector.
Parameters:
pMatrix  Input matrix.
Warning:
Rotation is in EulerXYZ

K_DLLIMPORT void FBMatrixTranspose ( FBMatrix pMatrix,
FBMatrix pSrc  
)

Transpose a matrix.

Return values:
pMatrix  Calculated transpose matrix.
Parameters:
pSrc  Source matrix to transpose.

K_DLLIMPORT void FBMult ( FBMatrix pResult,
FBMatrix pM,
FBSVector pV  
)

Calculate the cross product of a Matrix and Scale Vector.

Return values:
pResult  Resulting Matrix.
Parameters:
pM  Matrix.
pV  vector.

K_DLLIMPORT void FBMult ( FBTVector pResult,
FBTVector pV1,
FBTVector pV2  
)

Calculate the cross product of two vectors.

Return values:
pResult  Resulting vector.
Parameters:
pV1  1st vector.
pV2  2nd vector.

K_DLLIMPORT void FBMult ( FBTVector pResult,
FBTVector pV1,
double  pV2  
)

Multiply pV2 from pV1 (pResult = pV1 * pV2).

Return values:
pResult  Resulting vector.
Parameters:
pV1  1st vector.
pV2  2nd vector.

K_DLLIMPORT void FBQAdd ( FBQuaternion pResult,
const FBQuaternion pQ1,
const FBQuaternion pQ2  
)

Add two quaternions together (pResult = pQ1 + pQ2).

Return values:
pResult  Resulting quaternion.
Parameters:
pQ1  1st quaternion.
pQ2  2nd quaternion.

K_DLLIMPORT double FBQDot ( const FBQuaternion pQ1,
const FBQuaternion pQ2  
)

Calculate the dot product of two quaternions.

Parameters:
pQ1  1st quaternion.
pQ2  2nd quaternion.
Returns:
Dot product.

K_DLLIMPORT double FBQLength ( const FBQuaternion pQ  ) 

Get the length of a quaternion.

Parameters:
pQ  Quaternion to calculate length for.
Returns:
Length of quaternion pQ.

K_DLLIMPORT void FBQMult ( FBQuaternion pResult,
const FBQuaternion pQ1,
const FBQuaternion pQ2  
)

Calculate the cross product of two quaternions.

Return values:
pResult  Resulting quaternion.
Parameters:
pQ1  1st quaternion.
pQ2  2nd quaternion.

K_DLLIMPORT void FBQMult ( FBQuaternion pResult,
const FBQuaternion pQ1,
double  pQ2  
)

Multiply pQ2 from pQ1 (pResult = pQ1 * pQ2).

Return values:
pResult  Resulting quaternion.
Parameters:
pQ1  1st quaternion.
pQ2  2nd quaternion.

K_DLLIMPORT void FBQSub ( FBQuaternion pResult,
const FBQuaternion pQ1,
const FBQuaternion pQ2  
)

Subtract pQ2 from pQ1 (pResult = pQ1 - pQ2).

Return values:
pResult  Resulting quaternion.
Parameters:
pQ1  1st quaternion.
pQ2  2nd quaternion.

K_DLLIMPORT void FBQuaternionToRotation ( FBRVector pVector,
FBQuaternion  pQuaternion,
FBRotationOrder  pRotationOrder = kFBXYZ  
)

Get a rotation vector from a quaternion vector.

Return values:
pVector  Calculated rotation vector.
Parameters:
pQuaternion  Input quaternion.
pRotationOrder  Rotation order of the rotation vector.
Warning:
Rotation is in EulerXYZ or kFBZYX only

K_DLLIMPORT void FBRotationToMatrix ( FBMatrix pMatrix,
FBRVector  pVector,
FBRotationOrder  pRotationOrder = kFBXYZ  
)

Convert a rotation vector to a matrix.

Return values:
pMatrix  Calculated resulting matrix.
Parameters:
pVector  Rotation vector.
pRotationOrder  Rotation order

K_DLLIMPORT void FBRotationToQuaternion ( FBQuaternion pQuaternion,
FBRVector  pVector,
FBRotationOrder  pRotationOrder = kFBXYZ  
)

Get a quaternion from a rotation vector.

Return values:
pQuaternion  Calculated quaternion.
Parameters:
pVector  Input rotation vector.
pRotationOrder  Rotation order of the rotation vector.

K_DLLIMPORT void FBScalingToMatrix ( FBMatrix pMatrix,
FBSVector  pVector  
)

Convert a scaling vector to a matrix.

Return values:
pMatrix  Calculated resulting matrix.
Parameters:
pVector  Scaling vector.

K_DLLIMPORT void FBSub ( FBTVector pResult,
FBTVector pV1,
FBTVector pV2  
)

Subtract pV2 from pV1 (pResult = pV1 - pV2).

Return values:
pResult  Resulting vector.
Parameters:
pV1  1st vector.
pV2  2nd vector.

K_DLLIMPORT void FBTranslationToMatrix ( FBMatrix pMatrix,
FBTVector  pVector  
)

Convert a translation vector to a matrix.

Return values:
pMatrix  Calculated resulting matrix.
Parameters:
pVector  Translation vector.

K_DLLIMPORT void FBTRSToMatrix ( FBMatrix pMatrix,
FBTVector  pTVector,
FBRVector  pRVector,
FBSVector  pSVector  
)

Convert translation, rotation, and scaling vectors to a matrix.

Return values:
pMatrix  Calculated resulting matrix.
Parameters:
pTVector  Translation vector.
pRVector  Rotation vector.
pSVector  Scaling vector.
Warning:
Rotation is in EulerXYZ

K_DLLIMPORT void FBVectorMatrixMult ( FBVector4d pOutVector,
FBMatrix pMatrix,
FBVector4d pVector  
)

Multiply a vector by a matrix.

Return values:
pOutVector  Resulting vector.
Parameters:
pMatrix  Matrix to affect the vector with.
pVector  Source vector.

K_DLLIMPORT void FBVertexMatrixMult ( FBVertex pOutVertex,
FBMatrix pMatrix,
FBVertex pVertex  
)

Multiply a vertex by a matrix.

Return values:
pOutVertex  Resulting vertex.
Parameters:
pMatrix  Matrix to affect the vertex with.
pVertex  Source vertex.

Please send us your comments about this page.