132 lines
3.4 KiB
C
132 lines
3.4 KiB
C
/*=========================================================================
|
|
*
|
|
* Matrix.h - Matrix functions
|
|
*
|
|
* Version 1.0
|
|
* Revision date
|
|
*
|
|
*=======================================================================*/
|
|
#ifndef MATRIX_H
|
|
#define MATRIX_H
|
|
|
|
//--- Includes --------------------------------------------------------
|
|
|
|
#include "MTH.h"
|
|
|
|
#include "typedef.h"
|
|
|
|
//--- Defines ---------------------------------------------------------
|
|
|
|
#define MLT_C_lMatrixIdentityFlag 0
|
|
#define MLT_C_lNotMatrixIdentityFlag 1
|
|
#define MLT_C_lMatrixRotatFlag 2
|
|
#define MLT_C_lMatrixScaleFlag 4
|
|
#define MLT_C_lMatrixTransFlag 8
|
|
|
|
|
|
//--- Structures ---------------------------------------------------------
|
|
|
|
typedef struct MLT_tdstMatrix_
|
|
{
|
|
xString sName;
|
|
MTH_tdxReal a9_xRotMatrix[3][3] ;
|
|
MTH_tdxReal a9_xScaleMatrix[3][3] ;
|
|
MTH_tdxReal a9_xTransformMatrix[3][3] ;
|
|
MTH3D_tdstVector stTranslation ;
|
|
long lStateFlag;
|
|
}
|
|
MLT_tdstMatrix;
|
|
|
|
|
|
//--- Functions ---------------------------------------------------------
|
|
|
|
extern void
|
|
MLT_xGetTranslationMatrix ( MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stTrs ) ;
|
|
|
|
extern void
|
|
MLT_xGetRotationMatrix ( MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stI ,
|
|
MTH3D_tdstVector *p_stJ ,
|
|
MTH3D_tdstVector *p_stK ) ;
|
|
extern void
|
|
MLT_xGetScaleMatrix ( MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stI ,
|
|
MTH3D_tdstVector *p_stJ ,
|
|
MTH3D_tdstVector *p_stK ) ;
|
|
|
|
|
|
extern void
|
|
MLT_xGetTransformMatrix ( MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stI ,
|
|
MTH3D_tdstVector *p_stJ ,
|
|
MTH3D_tdstVector *p_stK ) ;
|
|
extern void
|
|
MLT_xSetTranslationMatrix ( MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stTrs ) ;
|
|
|
|
extern void
|
|
MLT_xSetRotationMatrix ( MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stI ,
|
|
MTH3D_tdstVector *p_stJ ,
|
|
MTH3D_tdstVector *p_stK ) ;
|
|
|
|
extern void
|
|
MLT_xSetScaleMatrix ( MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stI ,
|
|
MTH3D_tdstVector *p_stJ ,
|
|
MTH3D_tdstVector *p_stK ) ;
|
|
|
|
extern void
|
|
MLT_xResetScaleMatrix ( MLT_tdstMatrix *p_stMatrix ) ;
|
|
|
|
extern void
|
|
MLT_xComputeTransformMatrix ( MLT_tdstMatrix *p_stMatrix ) ;
|
|
|
|
|
|
extern void
|
|
MLT_xSetIdentityMatrix ( MLT_tdstMatrix *p_stMatrix ) ;
|
|
|
|
extern void
|
|
MLT_xNormalizeMatrix ( MLT_tdstMatrix *p_stMatrix ) ;
|
|
|
|
extern void
|
|
MLT_xInvertMatrix ( MLT_tdstMatrix *p_stDest ,
|
|
MLT_tdstMatrix *p_stSource );
|
|
extern void
|
|
MLT_xInvertIsoMatrix ( MLT_tdstMatrix *p_stDest ,
|
|
MLT_tdstMatrix *p_stSource ) ;
|
|
|
|
extern void
|
|
MLT_xMulMatrixVertex ( MTH3D_tdstVector *p_stDest ,
|
|
MLT_tdstMatrix *p_stMatrix ,
|
|
MTH3D_tdstVector *p_stSource ) ;
|
|
|
|
extern void
|
|
MLT_xMulMatrixMatrix ( MLT_tdstMatrix *p_stDest ,
|
|
MLT_tdstMatrix *p_stA ,
|
|
MLT_tdstMatrix *p_stB ) ;
|
|
|
|
extern void
|
|
MLT_xTranspA9Matrix ( MTH_tdxReal p_xDest[3][3] ,
|
|
MTH_tdxReal p_xA[3][3] );
|
|
|
|
extern void
|
|
MLT_xMulA9MatrixVertex ( MTH3D_tdstVector *p_stDest ,
|
|
MTH_tdxReal a9_xTable[3][3] ,
|
|
MTH3D_tdstVector *p_stSource );
|
|
extern void
|
|
MLT_xMulA9MatrixMatrix ( MTH_tdxReal *p_xDest ,
|
|
MTH_tdxReal *p_xA ,
|
|
MTH_tdxReal *p_xB ) ;
|
|
|
|
extern long
|
|
MLT_lIsNotScaledMatrix ( MLT_tdstMatrix *p_stMatrix );
|
|
|
|
extern long
|
|
MLT_lIsIdentityMatrix ( MLT_tdstMatrix *p_stMatrix );
|
|
|
|
|
|
#endif //MATRIX_H
|
|
|