Add rayman2 source files
This commit is contained in:
903
Rayman_X/cpa/public/MTH/MTH2d.h
Normal file
903
Rayman_X/cpa/public/MTH/MTH2d.h
Normal file
@@ -0,0 +1,903 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH2d.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 2D Vectorial implementation
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH2D_H
|
||||
#define MTH2D_H
|
||||
|
||||
#include "MTH_Real.h"
|
||||
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* 2D Vector : */
|
||||
typedef struct MTH2D_tdstVector_
|
||||
{
|
||||
MTH_tdxReal xX;
|
||||
MTH_tdxReal xY;
|
||||
} MTH2D_tdstVector;
|
||||
|
||||
/* 2D Matrix */
|
||||
typedef struct MTH2D_tdstMatrix_
|
||||
{
|
||||
MTH2D_tdstVector stCol_0;
|
||||
MTH2D_tdstVector stCol_1;
|
||||
} MTH2D_tdstMatrix;
|
||||
|
||||
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-######################################
|
||||
## MACRO AND FUNCTION FOR 2D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Vector Operations
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vAddVector
|
||||
DESCRIPTION : Add two vectors : VectDest= VectA + VectB
|
||||
INPUT : VectDest, VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vAddVector( VectDest, VectA, VectB) \
|
||||
{ (VectDest)->xX = MTH_M_xAdd((VectA)->xX, (VectB)->xX); \
|
||||
(VectDest)->xY = MTH_M_xAdd((VectA)->xY, (VectB)->xY); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSubVector
|
||||
DESCRIPTION : Sub two vectors : VectDest= VectA - VectB
|
||||
INPUT : VectDest, VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSubVector( VectDest, VectA, VectB) \
|
||||
{ (VectDest)->xX = MTH_M_xSub((VectA)->xX, (VectB)->xX); \
|
||||
(VectDest)->xY = MTH_M_xSub((VectA)->xY, (VectB)->xY); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vNegVector
|
||||
DESCRIPTION : Negation of a vector : VectDest= - VectA
|
||||
INPUT : VectDest, VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vNegVector( VectDest, VectA) \
|
||||
{ (VectDest)->xX = MTH_M_xNeg( (VectA)->xX ); \
|
||||
(VectDest)->xY = MTH_M_xNeg( (VectA)->xY ); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_bEqualVector
|
||||
DESCRIPTION : Test if two vectors are equal
|
||||
INPUT : VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : VectA==VectB : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_bEqualVector( VectA, VectB) \
|
||||
( \
|
||||
(MTH_M_bEqual((VectA)->xX, (VectB)->xX)) && \
|
||||
(MTH_M_bEqual((VectA)->xY, (VectB)->xY)) \
|
||||
)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vAddScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= a.Id + VectA
|
||||
INPUT : VectDest: address of MTH2D_tdstVector,
|
||||
a: MTH_tdxReal, VectA: address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vAddScalarVector( VectDest, a, VectA) \
|
||||
{ \
|
||||
(VectDest)->xX = MTH_M_xAdd((VectA)->xX, (a)); \
|
||||
(VectDest)->xY = MTH_M_xAdd((VectA)->xY, (a)); \
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSubScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= VectA - a.Id
|
||||
INPUT : VectDest: address of MTH2D_tdstVector,
|
||||
a: MTH_tdxReal, VectA: address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSubScalarVector( VectDest, a, VectA) \
|
||||
{ \
|
||||
(VectDest)->xX = MTH_M_xSub((VectA)->xX, (a)); \
|
||||
(VectDest)->xY = MTH_M_xSub((VectA)->xY, (a)); \
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMulScalarVector
|
||||
DESCRIPTION : Multiplicate a scalare with a vector : VectDest= a*VectA
|
||||
INPUT : VectDest: address of MTH2D_tdstVector,
|
||||
a: MTH_tdxReal, VectA: address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMulScalarVector( VectDest, a, VectA) \
|
||||
{ (VectDest)->xX = MTH_M_xMul((a), (VectA)->xX); \
|
||||
(VectDest)->xY = MTH_M_xMul((a), (VectA)->xY); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vDivScalarVector
|
||||
DESCRIPTION : Divide a vector by a scalare : VectDest= VectA/a
|
||||
INPUT : VectDest, VectA: address of MTH2D_tdstVector, a: MTH_tdxReal
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vDivScalarVector( VectDest, VectA, a) \
|
||||
{ (VectDest)->xX = MTH_M_xDiv((VectA)->xX, (a)); \
|
||||
(VectDest)->xY = MTH_M_xDiv((VectA)->xY, (a)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xDotProductVector
|
||||
DESCRIPTION : Return the Dot Product of two vectors
|
||||
INPUT : VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : VectA.VectB : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xDotProductVector( VectA, VectB) \
|
||||
MTH_M_xAdd( \
|
||||
MTH_M_xMul((VectA)->xX, (VectB)->xX), \
|
||||
MTH_M_xMul((VectA)->xY, (VectB)->xY) \
|
||||
)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xSqrVector
|
||||
DESCRIPTION : Return the square of a vector
|
||||
INPUT : VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : VectA.VectA : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xSqrVector( VectA) \
|
||||
MTH_M_xAdd( \
|
||||
MTH_M_xSqr((VectA)->xX), \
|
||||
MTH_M_xSqr((VectA)->xY) \
|
||||
)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xNormVector
|
||||
DESCRIPTION : Return the norm of a vector
|
||||
INPUT : VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : ||VectA|| : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xNormVector( VectA ) \
|
||||
MTH_M_xSqrt( MTH2D_M_xSqrVector( VectA ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xInvNormVector
|
||||
DESCRIPTION : Return the inverse of the norm of a vector
|
||||
INPUT : VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : 1/||VectA|| : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xInvNormVector( VectA ) \
|
||||
MTH_M_xInvSqrt( MTH2D_M_xSqrVector( VectA ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xVectorGapSqr
|
||||
DESCRIPTION : Return the square Gap between two vectors
|
||||
INPUT : VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : Sqr(||VectA-VectB||) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xVectorGapSqr(VectA, VectB) \
|
||||
(MTH_M_xSqrAddSqr( \
|
||||
MTH_M_xSub( (VectA)->xX, (VectB)->xX), \
|
||||
MTH_M_xSub( (VectA)->xY, (VectB)->xY) ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xVectorGap
|
||||
DESCRIPTION : Return the Gap between two vectors
|
||||
INPUT : VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : ||VectA-VectB|| : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xVectorGap(VectA, VectB) \
|
||||
(MTH_M_xSqrt( MTH2D_M_xVectorGapSqr(VectA, VectB) ))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vFillVector
|
||||
DESCRIPTION : Fill each vector element with a value
|
||||
INPUT : VectA: address of MTH2D_tdstVector, a: MTH_tdxReal
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vFillVector( VectDest, a) \
|
||||
{ (VectDest)->xX = (a); \
|
||||
(VectDest)->xY = (a); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vNormalizeVector
|
||||
DESCRIPTION : Normalize a vector : VectDest= VectA/||VectA||
|
||||
INPUT : VectDest, VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vNormalizeVector(VectDest, VectA) \
|
||||
{ \
|
||||
MTH_tdxReal inv_norm; \
|
||||
inv_norm= MTH2D_M_xInvNormVector( VectA); \
|
||||
MTH2D_M_vMulScalarVector(VectDest, inv_norm, VectA ); \
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vGetVectorElements
|
||||
DESCRIPTION : Get x, y values of a vector
|
||||
INPUT : x, y : address of MTH_tdxReal, VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vGetVectorElements( Vx, Vy, VectA) \
|
||||
{ *Vx = (VectA)->xX; \
|
||||
*Vy = (VectA)->xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetVectorElements
|
||||
DESCRIPTION : Set a vector with x, y values
|
||||
INPUT : VectDest : address of MTH2D_tdstVector, x, y : address of MTH_tdxReal,
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetVectorElements( VectDest, Vx, Vy) \
|
||||
{ (VectDest)->xX = (Vx); \
|
||||
(VectDest)->xY = (Vy); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xGetXofVector
|
||||
DESCRIPTION : Return x element of a vector
|
||||
INPUT : VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : x : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xGetXofVector( VectA ) \
|
||||
(VectA)->xX
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetXofVector
|
||||
DESCRIPTION : Set x element of a vector
|
||||
INPUT : VectDest : address of MTH2D_tdstVector, Vx : MTH_tdxReal
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetXofVector( VectDest, Vx) \
|
||||
{ (VectDest)->xX = (Vx); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xGetYofVector
|
||||
DESCRIPTION : Return y element of a vector
|
||||
INPUT : VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : y : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xGetYofVector( VectA ) \
|
||||
(VectA)->xY
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetYofVector
|
||||
DESCRIPTION : Set y element of a vector
|
||||
INPUT : VectDest : address of MTH2D_tdstVector, Vy : MTH_tdxReal
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetYofVector( VectDest, Vy) \
|
||||
{ (VectDest)->xY = (Vy); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vCopyVector
|
||||
DESCRIPTION : Copy a vector : VectDest=VectA
|
||||
INPUT : VectDest, VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vCopyVector( VectDest, VectA) \
|
||||
{ memcpy(VectDest, VectA, sizeof(MTH2D_tdstVector)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vNullVector
|
||||
DESCRIPTION : Set all elements of a vector to zero
|
||||
INPUT : VectDest : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vNullVector( VectDest) \
|
||||
{ (VectDest)->xX = MTH_C_ZERO; \
|
||||
(VectDest)->xY = MTH_C_ZERO; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vScaleVector
|
||||
DESCRIPTION : Set each element of VectDest with the multiplication of element of VectA by element of VectB
|
||||
INPUT : VectDest, VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vScaleVector( VectDest, VectA, VectB ) \
|
||||
{ (VectDest)->xX = MTH_M_xMul( (VectA)->xX, (VectB)->xX); \
|
||||
(VectDest)->xY = MTH_M_xMul( (VectA)->xY, (VectB)->xY); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMiddleVector
|
||||
DESCRIPTION : Calculate the middle of two vectors : VectDest= (VectA+VectB)/2
|
||||
INPUT : VectDest, VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMiddleVector( VectDest, VectA, VectB ) \
|
||||
{ MTH2D_M_vAddVector( VectDest, VectA, VectB ); \
|
||||
MTH2D_M_vMulScalarVector( VectDest, MTH_C_Inv2 , VectDest); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vLinearInterpolVector
|
||||
DESCRIPTION : Calculate the lineat interpolation of two vectors : VectDest= VectA + t.(VectB-VectA)
|
||||
INPUT : VectDest, VectA, VectB: address of MTH2D_tdstVector, t: MTH_tdxReal
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vLinearInterpolVector( VectDest, VectA, VectB, t) \
|
||||
{ (VectDest)->xX= MTH_M_xLinearInterpol( (VectA)->xX, (VectB)->xX, (t) ); \
|
||||
(VectDest)->xY= MTH_M_xLinearInterpol( (VectA)->xY, (VectB)->xY, (t) ); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMaxVector
|
||||
DESCRIPTION : Make a vector with max elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMaxVector( VectDest, VectA, VectB) \
|
||||
{ (VectDest)->xX= MTH_M_xMax( (VectA)->xX, (VectB)->xX ); \
|
||||
(VectDest)->xY= MTH_M_xMax( (VectA)->xY, (VectB)->xY ); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMinVector
|
||||
DESCRIPTION : Make a vector with min elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMinVector( VectDest, VectA, VectB) \
|
||||
{ (VectDest)->xX= MTH_M_xMin( (VectA)->xX, (VectB)->xX ); \
|
||||
(VectDest)->xY= MTH_M_xMin( (VectA)->xY, (VectB)->xY ); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_bIsNullVector
|
||||
DESCRIPTION : Test if a vector is null
|
||||
INPUT : VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : VectA==Null vector : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_bIsNullVector( VectA ) \
|
||||
( MTH_M_bEqualZero((VectA)->xX) && MTH_M_bEqualZero((VectA)->xY) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMulAddVector
|
||||
DESCRIPTION : Multiply a scalar to a vector, and add it to a other vector: VectDest = x.VectA + VectB
|
||||
INPUT : VectDest: address of MTH2D_tdstVector,
|
||||
x: MTH_tdxReal, VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMulAddVector( VectDest, x, VectA, VectB) \
|
||||
{ (VectDest)->xX = MTH_M_xAdd(MTH_M_xMul((x),(VectA)->xX) , (VectB)->xX); \
|
||||
(VectDest)->xY = MTH_M_xAdd(MTH_M_xMul((x),(VectA)->xY), (VectB)->xY); }
|
||||
|
||||
/* MTH2D_M_vMullAddVector( VectDest, x, VectA, VectB) : VectDest = x.VectA + VectB */
|
||||
/* WARNING : THIS MUST DESAPEAR !!! */
|
||||
#define MTH2D_M_vMullAddVector MTH2D_M_vMulAddVector
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetBaseIVector
|
||||
DESCRIPTION : Set a vector to Ox base vector : VectDest = ( 1, 0 )
|
||||
INPUT : VectDest: address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetBaseIVector( VectDest ) \
|
||||
{ (VectDest)->xX = MTH_C_ONE; \
|
||||
(VectDest)->xY = MTH_C_ZERO; \
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetBaseJVector
|
||||
DESCRIPTION : Set a vector to Oy base vector : VectDest = ( 0, 1 )
|
||||
INPUT : VectDest: address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetBaseJVector( VectDest ) \
|
||||
{ (VectDest)->xX = MTH_C_ZERO; \
|
||||
(VectDest)->xY = MTH_C_ONE; \
|
||||
}
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vCopyMatrix( MatDest, MatA) \
|
||||
{ memcpy(MatDest, MatA, sizeof(MTH2D_tdstMatrix)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vAddMatrix( MatDest, MatA, MatB) \
|
||||
{ MTH2D_M_vAddVector( &((MatDest)->stCol_0), \
|
||||
&((MatA)->stCol_0), &((MatB)->stCol_0)); \
|
||||
MTH2D_M_vAddVector( &((MatDest)->stCol_1), \
|
||||
&((MatA)->stCol_1), &((MatB)->stCol_1)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSubMatrix( MatDest, MatA, MatB) \
|
||||
{ MTH2D_M_vSubVector( &((MatDest)->stCol_0), \
|
||||
&((MatA)->stCol_0), &((MatB)->stCol_0)); \
|
||||
MTH2D_M_vSubVector( &((MatDest)->stCol_1), \
|
||||
&((MatA)->stCol_1), &((MatB)->stCol_1)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vNegMatrix( MatDest, MatA) \
|
||||
{ MTH2D_M_vNegVector( &((MatDest)->stCol_0), \
|
||||
&((MatA)->stCol_0)); \
|
||||
MTH2D_M_vNegVector( &((MatDest)->stCol_1), \
|
||||
&((MatA)->stCol_1)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
{ (MatDest)->stCol_0.xX = MTH_M_xMulAddMul( \
|
||||
(MatA)->stCol_0.xX, (MatB)->stCol_0.xX, \
|
||||
(MatA)->stCol_1.xX, (MatB)->stCol_0.xY ); \
|
||||
(MatDest)->stCol_0.xY = MTH_M_xMulAddMul( \
|
||||
(MatA)->stCol_0.xY, (MatB)->stCol_0.xX, \
|
||||
(MatA)->stCol_1.xY, (MatB)->stCol_0.xY ); \
|
||||
(MatDest)->stCol_1.xX = MTH_M_xMulAddMul( \
|
||||
(MatA)->stCol_0.xX, (MatB)->stCol_1.xX, \
|
||||
(MatA)->stCol_1.xX, (MatB)->stCol_1.xY ); \
|
||||
(MatDest)->stCol_1.xY = MTH_M_xMulAddMul( \
|
||||
(MatA)->stCol_0.xY, (MatB)->stCol_1.xX, \
|
||||
(MatA)->stCol_1.xY, (MatB)->stCol_1.xY ); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
if( (Mat_Dest==Mat_A) || (Mat_Dest==Mat_B) ) \
|
||||
{ \
|
||||
MTH2D_tdstMatrix Mtemp; \
|
||||
\
|
||||
MTH2D_M_vMulMatrixMatrixWithoutBuffer( \
|
||||
&Mtemp, Mat_A, Mat_B); \
|
||||
MTH2D_M_vCopyMatrix( Mat_Dest, &Mtemp); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
MTH2D_M_vMulMatrixMatrixWithoutBuffer(Mat_Dest, \
|
||||
Mat_A, Mat_B); \
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
a: MTH_tdxReal, MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
{ MTH2D_M_vMulScalarVector( &((MatDest)->stCol_0), \
|
||||
(a), &((MatA)->stCol_0)); \
|
||||
MTH2D_M_vMulScalarVector( &((MatDest)->stCol_1), \
|
||||
(a), &((MatA)->stCol_1)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
MatA : address of MTH2D_tdstMatrix, a: MTH_tdxReal
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
{ MTH2D_M_vDivScalarVector( &((MatDest)->stCol_0), \
|
||||
&((MatA)->stCol_0), (a)); \
|
||||
MTH2D_M_vDivScalarVector( &((MatDest)->stCol_1), \
|
||||
&((MatA)->stCol_1), (a)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSqrMatrix(MatDest, MatA) \
|
||||
{ MTH2D_M_vMulMatrixMatrix( MatDest, MatA, MatA); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
{ (MatDest)->stCol_0.xX = (MatA)->stCol_0.xX; \
|
||||
(MatDest)->stCol_0.xY = (MatA)->stCol_1.xX; \
|
||||
(MatDest)->stCol_1.xX = (MatA)->stCol_0.xY; \
|
||||
(MatDest)->stCol_1.xY = (MatA)->stCol_1.xY; }
|
||||
|
||||
|
||||
/* MTH2D_M_vTranpMatrixWithoutBuffer(MatDest, MatA): MatDest= transp MatA */
|
||||
/* WARNING : THIS MUST DESAPEAR !!! */
|
||||
#define MTH2D_M_vTranpMatrixWithoutBuffer MTH2D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vTranspMatrix(Mat_Dest, Mat_A) \
|
||||
if( Mat_Dest==Mat_A ) \
|
||||
{ \
|
||||
MTH2D_tdstMatrix Mtemp; \
|
||||
\
|
||||
MTH2D_M_vTranspMatrixWithoutBuffer(&Mtemp, Mat_A); \
|
||||
MTH2D_M_vCopyMatrix( Mat_Dest, &Mtemp); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
MTH2D_M_vTranspMatrixWithoutBuffer(Mat_Dest, Mat_A); \
|
||||
}
|
||||
|
||||
/* MTH2D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
/* WARNING : THIS MUST DESAPEAR !!! */
|
||||
#define MTH2D_M_vTranpMatrix MTH2D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : trace MatA : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xTraceMatrix(MatA) \
|
||||
MTH_M_xAdd((MatA)->stCol_0.xX, (MatA)->stCol_1.xY)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetIdentityMatrix(MatDest) \
|
||||
{ (MatDest)->stCol_0.xX = MTH_C_ONE; \
|
||||
(MatDest)->stCol_0.xY = MTH_C_ZERO; \
|
||||
(MatDest)->stCol_1.xX = MTH_C_ZERO; \
|
||||
(MatDest)->stCol_1.xY = MTH_C_ONE; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of MTH2D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_bEqualMatrix(MatA, MatB) \
|
||||
( \
|
||||
MTH_M_bEqual( (MatA)->stCol_0.xX, (MatB)->stCol_0.xX) && \
|
||||
MTH_M_bEqual( (MatA)->stCol_0.xY, (MatB)->stCol_0.xY) && \
|
||||
MTH_M_bEqual( (MatA)->stCol_1.xX, (MatB)->stCol_1.xX) && \
|
||||
MTH_M_bEqual( (MatA)->stCol_1.xY, (MatB)->stCol_1.xY) \
|
||||
)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of MTH2D_tdstMatrix
|
||||
eps : MTH_tdxReal
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_bMatchMatrix(MatA, MatB, eps) \
|
||||
( \
|
||||
MTH_M_bEqualWithEpsilon( (MatA)->stCol_0.xX, (MatB)->stCol_0.xX, eps) && \
|
||||
MTH_M_bEqualWithEpsilon( (MatA)->stCol_0.xY, (MatB)->stCol_0.xY, eps) && \
|
||||
MTH_M_bEqualWithEpsilon( (MatA)->stCol_1.xX, (MatB)->stCol_1.xX, eps) && \
|
||||
MTH_M_bEqualWithEpsilon( (MatA)->stCol_1.xY, (MatB)->stCol_1.xY, eps) && \
|
||||
)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
a : MTH_tdxReal
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vFillMatrix(MatDest, a) \
|
||||
{ (MatDest)->stCol_0.xX = (a); \
|
||||
(MatDest)->stCol_0.xY = (a); \
|
||||
(MatDest)->stCol_1.xX = (a); \
|
||||
(MatDest)->stCol_1.xY = (a); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : det MatA : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xDetMatrix(MatA) \
|
||||
MTH_M_xSub( \
|
||||
MTH_M_xMul( (MatA)->stCol_0.xX, (MatA)->stCol_1.xY ), \
|
||||
MTH_M_xMul( (MatA)->stCol_0.xY, (MatA)->stCol_1.xX ))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vInverMatrix(MatDest, MatA) \
|
||||
{ \
|
||||
MTH2D_tdstMatrix MatTmp; \
|
||||
MTH_tdxReal det; \
|
||||
MatTmp.stCol_0.xX = (MatA)->stCol_1.xY; \
|
||||
MatTmp.stCol_0.xY = MTH_M_xNeg( (MatA)->stCol_0.xY ); \
|
||||
MatTmp.stCol_1.xX = MTH_M_xNeg( (MatA)->stCol_1.xX ); \
|
||||
MatTmp.stCol_1.xY = (MatA)->stCol_0.xX; \
|
||||
det=MTH2D_M_xDetMatrix( MatA ); \
|
||||
MTH2D_M_vDivScalarMatrix(MatDest, &(MatTmp), det ); \
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y column col values in MatA
|
||||
INPUT : x, y : MTH_tdxReal
|
||||
col : int
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vGetMatrixColumnElements( Vx, Vy, col, MatA) \
|
||||
if( col==0 ) \
|
||||
{ *Vx= (MatA)->stCol_0.xX; *Vy= (MatA)->stCol_0.xY; } \
|
||||
else \
|
||||
{ *Vx= (MatA)->stCol_1.xX; *Vy= (MatA)->stCol_1.xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y values in MatDest
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
x, y : MTH_tdxReal
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, col) \
|
||||
if( col==0 ) \
|
||||
{(MatDest)->stCol_0.xX= (Vx); (MatDest)->stCol_0.xY= (Vy); } \
|
||||
else \
|
||||
{(MatDest)->stCol_1.xX= (Vx); (MatDest)->stCol_1.xY= (Vy); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of MTH2D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_xGetMatrixElement( lin, col, MatA) \
|
||||
( col==0 ) ? \
|
||||
( lin==0 ? (MatA)->stCol_0.xX : (MatA)->stCol_0.xY) : \
|
||||
( lin==0 ? (MatA)->stCol_1.xX : (MatA)->stCol_1.xY)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
a : MTH_tdxReal
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetMatrixElement( MatDest, a, lin, col) \
|
||||
if( col==0 ) \
|
||||
{ if(lin==0){(MatDest)->stCol_0.xX=(a);}else{(MatDest)->stCol_0.xY=(a);}} \
|
||||
else \
|
||||
{ if(lin==0){(MatDest)->stCol_1.xX=(a);}else{(MatDest)->stCol_1.xY=(a);}}
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of MTH2D_tdstVector
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
{ (VectDest)->xX = MTH_M_xAdd( \
|
||||
MTH_M_xMul( (MatA)->stCol_0.xX, (VectA)->xX), \
|
||||
MTH_M_xMul( (MatA)->stCol_1.xX, (VectA)->xY)); \
|
||||
(VectDest)->xY = MTH_M_xAdd( \
|
||||
MTH_M_xMul( (MatA)->stCol_0.xY, (VectA)->xX), \
|
||||
MTH_M_xMul( (MatA)->stCol_1.xY, (VectA)->xY)); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of MTH2D_tdstVector
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
if( VectA==VectDest ) \
|
||||
{ \
|
||||
MTH2D_tdstVector Vtmp; \
|
||||
\
|
||||
MTH2D_M_vCopyVector( &Vtmp, VectA); \
|
||||
MTH2D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, &Vtmp); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
MTH2D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA); \
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of MTH2D_tdstVector
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
if( col==0 ) \
|
||||
{ (VectDest)->xX=(MatA)->stCol_0.xX; \
|
||||
(VectDest)->xY=(MatA)->stCol_0.xY; } \
|
||||
else \
|
||||
{ (VectDest)->xX=(MatA)->stCol_1.xX; \
|
||||
(VectDest)->xY=(MatA)->stCol_1.xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
VectA : address of MTH2D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
if( col==0 ) \
|
||||
{ (MatDest)->stCol_0.xX=(VectA)->xX; \
|
||||
(MatDest)->stCol_0.xY=(VectA)->xY; } \
|
||||
else \
|
||||
{ (MatDest)->stCol_1.xX=(VectA)->xX; \
|
||||
(MatDest)->stCol_1.xY=(VectA)->xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of MTH2D_tdstVector
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
if( lin==0 ) \
|
||||
{ (VectDest)->xX=(MatA)->stCol_0.xX; \
|
||||
(VectDest)->xY=(MatA)->stCol_1.xX; } \
|
||||
else \
|
||||
{ (VectDest)->xX=(MatA)->stCol_0.xY; \
|
||||
(VectDest)->xY=(MatA)->stCol_1.xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
VectA : address of MTH2D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
if( lin==0 ) \
|
||||
{ (MatDest)->stCol_0.xX=(VectA)->xX; \
|
||||
(MatDest)->stCol_1.xX=(VectA)->xY; } \
|
||||
else \
|
||||
{ (MatDest)->stCol_0.xY=(VectDest)->xX; \
|
||||
(MatDest)->stCol_1.xY=(VectDest)->xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of MTH2D_tdstVector
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
{ (VectDest)->xX= (MatA)->stCol_0.xX; \
|
||||
(VectDest)->xY= (MatA)->stCol_1.xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
{ (MatDest)->stCol_0.xX= (VectA)->xX; \
|
||||
(MatDest)->stCol_1.xY= (VectA)->xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest : address of MTH2D_tdstVector
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vGetVectorsInMatrix( VaDest, VbDest, MatA) \
|
||||
{ (VaDest)->xX=(MatA)->stCol_0.xX; \
|
||||
(VaDest)->xY=(MatA)->stCol_0.xY; \
|
||||
(VbDest)->xX=(MatA)->stCol_1.xX; \
|
||||
(VbDest)->xY=(MatA)->stCol_1.xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of MTH2D_tdstMatrix
|
||||
VectA, VectB : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vSetVectorsInMatrix( MatDest, VectA, VectB) \
|
||||
{ (MatDest)->stCol_0.xX=(VectA)->xX; \
|
||||
(MatDest)->stCol_0.xY=(VectA)->xY; \
|
||||
(MatDest)->stCol_1.xX=(VectB)->xX; \
|
||||
(MatDest)->stCol_1.xY=(VectB)->xY; }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of MTH2D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vPrintfVector( Name, VectA) \
|
||||
{ printf("%s = \n |%e", (Name), (VectA)->xX); \
|
||||
printf("\n |%e\n", (VectA)->xY); }
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH2D_M_vPrintfMatrix
|
||||
DESCRIPTION : Print a Matrix : Name + its values
|
||||
INPUT : Name : string
|
||||
MatA : address of MTH2D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH2D_M_vPrintfMatrix( Name, MatA) \
|
||||
{ printf("%s = \n |%e %e|", (Name), (MatA)->stCol_0.xX, (MatA)->stCol_1.xX ); \
|
||||
printf("\n |%e %e|\n", (MatA)->stCol_0.xY, (MatA)->stCol_1.xY ); }
|
||||
|
||||
|
||||
|
||||
#endif /* MTH2D_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
1640
Rayman_X/cpa/public/MTH/MTH3d.h
Normal file
1640
Rayman_X/cpa/public/MTH/MTH3d.h
Normal file
File diff suppressed because it is too large
Load Diff
1541
Rayman_X/cpa/public/MTH/MTH3dopt.h
Normal file
1541
Rayman_X/cpa/public/MTH/MTH3dopt.h
Normal file
File diff suppressed because it is too large
Load Diff
214
Rayman_X/cpa/public/MTH/MTH_Real.h
Normal file
214
Rayman_X/cpa/public/MTH/MTH_Real.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_Real.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Real definitions
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH_REAL_H
|
||||
#define MTH_REAL_H
|
||||
|
||||
/* ##INCLUDE#----------------------------------------------------------------------------
|
||||
Includes Files
|
||||
---------------------------------------------------------------------------------------*/
|
||||
#include "MTH_def.h"
|
||||
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-#################################
|
||||
## Define different Real Definition
|
||||
#################################### */
|
||||
typedef long MTH_tdxFixed16_16; /* Fixed real number type [16:16] */
|
||||
typedef float MTH_tdxFloat; /* Float real number type */
|
||||
typedef double MTH_tdxDouble; /* Double real number type */
|
||||
|
||||
|
||||
/* ##-####################################
|
||||
## Now decide witch one to use as Real
|
||||
####################################### */
|
||||
#ifdef MTH_RealIsFixed16_16
|
||||
typedef MTH_tdxFixed16_16 MTH_tdxReal;
|
||||
#include "MTH_fx16.h"
|
||||
#endif /* MTH_RealIsFixed16_16 */
|
||||
|
||||
#ifdef MTH_RealIsFloat
|
||||
typedef MTH_tdxFloat MTH_tdxReal;
|
||||
#include "MTH_flt.h"
|
||||
#endif /* MTH_RealIsFloat */
|
||||
|
||||
#ifdef MTH_RealIsDouble
|
||||
typedef MTH_tdxDouble MTH_tdxReal;
|
||||
#include "MTH_dble.h"
|
||||
#endif /* MTH_RealIsDouble */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-#################################
|
||||
## Real Conversions
|
||||
#################################### */
|
||||
|
||||
/* Fixed16_16 to Others : */
|
||||
#define MTH_M_xFixed16_16ToFixed16_16( X ) \
|
||||
(X)
|
||||
|
||||
#define MTH_M_xFixed16_16ToFloat( X ) \
|
||||
(float) ( (X) / 65536.0F )
|
||||
|
||||
#define MTH_M_xFixed16_16ToDouble( X ) \
|
||||
(double) ( (X) / 65536.0 )
|
||||
|
||||
#define MTH_M_xFixed16_16ToLong( X ) \
|
||||
(long)( (float) (X) / 65536.0F )
|
||||
|
||||
/* Float to Others : */
|
||||
#define MTH_M_xFloatToFixed16_16( X ) \
|
||||
(long)( (X) * 65536.0F )
|
||||
|
||||
#define MTH_M_xFloatToFloat( X ) \
|
||||
(X)
|
||||
|
||||
#define MTH_M_xFloatToDouble( X ) \
|
||||
(double) (X)
|
||||
|
||||
#ifdef MTH_OPTIMIZE
|
||||
#define MTH_M_xFloatToLong MTH_M_xRealToLongOpt
|
||||
#else /* NOT MTH_OPTIMIZE */
|
||||
#define MTH_M_xFloatToLong( X ) \
|
||||
(long) ( X )
|
||||
#endif /* MTH_OPTIMIZE */
|
||||
|
||||
|
||||
/* Double to Others : */
|
||||
#define MTH_M_xDoubleToFixed16_16( X ) \
|
||||
(long) ( (X) * 65536.0 )
|
||||
|
||||
#define MTH_M_xDoubleToFloat( X ) \
|
||||
(float) (X)
|
||||
|
||||
#define MTH_M_xDoubleToDouble( X ) \
|
||||
(X)
|
||||
|
||||
#define MTH_M_xDoubleToLong( X ) \
|
||||
(long) ( X )
|
||||
|
||||
/* Long to Others : */
|
||||
#define MTH_M_xLongToFixed16_16( X ) \
|
||||
(long) ( (X) * 65536 )
|
||||
|
||||
#define MTH_M_xLongToFloat( X ) \
|
||||
(float) (X)
|
||||
|
||||
#define MTH_M_xLongToDouble( X ) \
|
||||
(double) (X)
|
||||
|
||||
#define MTH_M_xLongToLong( X ) \
|
||||
(long)( X )
|
||||
|
||||
|
||||
/* Common Real definition : */
|
||||
|
||||
#ifdef MTH_RealIsFloat
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xRealToFixed16_16
|
||||
DESCRIPTION : Convert real to fixed 16:16
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : (fixed16:16)(a) : MTH_tdxFixed16_16
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xRealToFixed16_16 MTH_M_xFloatToFixed16_16
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xRealToFloat
|
||||
DESCRIPTION : Convert real to float
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : (float)(a) : MTH_tdxFloat
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xRealToFloat MTH_M_xFloatToFloat
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xRealToDouble
|
||||
DESCRIPTION : Convert real to double
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : (double)(a) : MTH_tdxDouble
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xRealToDouble MTH_M_xFloatToDouble
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xFixed16_16ToReal
|
||||
DESCRIPTION : Convert fixed 16:16 to real
|
||||
INPUT : a : MTH_tdxFixed16_16
|
||||
OUTPUT : (real)(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xFixed16_16ToReal MTH_M_xFixed16_16ToFloat
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xFloatToReal
|
||||
DESCRIPTION : Convert float to real
|
||||
INPUT : a : MTH_tdxFloat
|
||||
OUTPUT : (real)(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xFloatToReal MTH_M_xFloatToFloat
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xDoubleToReal
|
||||
DESCRIPTION : Convert double to real
|
||||
INPUT : a : MTH_tdxDouble
|
||||
OUTPUT : (real)(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xDoubleToReal MTH_M_xDoubleToFloat
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xLongToReal
|
||||
DESCRIPTION : Convert long to real
|
||||
INPUT : a : long
|
||||
OUTPUT : (real)(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xLongToReal MTH_M_xLongToFloat
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xRealToLong
|
||||
DESCRIPTION : Convert real to long
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : (long)(a) : long
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xRealToLong MTH_M_xFloatToLong
|
||||
|
||||
#endif /* MTH_RealIsFloat */
|
||||
|
||||
|
||||
#ifdef MTH_RealIsDouble
|
||||
#define MTH_M_xRealToFixed16_16 MTH_M_xDoubleToFixed16_16
|
||||
#define MTH_M_xRealToFloat MTH_M_xDoubleToFloat
|
||||
#define MTH_M_xRealToDouble MTH_M_xDoubleToDouble
|
||||
#define MTH_M_xFixed16_16ToReal MTH_M_xFixed16_16ToDouble
|
||||
#define MTH_M_xFloatToReal MTH_M_xFloatToDouble
|
||||
#define MTH_M_xDoubleToReal MTH_M_xDoubleToDouble
|
||||
#define MTH_M_xLongToReal MTH_M_xLongToDouble
|
||||
#define MTH_M_xRealToLong MTH_M_xDoubleToLong
|
||||
#endif /* MTH_RealIsDouble */
|
||||
|
||||
#ifdef MTH_RealIsFixed16_16
|
||||
#define MTH_M_xRealToFixed16_16 MTH_M_xFixed16_16ToFixed16_16
|
||||
#define MTH_M_xRealToFloat MTH_M_xFixed16_16ToFloat
|
||||
#define MTH_M_xRealToDouble MTH_M_xFixed16_16ToDouble
|
||||
#define MTH_M_xFixed16_16ToReal MTH_M_xFixed16_16ToFixed16_16
|
||||
#define MTH_M_xFloatToReal MTH_M_xFloatToFixed16_16
|
||||
#define MTH_M_xDoubleToReal MTH_M_xDoubleToFixed16_16
|
||||
#define MTH_M_xLongToReal MTH_M_xLongToFixed16_16
|
||||
#define MTH_M_xRealToLong MTH_M_xFixed16_16ToLong
|
||||
#endif /* MTH_RealIsFixed16_16 */
|
||||
|
||||
#endif /* MTH_REAL_H */
|
627
Rayman_X/cpa/public/MTH/MTH_dble.h
Normal file
627
Rayman_X/cpa/public/MTH/MTH_dble.h
Normal file
@@ -0,0 +1,627 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_dble.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Real implementation for double
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
MTH V5.0.14 / Alexandre LANGER [ALX] Ubi R&D / Add MTH_C_MAX_UNSIGNED_CHAR
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH_DBLE_H
|
||||
#define MTH_DBLE_H
|
||||
|
||||
|
||||
|
||||
/* ##CONSTANTE#--------------------------------------------------------------------------
|
||||
Real Constantes declaration
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#define MTH_C_InfinitPlus (double) 1.79769313486231E308
|
||||
#define MTH_C_InfinitMinus (double) -1.79769313486231E308
|
||||
#define MTH_C_EpsilonPlus (double) 2.2250738585073E-308
|
||||
#define MTH_C_EpsilonMinus (double) -2.2250738585073E-308
|
||||
|
||||
#define MTH_C_Pi (double) 3.141592653589793
|
||||
#define MTH_C_2Pi (double) 6.283185307179586
|
||||
#define MTH_C_PiBy2 (double) 1.570796326794896
|
||||
#define MTH_C_PiBy4 (double) 7.853981633974482E-1
|
||||
#define MTH_C_PiBy8 (double) 3.926990816987241E-1
|
||||
#define MTH_C_PiBy180 (double) 1.745329251994329E-2
|
||||
#define MTH_C_180ByPi (double) 5.729577951308233E1
|
||||
#define MTH_C_e (double) 2.718281828459045
|
||||
#define MTH_C_ONE (double) 1.0
|
||||
#define MTH_C_ZERO (double) 0.0
|
||||
|
||||
#define MTH_C_MinusONE (double) -1.0
|
||||
|
||||
#define MTH_C_2 (double) 2.0
|
||||
#define MTH_C_3 (double) 3.0
|
||||
#define MTH_C_4 (double) 4.0
|
||||
#define MTH_C_5 (double) 5.0
|
||||
|
||||
#define MTH_C_Minus2 (double) -2.0
|
||||
#define MTH_C_Minus3 (double) -3.0
|
||||
#define MTH_C_Minus4 (double) -4.0
|
||||
#define MTH_C_Minus5 (double) -5.0
|
||||
|
||||
#define MTH_C_Inv2 (double) 0.5
|
||||
#define MTH_C_Inv3 (double) 3.333333333333333E-1
|
||||
#define MTH_C_Inv4 (double) 0.25
|
||||
#define MTH_C_Inv5 (double) 0.2
|
||||
|
||||
#define MTH_C_MinusInv2 (double) -0.5
|
||||
#define MTH_C_MinusInv3 (double) -3.333333333333333E-1
|
||||
#define MTH_C_MinusInv4 (double) -0.25
|
||||
#define MTH_C_MinusInv5 (double) -0.2
|
||||
|
||||
#define MTH_C_Sqrt2 (double) 1.414213562373095
|
||||
#define MTH_C_Sqrt3 (double) 1.732050807568877
|
||||
#define MTH_C_Sqrt4 (double) 2.0
|
||||
#define MTH_C_Sqrt5 (double) 2.236067977499790
|
||||
|
||||
#define MTH_C_MinusSqrt2 (double) -1.414213562373095
|
||||
#define MTH_C_MinusSqrt3 (double) -1.732050807568877
|
||||
#define MTH_C_MinusSqrt4 (double) -2.0
|
||||
#define MTH_C_MinusSqrt5 (double) -2.236067977499790
|
||||
|
||||
#define MTH_C_InvSqrt2 (double) 7.071067811865475E-1
|
||||
#define MTH_C_InvSqrt3 (double) 5.773502691896259E-1
|
||||
#define MTH_C_InvSqrt4 (double) 0.5
|
||||
#define MTH_C_InvSqrt5 (double) 4.472135954999579E-1
|
||||
|
||||
#define MTH_C_MinusInvSqrt2 (double) -7.071067811865475E-1
|
||||
#define MTH_C_MinusInvSqrt3 (double) -5.773502691896259E-1
|
||||
#define MTH_C_MinusInvSqrt4 (double) -0.5
|
||||
#define MTH_C_MinusInvSqrt5 (double) -4.472135954999579E-1
|
||||
|
||||
#define MTH_C_MAX_UNSIGNED_CHAR (double) 256.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-################################################
|
||||
## MATHEMATICS MACRO AND FUNCTION FOR DOUBLE REAL
|
||||
################################################### */
|
||||
|
||||
|
||||
/* ##-################################################
|
||||
## Basic Mathematics MACRO
|
||||
################################################### */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xAdd
|
||||
DESCRIPTION : Return the addition of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a + b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xAdd( A, B) \
|
||||
((A) + (B))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSub
|
||||
DESCRIPTION : Return the subtraction of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a - b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSub( A, B) \
|
||||
((A) - (B))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMul
|
||||
DESCRIPTION : Return the multiply of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a * b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMul( A, B) \
|
||||
((A) * (B))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xDiv
|
||||
DESCRIPTION : Return the division of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a / b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xDiv( A, B) \
|
||||
((A) / (B))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xNeg
|
||||
DESCRIPTION : Return the negation of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : -a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xNeg( A ) \
|
||||
(- (A))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqr
|
||||
DESCRIPTION : Return the square of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a*a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSqr( A ) \
|
||||
( (A) * (A) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqrt
|
||||
DESCRIPTION : Return the square root of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : sqrt(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSqrt( A ) \
|
||||
( sqrt(A) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xInvSqrt
|
||||
DESCRIPTION : Return the inverse of the square root of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : 1/sqrt(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xInvSqrt( A ) \
|
||||
( MTH_M_xInv( sqrt( (A) ) ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xInv
|
||||
DESCRIPTION : Return the inverse of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : 1/a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xInv( A ) \
|
||||
( MTH_C_ONE / (A) )
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSign
|
||||
DESCRIPTION : Return the sign of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : -1 if(a<0), 1 if(a>0), else 0 : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSign( A ) \
|
||||
( ( (A)>MTH_C_ZERO ) ? MTH_C_ONE : ( ((A)<MTH_C_ZERO) ? MTH_C_MinusONE : MTH_C_ZERO) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xAbs
|
||||
DESCRIPTION : Return the absolute value of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : |a| : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xAbs( A ) \
|
||||
( ( ( A ) > MTH_C_ZERO ) ? ( A ) : ( -( A ) ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xNegAbs
|
||||
DESCRIPTION : Return the negative absolute value of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : -|a| : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xNegAbs( A ) \
|
||||
( ( ( A ) < MTH_C_ZERO ) ? ( A ) : ( -( A ) ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMax
|
||||
DESCRIPTION : Return the maximum of two real numbers
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : max(a, b) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMax( A, B) \
|
||||
(( (A)>(B) ) ? (A) : (B))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMin
|
||||
DESCRIPTION : Return the minimum of two real numbers
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : min(a, b) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMin( A, B) \
|
||||
(( (A)<(B) ) ? (A) : (B))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Test on real
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreater
|
||||
DESCRIPTION : Test if a real number is greater than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a > b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bGreater( A, B) \
|
||||
( (A)>(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLess
|
||||
DESCRIPTION : Test if a real number is less than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a < b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bLess( A, B) \
|
||||
( (A)<(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreaterEqual
|
||||
DESCRIPTION : Test if a real number is greater or equal than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a >= b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bGreaterEqual( A, B) \
|
||||
( (A)>=(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLessEqual
|
||||
DESCRIPTION : Test if a real number is less or equal than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a <= b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bLessEqual( A, B) \
|
||||
( (A)<=(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bEqual
|
||||
DESCRIPTION : Test if a real number is equal to a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a == b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bEqual( A, B) \
|
||||
( (A)==(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bDifferent
|
||||
DESCRIPTION : Test if a real number is different to a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a != b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bDifferent( A, B ) \
|
||||
( (A)!=(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bIsNull
|
||||
DESCRIPTION : Test if a real number is null
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a == 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bIsNull(A) \
|
||||
( (A) == MTH_C_ZERO )
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 2D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMulAddMul
|
||||
DESCRIPTION : Return the addition of two multiplications
|
||||
INPUT : a, b, c, d : MTH_tdxReal
|
||||
OUTPUT : a*b + c*d : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMulAddMul(a, b, c, d) \
|
||||
((a)*(b) + (c)*(d))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqrAddSqr
|
||||
DESCRIPTION : Return the addition of two squares
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a*a + b*b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSqrAddSqr(a, b) \
|
||||
((a)*(a) + (b)*(b))
|
||||
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 3D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMulSubMul
|
||||
DESCRIPTION : Return the subtraction of two multiplications
|
||||
INPUT : a, b, c, d : MTH_tdxReal
|
||||
OUTPUT : a*b - c*d : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMulSubMul(a, b, c, d) \
|
||||
((a)*(b) - (c)*(d))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMulAddMulAddMul
|
||||
DESCRIPTION : Return the adition of three multiplications
|
||||
INPUT : a, b, c, d, e, f : MTH_tdxReal
|
||||
OUTPUT : a*b + c*d + e*f : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMulAddMulAddMul(a, b, c, d, e, f) \
|
||||
((a)*(b) + (c)*(d) + (e)*(f))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqrAddSqrAddSqr
|
||||
DESCRIPTION : Return the adition of three squares
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : a*a + b*b + c*c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSqrAddSqrAddSqr(a, b, c) \
|
||||
((a)*(a) + (b)*(b) + (c)*(c))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMul3
|
||||
DESCRIPTION : Return the multiplication of three real numbers
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : a*b*c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMul3(a, b, c) \
|
||||
((a)*(b)*(c))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMul4
|
||||
DESCRIPTION : Return the multiplication of 4 real numbers
|
||||
INPUT : a, b, c, d : MTH_tdxReal
|
||||
OUTPUT : a*b*c*d : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMul4(a, b, c, d) \
|
||||
((a)*(b)*(c)*(d))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xAdd3
|
||||
DESCRIPTION : Return the addition of three real numbers
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : a+b+c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xAdd3(a, b, c) \
|
||||
((a)+(b)+(c))
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Test Real near Zero
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bEqualZero
|
||||
DESCRIPTION : Test if a real is equal to zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a == 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bEqualZero( x ) \
|
||||
MTH_M_bEqual((x), MTH_C_ZERO )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bDifferentZero
|
||||
DESCRIPTION : Test if a real is different to zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a != 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bDifferentZero( x ) \
|
||||
MTH_M_bDifferent((x), MTH_C_ZERO )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreaterZero
|
||||
DESCRIPTION : Test if a real is greater than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a > 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bGreaterZero(x) \
|
||||
MTH_M_bGreater((x), MTH_C_ZERO)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLessZero
|
||||
DESCRIPTION : Test if a real is less than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a < 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bLessZero(x) \
|
||||
MTH_M_bLess((x), MTH_C_ZERO)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreaterEqualZero
|
||||
DESCRIPTION : Test if a real is greater or equal than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a >= 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bGreaterEqualZero( x ) \
|
||||
MTH_M_bGreaterEqual((x), MTH_C_ZERO)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLessEqualZero
|
||||
DESCRIPTION : Test if a real is less or equal than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a <= 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bLessEqualZero(x) \
|
||||
MTH_M_bLessEqual((x), MTH_C_ZERO)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInRangeEqual
|
||||
DESCRIPTION : Test if a real is in range or equal of two other reals
|
||||
INPUT : x, a, b : MTH_tdxReal
|
||||
OUTPUT : x E [a,b] : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInRangeEqual( x, a, b) \
|
||||
( MTH_M_bGreaterEqual((x),(a)) && MTH_M_bLessEqual((x),(b)) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInRange
|
||||
DESCRIPTION : Test if a real is in range of two other reals
|
||||
INPUT : x, a, b : MTH_tdxReal
|
||||
OUTPUT : x E ]a,b[ : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInRange( x, a, b) \
|
||||
( MTH_M_bGreater((x),(a)) && MTH_M_bLess((x),(b)) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInUnitEqual
|
||||
DESCRIPTION : Test if a real is in range of [0,1]
|
||||
INPUT : x, : MTH_tdxReal
|
||||
OUTPUT : x E [0,1] : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInUnitEqual( x ) \
|
||||
( MTH_M_bGreaterEqual((x),MTH_C_ZERO) && MTH_M_bLessEqual((x),MTH_C_ONE))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInUnit
|
||||
DESCRIPTION : Test if a real is in range of ]0,1[
|
||||
INPUT : x, : MTH_tdxReal
|
||||
OUTPUT : x E ]0,1[ : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInUnit( x ) \
|
||||
( MTH_M_bGreater((x),MTH_C_ZERO) && MTH_M_bLess((x),MTH_C_ONE) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bEqualWithEpsilon
|
||||
DESCRIPTION : Test if a real is near a other real
|
||||
INPUT : a, b, eps : MTH_tdxReal
|
||||
OUTPUT : |a-b|<eps : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bEqualWithEpsilon( A, B, EPS) \
|
||||
(MTH_M_bLess( MTH_M_xAbs((A)-(B)), (EPS) ))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bDifferentWithEpsilon
|
||||
DESCRIPTION : Test if a real is near different a other real
|
||||
INPUT : a, b, eps : MTH_tdxReal
|
||||
OUTPUT : |a-b|>eps : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bDifferentWithEpsilon( A, B, EPS ) \
|
||||
(MTH_M_bGreater( MTH_M_xAbs((A)-(B)), (EPS) ))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bIsNullWithEpsilon
|
||||
DESCRIPTION : Test if a real is near zero
|
||||
INPUT : a, eps : MTH_tdxReal
|
||||
OUTPUT : |a|<eps : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bIsNullWithEpsilon(A, EPS) \
|
||||
(MTH_M_bLess( MTH_M_xAbs(A), (EPS) ))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Polynomial operations
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xLinearInterpol
|
||||
DESCRIPTION : Return linear interpolation
|
||||
INPUT : a, b, t : MTH_tdxReal
|
||||
OUTPUT : a + t*(b-a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xLinearInterpol(a, b, t) \
|
||||
MTH_M_xAdd( (a), MTH_M_xMul((t), MTH_M_xSub( (b), (a) ) ) )
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xTrinomeDelta
|
||||
DESCRIPTION : Return the delta of a trinome
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : b*b - 4*a*c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xTrinomeDelta( a, b, c) \
|
||||
( MTH_M_xSub ( MTH_M_xSqr ( (b) ), \
|
||||
MTH_M_xMul ( MTH_C_4, MTH_M_xMul ( (a), (c) ) ) ) \
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-################################
|
||||
## Trigonometric Mathematics MACRO
|
||||
################################### */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSin
|
||||
DESCRIPTION : Return the sinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : sin(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSin( X ) \
|
||||
sin( X )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xCos
|
||||
DESCRIPTION : Return the cosinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : cos(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xCos( X ) \
|
||||
cos( X )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xTan
|
||||
DESCRIPTION : Return the tangent of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : tan(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xTan( X ) \
|
||||
tan( X )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xATan
|
||||
DESCRIPTION : Return the Arc-tangent of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : Atan(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xATan( X ) \
|
||||
atan( X )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xACos
|
||||
DESCRIPTION : Return the Arc-cosinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : Acos(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xACos( X ) \
|
||||
acos( X )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xASin
|
||||
DESCRIPTION : Return the Arc-sinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : Asin(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xASin( X ) \
|
||||
asin( X )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xCoTan
|
||||
DESCRIPTION : Return the Co-tangent of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : CoTan(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xCoTan( X ) \
|
||||
(MTH_C_ONE / tan( X ))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xDegToRad
|
||||
DESCRIPTION : Return the conversion from degree to radian
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : rad(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xDegToRad( X ) \
|
||||
( ( X ) *( MTH_C_PiBy180 ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xDegToRad
|
||||
DESCRIPTION : Return the conversion from radian to degree
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : deg(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xRadToDeg( X ) \
|
||||
( ( X ) *( MTH_C_180ByPi ) )
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* MTH_DBLE_H */
|
197
Rayman_X/cpa/public/MTH/MTH_def.h
Normal file
197
Rayman_X/cpa/public/MTH/MTH_def.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_def.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Real precision and target definitions
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH_DEF_H
|
||||
#define MTH_DEF_H
|
||||
|
||||
|
||||
/* #define MTH_CHECK */ /* UNCOMMENT THIS FOR GLOBAL TEST ONLY */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Optimization
|
||||
############################## */
|
||||
|
||||
/* =========== Allow optimization : ==== */
|
||||
#define MTH_OPTIMIZE
|
||||
/* Detect optimization forbiden : */
|
||||
#ifdef MTH_NO_OPTIMIZE
|
||||
#pragma message ("*** MTH : Warning MTH_OPTMIZE has been removed!")
|
||||
#undef MTH_OPTIMIZE
|
||||
#endif /* MTH_NO_OPTIMIZE */
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Checking NAN
|
||||
############################## */
|
||||
|
||||
/* =========== Warning When MTH_CHECK is Enable : ==== */
|
||||
/*#ifdef MTH_CHECK*/
|
||||
/*#pragma message ("*** MTH : Warning MTH_CHECK is Enable ! Do Not Archive this Lib !")*/
|
||||
/*#endif /* MTH_CHECK */
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Precision
|
||||
############################## */
|
||||
|
||||
/* =========== Detect precision : ====== */
|
||||
/* === Low precision : */
|
||||
#ifdef MTH_LOW
|
||||
|
||||
#ifdef MTH_MEDIUM
|
||||
#pragma message ("*** MTH : Precision conflict ! MTH_MEDIUM Disable")
|
||||
#undef MTH_MEDIUM
|
||||
#endif /* MTH_MEDIUM */
|
||||
|
||||
#ifdef MTH_HIGH
|
||||
#pragma message ("*** MTH : Precision conflict ! MTH_HIGH Disable")
|
||||
#undef MTH_HIGH
|
||||
#endif /* MTH_HIGH */
|
||||
|
||||
#pragma message ("*** MTH : Precision set to MTH_LOW")
|
||||
#define MTH_PrecisionFound
|
||||
|
||||
#endif /* MTH_LOW */
|
||||
|
||||
/* === Medium precision : */
|
||||
#ifdef MTH_MEDIUM
|
||||
|
||||
#ifdef MTH_LOW
|
||||
#pragma message ("*** MTH : Precision conflict ! MTH_LOW Disable")
|
||||
#undef MTH_LOW
|
||||
#endif /* MTH_LOW */
|
||||
|
||||
#ifdef MTH_HIGH
|
||||
#pragma message ("*** MTH : Precision conflict ! MTH_HIGH Disable")
|
||||
#undef MTH_HIGH
|
||||
#endif /* MTH_HIGH */
|
||||
|
||||
#pragma message ("*** MTH : Precision set to MTH_MEDIUM")
|
||||
#define MTH_PrecisionFound
|
||||
|
||||
#endif /* MTH_MEDIUM */
|
||||
|
||||
/* === High precision : */
|
||||
#ifdef MTH_HIGH
|
||||
|
||||
#ifdef MTH_LOW
|
||||
#pragma message ("*** MTH : Precision conflict ! MTH_LOW Disable")
|
||||
#undef MTH_LOW
|
||||
#endif /* MTH_LOW */
|
||||
|
||||
#ifdef MTH_MEDIUM
|
||||
#pragma message ("*** MTH : Precision conflict ! MTH_MEDIUM Disable")
|
||||
#undef MTH_MEDIUM
|
||||
#endif /* MTH_MEDIUM */
|
||||
|
||||
#pragma message ("*** MTH : Precision set to MTH_HIGH")
|
||||
#define MTH_PrecisionFound
|
||||
|
||||
#endif /* MTH_HIGH */
|
||||
|
||||
/* === Default precision : */
|
||||
#ifndef MTH_PrecisionFound
|
||||
|
||||
#define MTH_MEDIUM
|
||||
/*
|
||||
#pragma message ("*** MTH : Precision set to Default : MTH_LOW")
|
||||
*/
|
||||
#endif /* NOT MTH_PrecisionFound */
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Detect Tagets
|
||||
############################## */
|
||||
|
||||
/* Remark :
|
||||
NO_ASSEMBLY_IN_GLI must disappear when all references are deleted in GLI
|
||||
*/
|
||||
|
||||
/* The default machine is MTH_UNKOWN_DEV */
|
||||
#define MTH_UNKOWN_DEV /* Default for Dev machine */
|
||||
|
||||
/* Detect PC Compilators */
|
||||
#ifdef _MSC_VER
|
||||
#ifndef VISUAL
|
||||
#define VISUAL
|
||||
#endif /* VISUAL undef */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifdef VISUAL
|
||||
#undef MTH_UNKOWN_DEV
|
||||
#define MTH_PC_DEV /* Default PC Dev machine */
|
||||
#endif /* VISUAL */
|
||||
#ifdef WATCOM
|
||||
#undef MTH_UNKOWN_DEV
|
||||
#define MTH_PC_DEV /* Default PC Dev machine */
|
||||
#endif /* WATCOM */
|
||||
|
||||
/* Detect U64 Machine */
|
||||
#ifdef U64
|
||||
#undef MTH_UNKOWN_DEV
|
||||
#undef MTH_PC_DEV
|
||||
#define MTH_U64_DEV
|
||||
#endif /* U64 */
|
||||
|
||||
/* Warning if Target not reconized : */
|
||||
#ifdef MTH_UNKOWN_DEV
|
||||
#pragma message ("*** MTH : !! ALERT !! Alien Target Machine Found (Unkown Target) !")
|
||||
#pragma message ("*** VISUAL NOR WATCOM NOR U64 is defined ! Check your makefile please !")
|
||||
#define MTH_RealIsFloat
|
||||
#define NO_ASSEMBLY_IN_GLI
|
||||
#endif /* MTH_UNKOWN_DEV */
|
||||
|
||||
|
||||
/* =========== MTH_U64_DEV =============== */
|
||||
/* Developing version. */
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_RealIsFloat
|
||||
#define NO_ASSEMBLY_IN_GLI
|
||||
#if defined(MTH_RealIsFloat) && !defined(ACTIVE_EDITOR)
|
||||
#define OPTIMIZED_FOR_PC_FLOATS
|
||||
#ifndef CODEWARRIOR_GCC
|
||||
#define OPTIMIZED_FOR_U64_ASM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* MTH_U64_DEV */
|
||||
|
||||
/* =========== MTH_PC_DEV =============== */
|
||||
/* Pentium computer with Win95 */
|
||||
/* Developing version. */
|
||||
#ifdef MTH_PC_DEV
|
||||
/*#pragma message ("*** MTH : MTH_PC_DEV Defined")*/
|
||||
#define MTH_RealIsFloat
|
||||
/* ylt, always optimize (even with editors)*/
|
||||
/*#if defined(MTH_RealIsFloat) && !defined(ACTIVE_EDITOR)*/
|
||||
#define OPTIMIZED_FOR_PC_FLOATS
|
||||
/*#pragma message ("*** MTH : OPTIMIZED_FOR_PC_FLOATS Defined")*/
|
||||
#define OPTIMIZED_FOR_PC_FLOATS_WITH_ASM
|
||||
/*#pragma message ("*** MTH : OPTIMIZED_FOR_PC_FLOATS_WITH_ASM Defined")*/
|
||||
/*#endif*/
|
||||
#define NO_ASSEMBLY_IN_GLI
|
||||
#endif /* MTH_PC_DEV */
|
||||
|
||||
/* =========== MTH_PC_FINAL ============ */
|
||||
/* Pentium computer with Win95 */
|
||||
/* Final games version. => for GliGloo ONLY !!! Do Not Use !*/
|
||||
#ifdef MTH_PC_FINAL
|
||||
#define MTH_RealIsFloat
|
||||
#endif /* MTH_PC_FINAL */
|
||||
|
||||
#define MTH_CALL /* __cdecl */
|
||||
|
||||
#endif /* MTH_DEF_H */
|
250
Rayman_X/cpa/public/MTH/MTH_fchk.h
Normal file
250
Rayman_X/cpa/public/MTH/MTH_fchk.h
Normal file
@@ -0,0 +1,250 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_fchk.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Checking utilities for NAN float numbers
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* ##INCLUDE#----------------------------------------------------------------------------
|
||||
Includes Files
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#include <assert.h>
|
||||
#ifndef MTH_FCHK_H
|
||||
#define MTH_FCHK_H
|
||||
#include "acp_base.h"
|
||||
|
||||
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_vCHK
|
||||
DESCRIPTION : Make a break on NAN (not a number)
|
||||
INPUT : a : float
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/* Checking for NAN or Infinite Numbers */
|
||||
#ifdef VISUAL
|
||||
#define MTH_M_vCHK(X) \
|
||||
{ \
|
||||
if( ( *(long *)&(X) & 0x7F800000)==0x7F800000 ) \
|
||||
{ \
|
||||
_asm{ \
|
||||
int 3 \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#else /* OTHERS */
|
||||
#define MTH_M_vCHK(X) \
|
||||
assert( !( ( *(long *)&(X) & 0x7F800000)==0x7F800000) )
|
||||
#endif /* VISUAL OR OTHERS */
|
||||
|
||||
|
||||
|
||||
/* ##FUNCDEF#----------------------------------------------------------------------------
|
||||
Functions definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xRealToLongRoundCHK
|
||||
DESCRIPTION : Return long round of a real number with NAN check
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : round(a) : long
|
||||
=======================================================================================*/
|
||||
INLINE long MTH_CALL MTH_fn_xRealToLongRoundCHK(float f)
|
||||
{
|
||||
MTH_M_vCHK(f);
|
||||
|
||||
return ( (long) ( (long)(f*2.0F)-(long)(f) ) );
|
||||
}
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xAddCHK
|
||||
DESCRIPTION : Return the addition of two real numbers with NAN check
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a + b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xAddCHK(float a, float b)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
MTH_M_vCHK(b);
|
||||
|
||||
res= a + b;
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xSubCHK
|
||||
DESCRIPTION : Return the subtraction of two real numbers with NAN check
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a - b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xSubCHK(float a, float b)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
MTH_M_vCHK(b);
|
||||
|
||||
res= a - b;
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xMulCHK
|
||||
DESCRIPTION : Return the multiply of two real numbers with NAN check
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a * b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xMulCHK(float a, float b)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
MTH_M_vCHK(b);
|
||||
|
||||
res= a * b;
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xDivCHK
|
||||
DESCRIPTION : Return the division of two real numbers with NAN check
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a / b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xDivCHK(float a, float b)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
MTH_M_vCHK(b);
|
||||
|
||||
res= a / b;
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xNegCHK
|
||||
DESCRIPTION : Return the negation of a real number with NAN check
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : -a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xNegCHK(float a)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
|
||||
res= -a;
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xSqrCHK
|
||||
DESCRIPTION : Return the square of a real number with NAN check
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a*a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xSqrCHK(float a)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
|
||||
res= a * a;
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xSqrtCHK
|
||||
DESCRIPTION : Return the square root of a real number with NAN check
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : sqrt(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xSqrtCHK(float a)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
|
||||
res= ( (float) sqrt((double) (a)) );
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xInvSqrtCHK
|
||||
DESCRIPTION : Return the inverse of the square root of a real number with NAN check
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : 1/sqrt(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xInvSqrtCHK(float a)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
|
||||
res= 1.0F / ( (float) sqrt((double) (a)) );
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
/* ##F==================================================================================
|
||||
NAME : MTH_fn_xInvCHK
|
||||
DESCRIPTION : Return the inverse of a real number with NAN check
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : 1/a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE float MTH_CALL MTH_fn_xInvCHK(float a)
|
||||
{
|
||||
float res;
|
||||
|
||||
MTH_M_vCHK(a);
|
||||
|
||||
res= 1.0F / a;
|
||||
|
||||
MTH_M_vCHK(res);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* MTH_FCHK_H */
|
||||
|
935
Rayman_X/cpa/public/MTH/MTH_flt.h
Normal file
935
Rayman_X/cpa/public/MTH/MTH_flt.h
Normal file
@@ -0,0 +1,935 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_flt.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Real implementation for float
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
MTH V5.0.14 / Alexandre LANGER [ALX] Ubi R&D / Add MTH_C_MAX_UNSIGNED_CHAR
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH_FLT_H
|
||||
#define MTH_FLT_H
|
||||
|
||||
|
||||
/* ##INCLUDE#----------------------------------------------------------------------------
|
||||
Includes Files
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef MTH_CHECK
|
||||
#include "MTH_fchk.h"
|
||||
#else
|
||||
#define MTH_M_vCHK(X) {}
|
||||
#endif /* MTH_CHECK */
|
||||
|
||||
#ifdef MTH_OPTIMIZE
|
||||
#include "MTH_fopt.h"
|
||||
#else
|
||||
#include "MTH_fnop.h"
|
||||
#endif /* MTH_OPTIMIZE */
|
||||
|
||||
#ifdef MTH_U64_DEV
|
||||
#include "MTH_trig.h"
|
||||
#endif /* MTH_U64_DEV */
|
||||
|
||||
|
||||
/* ##CONSTANTE#--------------------------------------------------------------------------
|
||||
Real Constantes declaration
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#define MTH_C_InfinitPlus (float) 3.402822E38
|
||||
#define MTH_C_InfinitMinus (float) -3.402822E38
|
||||
#define MTH_C_EpsilonPlus (float) 1.175495E-38
|
||||
#define MTH_C_EpsilonMinus (float) -1.175495E-38
|
||||
|
||||
#define MTH_C_Pi (float) 3.141592653589793
|
||||
#define MTH_C_2Pi (float) 6.283185307179586
|
||||
#define MTH_C_PiBy2 (float) 1.570796326794896
|
||||
#define MTH_C_PiBy4 (float) 7.853981633974482E-1
|
||||
#define MTH_C_PiBy8 (float) 3.926990816987241E-1
|
||||
#define MTH_C_PiBy180 (float) 1.745329251994329E-2
|
||||
#define MTH_C_180ByPi (float) 5.729577951308233E1
|
||||
#define MTH_C_e (float) 2.718281828459045
|
||||
#define MTH_C_ONE (float) 1.0
|
||||
#define MTH_C_ZERO (float) 0.0
|
||||
|
||||
#define MTH_C_MinusONE (float) -1.0
|
||||
|
||||
#define MTH_C_2 (float) 2.0
|
||||
#define MTH_C_3 (float) 3.0
|
||||
#define MTH_C_4 (float) 4.0
|
||||
#define MTH_C_5 (float) 5.0
|
||||
#define MTH_C_8 (float) 8.0
|
||||
|
||||
#define MTH_C_Minus2 (float) -2.0
|
||||
#define MTH_C_Minus3 (float) -3.0
|
||||
#define MTH_C_Minus4 (float) -4.0
|
||||
#define MTH_C_Minus5 (float) -5.0
|
||||
|
||||
#define MTH_C_Inv2 (float) 0.5
|
||||
#define MTH_C_Inv3 (float) 3.333333333333333E-1
|
||||
#define MTH_C_Inv4 (float) 0.25
|
||||
#define MTH_C_Inv5 (float) 0.2
|
||||
|
||||
#define MTH_C_MinusInv2 (float) -0.5
|
||||
#define MTH_C_MinusInv3 (float) -3.333333333333333E-1
|
||||
#define MTH_C_MinusInv4 (float) -0.25
|
||||
#define MTH_C_MinusInv5 (float) -0.2
|
||||
|
||||
#define MTH_C_Sqrt2 (float) 1.414213562373095
|
||||
#define MTH_C_Sqrt3 (float) 1.732050807568877
|
||||
#define MTH_C_Sqrt4 (float) 2.0
|
||||
#define MTH_C_Sqrt5 (float) 2.236067977499790
|
||||
|
||||
#define MTH_C_MinusSqrt2 (float) -1.414213562373095
|
||||
#define MTH_C_MinusSqrt3 (float) -1.732050807568877
|
||||
#define MTH_C_MinusSqrt4 (float) -2.0
|
||||
#define MTH_C_MinusSqrt5 (float) -2.236067977499790
|
||||
|
||||
#define MTH_C_InvSqrt2 (float) 7.071067811865475E-1
|
||||
#define MTH_C_InvSqrt3 (float) 5.773502691896259E-1
|
||||
#define MTH_C_InvSqrt4 (float) 0.5
|
||||
#define MTH_C_InvSqrt5 (float) 4.472135954999579E-1
|
||||
|
||||
#define MTH_C_MinusInvSqrt2 (float) -7.071067811865475E-1
|
||||
#define MTH_C_MinusInvSqrt3 (float) -5.773502691896259E-1
|
||||
#define MTH_C_MinusInvSqrt4 (float) -0.5
|
||||
#define MTH_C_MinusInvSqrt5 (float) -4.472135954999579E-1
|
||||
|
||||
#define MTH_C_MAX_UNSIGNED_CHAR (float) 256.0
|
||||
#define MTH_C_MAX_LONG (long) 2147483647
|
||||
|
||||
#define MTH_M_xInterpretLongAsFloat(a) (*((float*)&(a)))
|
||||
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-################################################
|
||||
## MATHEMATICS MACRO AND FUNCTION FOR FLOAT REAL
|
||||
################################################### */
|
||||
|
||||
|
||||
/* ##-################################################
|
||||
## Basic Mathematics MACRO
|
||||
################################################### */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xRealToLongRound
|
||||
DESCRIPTION : Return long round of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : round(a) : long
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_OPTIMIZE
|
||||
#define MTH_M_xRealToLongRound MTH_M_xRealToLongRoundOpt
|
||||
#else /* NOT MTH_OPTIMIZE */
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xRealToLongRound(A) MTH_fn_xRealToLongRoundCHK(A)
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xRealToLongRound(A) \
|
||||
(long) ( (long)(A*2.0F)-(long)(A) )
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
#endif /* MTH_OPTIMIZE */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xAdd
|
||||
DESCRIPTION : Return the addition of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a + b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xAdd( A, B) MTH_fn_xAddCHK( A, B)
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xAdd( A, B) \
|
||||
((A) + (B))
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSub
|
||||
DESCRIPTION : Return the subtraction of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a - b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xSub( A, B) MTH_fn_xSubCHK( A, B)
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xSub( A, B) \
|
||||
((A) - (B))
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMul
|
||||
DESCRIPTION : Return the multiply of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a * b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xMul( A, B) MTH_fn_xMulCHK( A, B)
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xMul( A, B) \
|
||||
((A) * (B))
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xDiv
|
||||
DESCRIPTION : Return the division of two real numbers
|
||||
INPUT : a, b : 2 MTH_tdxReal
|
||||
OUTPUT : a / b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_OPTIMIZE
|
||||
#define MTH_M_xDiv MTH_M_xDivOpt
|
||||
#else /* NOT MTH_OPTIMIZE */
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xDiv( A, B) MTH_fn_xDivCHK( A, B)
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xDiv( A, B) \
|
||||
((A) / (B))
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
#endif /* MTH_OPTIMIZE */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xNeg
|
||||
DESCRIPTION : Return the negation of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : -a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xNeg( A ) MTH_fn_xNegCHK( A )
|
||||
|
||||
#else
|
||||
|
||||
INLINE
|
||||
float MTH_M_xNegOpt( MTH_tdxReal xA )
|
||||
{
|
||||
/* yann le tensorer, sept 28, 1998*/
|
||||
unsigned long xNeg;
|
||||
unsigned long* pA=(unsigned long*)&xA;
|
||||
|
||||
xNeg=(*pA)+0x80000000;
|
||||
|
||||
return MTH_M_xInterpretLongAsFloat(xNeg);
|
||||
}
|
||||
|
||||
#define MTH_M_xNeg(a) (MTH_M_xNegOpt(a))
|
||||
#endif
|
||||
|
||||
/*#define MTH_M_xNeg( A ) \
|
||||
(- (A))
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqr
|
||||
DESCRIPTION : Return the square of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a*a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xSqr( A ) MTH_fn_xSqrCHK( A )
|
||||
#else /* NOT MTH_CHECK */
|
||||
INLINE
|
||||
float MTH_M_xSqrOpt( MTH_tdxReal xA )
|
||||
{
|
||||
/* yann le tensorer, sept 28, 1998*/
|
||||
return (xA*xA);
|
||||
}
|
||||
#define MTH_M_xSqr(a) (MTH_M_xSqrOpt(a))
|
||||
|
||||
/*#define MTH_M_xSqr( A ) \
|
||||
( (A) * (A) )
|
||||
*/
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqrt
|
||||
DESCRIPTION : Return the square root of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : sqrt(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
|
||||
#ifdef MTH_OPTIMIZE
|
||||
#define MTH_M_xSqrt MTH_M_xSqrtOpt
|
||||
#else /* NOT MTH_OPTIMIZE */
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xSqrt(A) ( sqrtf( A ) )
|
||||
#define MTH_M_xQuickSqrt(A) ( sqrtf( A ) )
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xSqrt(A) MTH_fn_xSqrtCHK(A)
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xSqrt(A) ( (float) sqrt((double) (A)) )
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
#endif /* MTH_OPTIMIZE */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xInvSqrt
|
||||
DESCRIPTION : Return the inverse of the square root of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : 1/sqrt(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_OPTIMIZE
|
||||
#define MTH_M_xInvSqrt MTH_M_xInvSqrtOpt
|
||||
#else /* NOT MTH_OPTIMIZE */
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xInvSqrt( A ) MTH_fn_xInvSqrtCHK( A )
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xInvSqrt( A ) ( MTH_C_ONE / MTH_M_xSqrt( A ) )
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
#endif /* MTH_OPTIMIZE */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xInv
|
||||
DESCRIPTION : Return the inverse of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : 1/a : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_OPTIMIZE
|
||||
#define MTH_M_xInv MTH_M_xInvOpt
|
||||
#else /* NOT MTH_OPTIMIZE */
|
||||
#ifdef MTH_CHECK
|
||||
#define MTH_M_xInv(A) MTH_fn_xInvCHK(A)
|
||||
#else /* NOT MTH_CHECK */
|
||||
#define MTH_M_xInv(A) ( MTH_C_ONE / (A) )
|
||||
#endif /* MTH_CHECK OR NOT */
|
||||
#endif /* MTH_OPTIMIZE */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSign
|
||||
DESCRIPTION : Return the sign of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : -1 if(a<0), 1 if(a>0), else 0 : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE
|
||||
MTH_tdxReal MTH_M_xSign( MTH_tdxReal x)
|
||||
{
|
||||
/* yann le tensorer, sept 22, 1998 */
|
||||
register long* px=(long*)&x;
|
||||
long xSign;
|
||||
|
||||
if (((*px)&0x7FFFFFFF)==0) return MTH_C_ZERO;
|
||||
else
|
||||
{
|
||||
xSign=*px;
|
||||
xSign&=0x80000000;
|
||||
xSign|=0x3f800000;
|
||||
return MTH_M_xInterpretLongAsFloat(xSign) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
#define MTH_M_xSign( A ) \
|
||||
( ( (A)>MTH_C_ZERO ) ? MTH_C_ONE : ( ((A)<MTH_C_ZERO) ? MTH_C_MinusONE : MTH_C_ZERO) )
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xAbs
|
||||
DESCRIPTION : Return the asolute value of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : |a| : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE
|
||||
MTH_tdxReal MTH_M_xAbs( MTH_tdxReal x)
|
||||
{
|
||||
#ifndef U64
|
||||
/* yann le tensorer, sept 22, 1998*/
|
||||
|
||||
register long* px=(long*)&x;
|
||||
long xAbs;
|
||||
|
||||
xAbs=(*px)&0x7FFFFFFF;
|
||||
|
||||
return MTH_M_xInterpretLongAsFloat(xAbs);
|
||||
#else
|
||||
/* U64 version*/
|
||||
*((long *)&x) &= 0x7FFFFFFF;
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
float compare + fld +fstp takes at least 10 cycles ! we better just clear the sign flag */
|
||||
/*#define MTH_M_xAbs( A ) \
|
||||
( ( ( A ) > MTH_C_ZERO ) ? ( A ) : ( -( A ) ) ) */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xNegAbs
|
||||
DESCRIPTION : Return the negative absolute value of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : -|a| : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
INLINE
|
||||
MTH_tdxReal MTH_M_xNegAbs( MTH_tdxReal x)
|
||||
{
|
||||
/* yann le tensorer, sept 22, 1998*/
|
||||
|
||||
register long* px=(long*)&x;
|
||||
long xNegAbs;
|
||||
|
||||
xNegAbs=(*px)|0x80000000;
|
||||
|
||||
return MTH_M_xInterpretLongAsFloat(xNegAbs);
|
||||
}
|
||||
/*
|
||||
#define MTH_M_xNegAbs( A ) \
|
||||
( ( ( A ) < MTH_C_ZERO ) ? ( A ) : ( -( A ) ) )
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMax
|
||||
DESCRIPTION : Return the maximum of two real numbers
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : max(a, b) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMax( A, B) \
|
||||
(( (A)>(B) ) ? (A) : (B))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMin
|
||||
DESCRIPTION : Return the minimum of two real numbers
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : min(a, b) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMin( A, B) \
|
||||
(( (A)<(B) ) ? (A) : (B))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Test on real
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreater
|
||||
DESCRIPTION : Test if a real number is greater than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a > b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bGreater( A, B) \
|
||||
( (A)>(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLess
|
||||
DESCRIPTION : Test if a real number is less than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a < b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bLess( A, B) \
|
||||
( (A)<(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreaterEqual
|
||||
DESCRIPTION : Test if a real number is greater or equal than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a >= b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bGreaterEqual( A, B) \
|
||||
( (A)>=(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLessEqual
|
||||
DESCRIPTION : Test if a real number is less or equal than a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a <= b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bLessEqual( A, B) \
|
||||
( (A)<=(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bEqual
|
||||
DESCRIPTION : Test if a real number is equal to a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a == b : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bEqual( A, B) \
|
||||
( (A)==(B) )
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bDifferent
|
||||
DESCRIPTION : Test if a real number is different to a other
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a != b : Boolean
|
||||
=======================================================================================*/
|
||||
/*INLINE
|
||||
long MTH_M_bDifferent( MTH_tdxReal xA, MTH_tdxReal xB)
|
||||
{
|
||||
// yann le tensorer, sept 23, 1998
|
||||
//we test if the floats are equal by direcly testing the memory (much faster)
|
||||
|
||||
register long* pA=(long*)&xA;
|
||||
register long* pB=(long*)&xB;
|
||||
// we have to do this becaus zero in float can be 0x80000000 or 0x00000000
|
||||
|
||||
#ifdef _DEBUG
|
||||
// to be sure it always works...
|
||||
// if it breaks here, inform yann le tensorer
|
||||
long result1 = ( ( ((*pA)-(*pB)) & 0x7FFFFFFF )!=0);
|
||||
long result2 = (xA!=xB);
|
||||
if (result1!=result2)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
int 3
|
||||
}
|
||||
// some troubles happenned, so we return the good result...
|
||||
return result2;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ( ( ((*pA)-(*pB)) & 0x7FFFFFFF )!=0);
|
||||
|
||||
}*/
|
||||
|
||||
#define MTH_M_bDifferent( A, B ) \
|
||||
( (A)!=(B) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bIsNull
|
||||
DESCRIPTION : Test if a real number is null
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a == 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bIsNull MTH_M_bEqualZero
|
||||
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 2D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMulAddMul
|
||||
DESCRIPTION : Return the addition of two multiplications
|
||||
INPUT : a, b, c, d : MTH_tdxReal
|
||||
OUTPUT : a*b + c*d : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMulAddMul(a, b, c, d) \
|
||||
((a)*(b) + (c)*(d))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqrAddSqr
|
||||
DESCRIPTION : Return the addition of two squares
|
||||
INPUT : a, b : MTH_tdxReal
|
||||
OUTPUT : a*a + b*b : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSqrAddSqr(a, b) \
|
||||
((a)*(a) + (b)*(b))
|
||||
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 3D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMulSubMul
|
||||
DESCRIPTION : Return the subtraction of two multiplications
|
||||
INPUT : a, b, c, d : MTH_tdxReal
|
||||
OUTPUT : a*b - c*d : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMulSubMul(a, b, c, d) \
|
||||
((a)*(b) - (c)*(d))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMulAddMulAddMul
|
||||
DESCRIPTION : Return the adition of three multiplications
|
||||
INPUT : a, b, c, d, e, f : MTH_tdxReal
|
||||
OUTPUT : a*b + c*d + e*f : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMulAddMulAddMul(a, b, c, d, e, f) \
|
||||
((a)*(b) + (c)*(d) + (e)*(f))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSqrAddSqrAddSqr
|
||||
DESCRIPTION : Return the adition of three squares
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : a*a + b*b + c*c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xSqrAddSqrAddSqr(a, b, c) \
|
||||
(MTH_M_xSqr(a) + MTH_M_xSqr(b) + MTH_M_xSqr(c))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMul3
|
||||
DESCRIPTION : Return the multiplication of three real numbers
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : a*b*c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMul3(a, b, c) \
|
||||
((a)*(b)*(c))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xMul4
|
||||
DESCRIPTION : Return the multiplication of 4 real numbers
|
||||
INPUT : a, b, c, d : MTH_tdxReal
|
||||
OUTPUT : a*b*c*d : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xMul4(a, b, c, d) \
|
||||
((a)*(b)*(c)*(d))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xAdd3
|
||||
DESCRIPTION : Return the addition of three real numbers
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : a+b+c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xAdd3(a, b, c) \
|
||||
((a)+(b)+(c))
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Test Real near Zero
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bEqualZero
|
||||
DESCRIPTION : Test if a real is equal to zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a == 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#if defined(OPTIMIZED_FOR_PC_FLOATS_WITH_ASM)
|
||||
#define MTH_M_bEqualZero(a) (MTH_M_bEqualZeroAsm(a))
|
||||
|
||||
#elif !defined(U64)
|
||||
|
||||
INLINE
|
||||
unsigned char MTH_M_bEqualZeroOpt( MTH_tdxReal xA )
|
||||
{
|
||||
/* yann le tensorer, sept 23, 1998*/
|
||||
/*we test if the float is zero by direcly testing the memory as a long (much faster)*/
|
||||
register long* pA=(long*)&xA;
|
||||
/* we have to clear the sign bit, because negative zero exists.. and is also zero !*/
|
||||
return (((*pA)&0x7FFFFFFF)==0);
|
||||
}
|
||||
#define MTH_M_bEqualZero(a) (MTH_M_bEqualZeroOpt(a))
|
||||
|
||||
#else
|
||||
/* sorry, but much faster like this on N64 (35% faster) - Oliv' - 26/02/1999 */
|
||||
#define MTH_M_bEqualZero( x ) \
|
||||
MTH_M_bEqual((x), MTH_C_ZERO )
|
||||
|
||||
#endif
|
||||
/*
|
||||
#define MTH_M_bEqualZero( x ) \
|
||||
MTH_M_bEqual((x), MTH_C_ZERO )*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bDifferentZero
|
||||
DESCRIPTION : Test if a real is different to zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a != 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#if defined(OPTIMIZED_FOR_PC_FLOATS_WITH_ASM)
|
||||
#define MTH_M_bDifferentZero(a) (MTH_M_bDifferentZeroAsm(a))
|
||||
|
||||
#elif !defined(U64)
|
||||
|
||||
INLINE
|
||||
long MTH_M_bDifferentZeroOpt( MTH_tdxReal xA )
|
||||
{
|
||||
/* yann le tensorer, sept 23, 1998*/
|
||||
/*we test if the float is zero by direcly testing the memory as a long (much faster)*/
|
||||
register long* pA=(long*)&xA;
|
||||
/* we have to clear the sign bit, because negative zero exists.. and is also zero !*/
|
||||
return ((*pA)&0x7FFFFFFF);
|
||||
}
|
||||
#define MTH_M_bDifferentZero(a) (MTH_M_bDifferentZeroOpt(a))
|
||||
|
||||
#else
|
||||
/* sorry, but much faster like this on N64 (35% faster) - Oliv' - 26/02/1999 */
|
||||
#define MTH_M_bDifferentZero( x ) \
|
||||
MTH_M_bDifferent((x), MTH_C_ZERO )
|
||||
|
||||
#endif
|
||||
|
||||
/*#define MTH_M_bDifferentZero( x ) \
|
||||
MTH_M_bDifferent((x), MTH_C_ZERO )*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreaterZero
|
||||
DESCRIPTION : Test if a real is greater than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a > 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#if defined(OPTIMIZED_FOR_PC_FLOATS_WITH_ASM)
|
||||
#define MTH_M_bGreaterZero(x) (MTH_M_bGreaterZeroAsm(x))
|
||||
#else
|
||||
|
||||
#define MTH_M_bGreaterZero(x) \
|
||||
MTH_M_bGreater((x), MTH_C_ZERO)
|
||||
#endif
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLessZero
|
||||
DESCRIPTION : Test if a real is less than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a < 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#if defined(OPTIMIZED_FOR_PC_FLOATS_WITH_ASM)
|
||||
#define MTH_M_bLessZero(x) (MTH_M_bLessZeroAsm(x))
|
||||
#else
|
||||
|
||||
#define MTH_M_bLessZero(x) \
|
||||
MTH_M_bLess((x), MTH_C_ZERO)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bGreaterEqualZero
|
||||
DESCRIPTION : Test if a real is greater or equal than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a >= 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#if defined(OPTIMIZED_FOR_PC_FLOATS_WITH_ASM)
|
||||
#define MTH_M_bGreaterEqualZero(x) (MTH_M_bGreaterEqualZeroAsm(x))
|
||||
#else
|
||||
|
||||
#define MTH_M_bGreaterEqualZero(x) \
|
||||
MTH_M_bGreaterEqual((x), MTH_C_ZERO)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bLessEqualZero
|
||||
DESCRIPTION : Test if a real is less or equal than zero
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : a <= 0.0 : Boolean
|
||||
=======================================================================================*/
|
||||
#if defined(OPTIMIZED_FOR_PC_FLOATS_WITH_ASM)
|
||||
#define MTH_M_bLessEqualZero(x) (MTH_M_bLessEqualZeroAsm(x))
|
||||
#else
|
||||
|
||||
#define MTH_M_bLessEqualZero(x) \
|
||||
MTH_M_bLessEqual((x), MTH_C_ZERO)
|
||||
#endif
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInRangeEqual
|
||||
DESCRIPTION : Test if a real is in range or equal of two other reals
|
||||
INPUT : x, a, b : MTH_tdxReal
|
||||
OUTPUT : x E [a,b] : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInRangeEqual( x, a, b) \
|
||||
( MTH_M_bGreaterEqual((x),(a)) && MTH_M_bLessEqual((x),(b)) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInRange
|
||||
DESCRIPTION : Test if a real is in range of two other reals
|
||||
INPUT : x, a, b : MTH_tdxReal
|
||||
OUTPUT : x E ]a,b[ : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInRange( x, a, b) \
|
||||
( MTH_M_bGreater((x),(a)) && MTH_M_bLess((x),(b)) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInUnitEqual
|
||||
DESCRIPTION : Test if a real is in range of [0,1]
|
||||
INPUT : x, : MTH_tdxReal
|
||||
OUTPUT : x E [0,1] : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInUnitEqual( x ) \
|
||||
( MTH_M_bGreaterEqual((x),MTH_C_ZERO) && MTH_M_bLessEqual((x),MTH_C_ONE))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bInUnit
|
||||
DESCRIPTION : Test if a real is in range of ]0,1[
|
||||
INPUT : x, : MTH_tdxReal
|
||||
OUTPUT : x E ]0,1[ : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bInUnit( x ) \
|
||||
( MTH_M_bGreater((x),MTH_C_ZERO) && MTH_M_bLess((x),MTH_C_ONE) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bEqualWithEpsilon
|
||||
DESCRIPTION : Test if a real is near a other real
|
||||
INPUT : a, b, eps : MTH_tdxReal
|
||||
OUTPUT : |a-b|<eps : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bEqualWithEpsilon( A, B, EPS) \
|
||||
(MTH_M_bLess( MTH_M_xAbs((A)-(B)), (EPS) ))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bDifferentWithEpsilon
|
||||
DESCRIPTION : Test if a real is near different a other real
|
||||
INPUT : a, b, eps : MTH_tdxReal
|
||||
OUTPUT : |a-b|>eps : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bDifferentWithEpsilon( A, B, EPS ) \
|
||||
(MTH_M_bGreater( MTH_M_xAbs((A)-(B)), (EPS) ))
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_bIsNullWithEpsilon
|
||||
DESCRIPTION : Test if a real is near zero
|
||||
INPUT : a, eps : MTH_tdxReal
|
||||
OUTPUT : |a|<eps : Boolean
|
||||
=======================================================================================*/
|
||||
#define MTH_M_bIsNullWithEpsilon(A, EPS) \
|
||||
(MTH_M_bLess( MTH_M_xAbs(A), (EPS) ))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Polynomial operations
|
||||
############################## */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xLinearInterpol
|
||||
DESCRIPTION : Return linear interpolation
|
||||
INPUT : a, b, t : MTH_tdxReal
|
||||
OUTPUT : a + t*(b-a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xLinearInterpol(a, b, t) \
|
||||
MTH_M_xAdd( (a), MTH_M_xMul((t), MTH_M_xSub( (b), (a) ) ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xTrinomeDelta
|
||||
DESCRIPTION : Return the delta of a trinome
|
||||
INPUT : a, b, c : MTH_tdxReal
|
||||
OUTPUT : b*b - 4*a*c : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xTrinomeDelta( a, b, c) \
|
||||
( MTH_M_xSub ( MTH_M_xSqr ( (b) ), \
|
||||
MTH_M_xMul ( MTH_C_4, MTH_M_xMul ( (a), (c) ) ) ) \
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
/* ##-################################
|
||||
## Trigonometric Mathematics MACRO
|
||||
################################### */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xSin
|
||||
DESCRIPTION : Return the sinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : sin(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xSin( X ) \
|
||||
sinf( X )
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#define MTH_M_xSin( X ) \
|
||||
(float) sin((double) (X) )
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xCos
|
||||
DESCRIPTION : Return the cosinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : cos(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xCos( X ) \
|
||||
cosf( X )
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#define MTH_M_xCos( X ) \
|
||||
(float) cos((double) (X) )
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xTan
|
||||
DESCRIPTION : Return the tangent of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : tan(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xTan( X ) \
|
||||
( (sinf(X)) / (cosf(X)) )
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#define MTH_M_xTan( X ) \
|
||||
(float) tan((double) (X) )
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xATan
|
||||
DESCRIPTION : Return the Arc-tangent of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : Atan(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xATan( X ) \
|
||||
atan( (X) )
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#define MTH_M_xATan( X ) \
|
||||
(float)atan(X)
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xACos
|
||||
DESCRIPTION : Return the Arc-cosinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : Acos(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xACos( X ) \
|
||||
acos( (X) )
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#define MTH_M_xACos( X ) \
|
||||
(float) acos((double) (X) )
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xASin
|
||||
DESCRIPTION : Return the Arc-sinus of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : Asin(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xASin( X ) \
|
||||
asin( (X) )
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#define MTH_M_xASin( X ) \
|
||||
(float) asin((double) (X) )
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xCoTan
|
||||
DESCRIPTION : Return the Co-tangent of a real number
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : CoTan(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#ifdef MTH_U64_DEV
|
||||
#define MTH_M_xCoTan( X ) \
|
||||
(float)( MTH_C_ONE / MTH_M_xTan( (X) ))
|
||||
#else /* NOT MTH_U64_DEV */
|
||||
#define MTH_M_xCoTan( X ) \
|
||||
(float) (MTH_C_ONE / tan((double) (X) ))
|
||||
#endif /* MTH_U64_DEV OR NOT */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xDegToRad
|
||||
DESCRIPTION : Return the conversion from degree to radian
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : rad(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xDegToRad( X ) \
|
||||
(float) ( ( X ) *( MTH_C_PiBy180 ) )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_xDegToRad
|
||||
DESCRIPTION : Return the conversion from radian to degree
|
||||
INPUT : a : MTH_tdxReal
|
||||
OUTPUT : deg(a) : MTH_tdxReal
|
||||
=======================================================================================*/
|
||||
#define MTH_M_xRadToDeg( X ) \
|
||||
(float) ( ( X ) *( MTH_C_180ByPi ) )
|
||||
|
||||
|
||||
|
||||
#endif /* MTH_FLT_H */
|
||||
|
||||
|
||||
|
105
Rayman_X/cpa/public/MTH/MTH_fnop.h
Normal file
105
Rayman_X/cpa/public/MTH/MTH_fnop.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_fnop.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Non Optimization for PC and float
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH_FNOP_H
|
||||
#define MTH_FNOP_H
|
||||
|
||||
#include "acp_base.h"
|
||||
|
||||
#define MTH_CALL
|
||||
|
||||
/* ****************** */
|
||||
/* *** MTH_M_xSqrt ** */
|
||||
/* ****************** */
|
||||
#define MTH_M_xSqrtLow MTH_M_xSqrt
|
||||
#define MTH_M_xSqrtMedium MTH_M_xSqrt
|
||||
#define MTH_M_xSqrtHigh MTH_M_xSqrt
|
||||
|
||||
/* ********************* */
|
||||
/* *** MTH_M_xInvSqrt ** */
|
||||
/* ********************* */
|
||||
#define MTH_M_xInvSqrtLow MTH_M_xInvSqrt
|
||||
#define MTH_M_xInvSqrtMedium MTH_M_xInvSqrt
|
||||
#define MTH_M_xInvSqrtHigh MTH_M_xInvSqrt
|
||||
|
||||
/* ***************** */
|
||||
/* *** MTH_M_xInv ** */
|
||||
/* ***************** */
|
||||
#define MTH_M_xInvLow MTH_M_xInv
|
||||
#define MTH_M_xInvMedium MTH_M_xInv
|
||||
#define MTH_M_xInvHigh MTH_M_xInv
|
||||
|
||||
/* ***************** */
|
||||
/* *** MTH_M_xDiv ** */
|
||||
/* ***************** */
|
||||
#define MTH_M_xDivLow MTH_M_xDiv
|
||||
#define MTH_M_xDivMedium MTH_M_xDiv
|
||||
#define MTH_M_xDivHigh MTH_M_xDiv
|
||||
|
||||
/* ***************************** */
|
||||
/* *** MTH_M_xRealToLongRound ** */
|
||||
/* ***************************** */
|
||||
#define MTH_M_xRealToLongRoundLow MTH_M_xRealToLongRound
|
||||
#define MTH_M_xRealToLongRoundMedium MTH_M_xRealToLongRound
|
||||
#define MTH_M_xRealToLongRoundHigh MTH_M_xRealToLongRound
|
||||
|
||||
/* ************************ */
|
||||
/* *** MTH_M_xRealToLong ** */
|
||||
/* ************************ */
|
||||
#define MTH_M_xRealToLongLow MTH_M_xRealToLong
|
||||
#define MTH_M_xRealToLongMedium MTH_M_xRealToLong
|
||||
#define MTH_M_xRealToLongHigh MTH_M_xRealToLong
|
||||
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : MTH_M_vInit
|
||||
DESCRIPTION : Initialization
|
||||
INPUT : void
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define MTH_M_vInit() \
|
||||
{}
|
||||
|
||||
/* ##F===================================================================================
|
||||
NAME : MTH_fn_vSet24bitFPU
|
||||
DESCRIPTION : Set Pentium FPU internal precision to 24bit
|
||||
INPUT : void
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
INLINE void MTH_CALL MTH_fn_vSet24bitFPU(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* ##F===================================================================================
|
||||
NAME : MTH_fn_vSet53bitFPU
|
||||
DESCRIPTION : Set Pentium FPU internal precision to 53bit
|
||||
INPUT : void
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
INLINE void MTH_CALL MTH_fn_vSet53bitFPU(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* ##F===================================================================================
|
||||
NAME : MTH_fn_vSet64bitFPU
|
||||
DESCRIPTION : Set Pentium FPU internal precision to 64bit
|
||||
INPUT : void
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
INLINE void MTH_CALL MTH_fn_vSet64bitFPU(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* MTH_FNOP_H */
|
1167
Rayman_X/cpa/public/MTH/MTH_fopt.h
Normal file
1167
Rayman_X/cpa/public/MTH/MTH_fopt.h
Normal file
File diff suppressed because it is too large
Load Diff
36
Rayman_X/cpa/public/MTH/MTH_fx16.h
Normal file
36
Rayman_X/cpa/public/MTH/MTH_fx16.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_fx16.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Real implementation for fixed 16:16
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH_FX16_H
|
||||
#define MTH_FX16_H
|
||||
|
||||
|
||||
/* ##INCLUDE#----------------------------------------------------------------------------
|
||||
Includes Files
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* ##CONSTANTE#--------------------------------------------------------------------------
|
||||
Real Constantes declaration
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-################################################
|
||||
## MATHEMATICS MACRO AND FUNCTION FOR 16:16 REAL
|
||||
################################################### */
|
||||
|
||||
|
||||
|
||||
#endif /* MTH_FX16_H */
|
38
Rayman_X/cpa/public/MTH/MTH_trig.h
Normal file
38
Rayman_X/cpa/public/MTH/MTH_trig.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : MTH_trig.h
|
||||
MODULE : MTH (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : Additional Trigonometric table for U64 and float
|
||||
|
||||
VERSION : MTH V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef MTH_TRIG_H
|
||||
#define MTH_TRIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* ##FUNCDEF#----------------------------------------------------------------------------
|
||||
Functions definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
extern void MTH_fn_vInitTableASin( void );
|
||||
|
||||
extern MTH_tdxReal MTH_fn_xComputeASin( MTH_tdxReal x);
|
||||
|
||||
extern MTH_tdxReal MTH_fn_xComputeACos( MTH_tdxReal x);
|
||||
|
||||
extern void MTH_fn_vInitTableATan( void );
|
||||
|
||||
extern MTH_tdxReal MTH_fn_xComputeATan( MTH_tdxReal x);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* MTH_TRIG_H */
|
428
Rayman_X/cpa/public/MTH/Specif/Mat/Msl12_3D.h
Normal file
428
Rayman_X/cpa/public/MTH/Specif/Mat/Msl12_3D.h
Normal file
@@ -0,0 +1,428 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Msl12_3D.h
|
||||
MODULE : sl12 (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Matrix implementation
|
||||
|
||||
VERSION : sl12 V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef __MATRICES_SL12_3D__
|
||||
#define __MATRICES_SL12_3D__
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 23.04.98 19:26 (44803)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#define sl12_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vCopyMatrix( MatDest, MatA) MTH3D_M_vCopyMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vAddMatrix( MatDest, MatA, MatB) MTH3D_M_vAddMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSubMatrix( MatDest, MatA, MatB) MTH3D_M_vSubMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vNegMatrix( MatDest, MatA) MTH3D_M_vNegMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulTranspMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulTranspMatrixMatrix
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
INPUT : MatDest, MatA, MatB: address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
a: SCA_td_sl12, MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sl12_3D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
MTH3D_M_vMulScalarMatrix(MatDest, a, MatA)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
MatA : address of sl12_3D_tdstMatrix, a: SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sl12_3D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
MTH3D_M_vDivScalarMatrix(MatDest, MatA, a)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSqrMatrix(MatDest, MatA) MTH3D_M_vSqrMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA)
|
||||
|
||||
|
||||
/* sl12_3D_M_vTranpMatrixWithoutBuffer(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sl12_3D_M_vTranpMatrixWithoutBuffer sl12_3D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vTranspMatrix(Mat_Dest, Mat_A) MTH3D_M_vTranspMatrix(Mat_Dest, Mat_A)
|
||||
|
||||
/* sl12_3D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sl12_3D_M_vTranpMatrix sl12_3D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : trace MatA : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xTraceMatrix(MatA) MTH3D_M_xTraceMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetIdentityMatrix(MatDest) MTH3D_M_vSetIdentityMatrix(MatDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_bEqualMatrix(MatA, MatB) MTH3D_M_bEqualMatrix(MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of sl12_3D_tdstMatrix
|
||||
eps : SCA_td_sl12
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sl12_3D_M_bMatchMatrix(MatA, MatB, eps) MTH3D_M_bMatchMatrix(MatA, MatB, eps)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
a : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vFillMatrix(MatDest, a) MTH3D_M_vFillMatrix(MatDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : det MatA : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xDetMatrix(MatA) MTH3D_M_xDetMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vComMatrixWithoutBuffer
|
||||
DESCRIPTION : Calculate the Cofactor Matrix of a matrix : MatDest= Cofactor Matrix of MatA
|
||||
INPUT : Matdest, MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vInverMatrix(MatDest, MatA) MTH3D_M_vInverMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y, z column col values in MatA
|
||||
INPUT : x, y, z : SCA_td_sl12
|
||||
col : int
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA) \
|
||||
MTH3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y, z values in MatDest
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
x, y, z : SCA_td_sl12
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col) \
|
||||
MTH3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xGetMatrixElement( lin, col, MatA) MTH3D_M_xGetMatrixElement( lin, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
a : SCA_td_sl12
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixElement( MatDest, a, lin, col) MTH3D_M_vSetMatrixElement( MatDest, a, lin, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixCol0Elements
|
||||
DESCRIPTION : Set x, y, z values of column 0 in MatDest
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixCol1Elements
|
||||
DESCRIPTION : Set x, y, z values of column 1 in MatDest
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixCol2Elements
|
||||
DESCRIPTION : Set x, y, z values of column 2 in MatDest
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixLineXElements
|
||||
DESCRIPTION : Set x elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixLineYElements
|
||||
DESCRIPTION : Set y elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetMatrixLineZElements
|
||||
DESCRIPTION : Set z elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetMatrixCol0Elements
|
||||
DESCRIPTION : Get x, y, z values of column 0 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl12
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetMatrixCol1Elements
|
||||
DESCRIPTION : Get x, y, z values of column 1 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl12
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetMatrixCol2Elements
|
||||
DESCRIPTION : Get x, y, z values of column 2 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl12
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetMatrixLineXElements
|
||||
DESCRIPTION : Get x elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl12
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetMatrixLineYElements
|
||||
DESCRIPTION : Get y elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl12
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetMatrixLineZElements
|
||||
DESCRIPTION : Get z elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl12
|
||||
INPUT : MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf2_sl12(td_sl12 _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vPrintfMatrix
|
||||
DESCRIPTION : Print a Matrix : Name + its values
|
||||
INPUT : Name : string
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
|
||||
__inline void sl12_3D_fn_vPrintfMatrix( char * Name, sl12_3D_tdstMatrix * MatA) \
|
||||
{
|
||||
MTH3D_M_vPrintfMatrix( Name, MatA );
|
||||
}
|
||||
|
||||
#define sl12_3D_M_vPrintfMatrix( Name, MatA) sl12_3D_fn_vPrintfMatrix( Name, MatA)
|
||||
|
||||
#endif /* __MATRICES_SL12_3D__ */
|
427
Rayman_X/cpa/public/MTH/Specif/Mat/Msl_3D.h
Normal file
427
Rayman_X/cpa/public/MTH/Specif/Mat/Msl_3D.h
Normal file
@@ -0,0 +1,427 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Msl_3D.h
|
||||
MODULE : sl (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Matrix implementation
|
||||
|
||||
VERSION : sl V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef __MATRICES_SL_3D__
|
||||
#define __MATRICES_SL_3D__
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 23.04.98 19:26 (43819)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#define sl_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vCopyMatrix( MatDest, MatA) MTH3D_M_vCopyMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vAddMatrix( MatDest, MatA, MatB) MTH3D_M_vAddMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSubMatrix( MatDest, MatA, MatB) MTH3D_M_vSubMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vNegMatrix( MatDest, MatA) MTH3D_M_vNegMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulTranspMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulTranspMatrixMatrix
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
a: SCA_td_sl, MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sl_3D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
MTH3D_M_vMulScalarMatrix(MatDest, a, MatA)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix, a: SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sl_3D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
MTH3D_M_vDivScalarMatrix(MatDest, MatA, a)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSqrMatrix(MatDest, MatA) MTH3D_M_vSqrMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA)
|
||||
|
||||
|
||||
/* sl_3D_M_vTranpMatrixWithoutBuffer(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sl_3D_M_vTranpMatrixWithoutBuffer sl_3D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vTranspMatrix(Mat_Dest, Mat_A) MTH3D_M_vTranspMatrix(Mat_Dest, Mat_A)
|
||||
|
||||
/* sl_3D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sl_3D_M_vTranpMatrix sl_3D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : trace MatA : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xTraceMatrix(MatA) MTH3D_M_xTraceMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetIdentityMatrix(MatDest) MTH3D_M_vSetIdentityMatrix(MatDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of sl_3D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_bEqualMatrix(MatA, MatB) MTH3D_M_bEqualMatrix(MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of sl_3D_tdstMatrix
|
||||
eps : SCA_td_sl
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sl_3D_M_bMatchMatrix(MatA, MatB, eps) MTH3D_M_bMatchMatrix(MatA, MatB, eps)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
a : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vFillMatrix(MatDest, a) MTH3D_M_vFillMatrix(MatDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : det MatA : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xDetMatrix(MatA) MTH3D_M_xDetMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vComMatrixWithoutBuffer
|
||||
DESCRIPTION : Calculate the Cofactor Matrix of a matrix : MatDest= Cofactor Matrix of MatA
|
||||
INPUT : Matdest, MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vInverMatrix(MatDest, MatA) MTH3D_M_vInverMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y, z column col values in MatA
|
||||
INPUT : x, y, z : SCA_td_sl
|
||||
col : int
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA) \
|
||||
MTH3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y, z values in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
x, y, z : SCA_td_sl
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col) \
|
||||
MTH3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xGetMatrixElement( lin, col, MatA) MTH3D_M_xGetMatrixElement( lin, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
a : SCA_td_sl
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixElement( MatDest, a, lin, col) MTH3D_M_vSetMatrixElement( MatDest, a, lin, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixCol0Elements
|
||||
DESCRIPTION : Set x, y, z values of column 0 in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixCol1Elements
|
||||
DESCRIPTION : Set x, y, z values of column 1 in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixCol2Elements
|
||||
DESCRIPTION : Set x, y, z values of column 2 in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixLineXElements
|
||||
DESCRIPTION : Set x elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixLineYElements
|
||||
DESCRIPTION : Set y elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixLineZElements
|
||||
DESCRIPTION : Set z elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixCol0Elements
|
||||
DESCRIPTION : Get x, y, z values of column 0 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixCol1Elements
|
||||
DESCRIPTION : Get x, y, z values of column 1 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixCol2Elements
|
||||
DESCRIPTION : Get x, y, z values of column 2 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixLineXElements
|
||||
DESCRIPTION : Get x elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixLineYElements
|
||||
DESCRIPTION : Get y elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixLineZElements
|
||||
DESCRIPTION : Get z elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf2_sl(td_sl _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vPrintfMatrix
|
||||
DESCRIPTION : Print a Matrix : Name + its values
|
||||
INPUT : Name : string
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
|
||||
__inline sl_3D_fn_vPrintfMatrix( char * Name, sl_3D_tdstMatrix * MatA) \
|
||||
{
|
||||
MTH3D_M_vPrintfMatrix( Name, MatA );
|
||||
}
|
||||
|
||||
#define sl_3D_M_vPrintfMatrix( Name, MatA) sl_3D_fn_vPrintfMatrix( Name, MatA)
|
||||
|
||||
#endif /* __MATRICES_SL_3D__ */
|
427
Rayman_X/cpa/public/MTH/Specif/Mat/Msw12_3D.h
Normal file
427
Rayman_X/cpa/public/MTH/Specif/Mat/Msw12_3D.h
Normal file
@@ -0,0 +1,427 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Msw12_3D.h
|
||||
MODULE : sw12 (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Matrix implementation
|
||||
|
||||
VERSION : sw12 V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef __MATRICES_SW12_3D__
|
||||
#define __MATRICES_SW12_3D__
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 24.04.98 16:46 (44694)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#define sw12_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vCopyMatrix( MatDest, MatA) MTH3D_M_vCopyMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vAddMatrix( MatDest, MatA, MatB) MTH3D_M_vAddMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSubMatrix( MatDest, MatA, MatB) MTH3D_M_vSubMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vNegMatrix( MatDest, MatA) MTH3D_M_vNegMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulTranspMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulTranspMatrixMatrix
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
a: SCA_td_sw12, MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sw12_3D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
MTH3D_M_vMulScalarMatrix(MatDest, a, MatA)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix, a: SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sw12_3D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
MTH3D_M_vDivScalarMatrix(MatDest, MatA, a)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSqrMatrix(MatDest, MatA) MTH3D_M_vSqrMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA)
|
||||
|
||||
|
||||
/* sw12_3D_M_vTranpMatrixWithoutBuffer(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw12_3D_M_vTranpMatrixWithoutBuffer sw12_3D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vTranspMatrix(Mat_Dest, Mat_A) MTH3D_M_vTranspMatrix(Mat_Dest, Mat_A)
|
||||
|
||||
/* sw12_3D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw12_3D_M_vTranpMatrix sw12_3D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : trace MatA : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xTraceMatrix(MatA) MTH3D_M_xTraceMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetIdentityMatrix(MatDest) MTH3D_M_vSetIdentityMatrix(MatDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_bEqualMatrix(MatA, MatB) MTH3D_M_bEqualMatrix(MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of sw12_3D_tdstMatrix
|
||||
eps : SCA_td_sw12
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sw12_3D_M_bMatchMatrix(MatA, MatB, eps) MTH3D_M_bMatchMatrix(MatA, MatB, eps)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
a : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vFillMatrix(MatDest, a) MTH3D_M_vFillMatrix(MatDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : det MatA : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xDetMatrix(MatA) MTH3D_M_xDetMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vComMatrixWithoutBuffer
|
||||
DESCRIPTION : Calculate the Cofactor Matrix of a matrix : MatDest= Cofactor Matrix of MatA
|
||||
INPUT : Matdest, MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vInverMatrix(MatDest, MatA) MTH3D_M_vInverMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y, z column col values in MatA
|
||||
INPUT : x, y, z : SCA_td_sw12
|
||||
col : int
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA) \
|
||||
MTH3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y, z values in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
x, y, z : SCA_td_sw12
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col) \
|
||||
MTH3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xGetMatrixElement( lin, col, MatA) MTH3D_M_xGetMatrixElement( lin, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
a : SCA_td_sw12
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixElement( MatDest, a, lin, col) MTH3D_M_vSetMatrixElement( MatDest, a, lin, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixCol0Elements
|
||||
DESCRIPTION : Set x, y, z values of column 0 in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixCol1Elements
|
||||
DESCRIPTION : Set x, y, z values of column 1 in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixCol2Elements
|
||||
DESCRIPTION : Set x, y, z values of column 2 in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixLineXElements
|
||||
DESCRIPTION : Set x elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixLineYElements
|
||||
DESCRIPTION : Set y elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixLineZElements
|
||||
DESCRIPTION : Set z elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixCol0Elements
|
||||
DESCRIPTION : Get x, y, z values of column 0 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixCol1Elements
|
||||
DESCRIPTION : Get x, y, z values of column 1 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixCol2Elements
|
||||
DESCRIPTION : Get x, y, z values of column 2 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixLineXElements
|
||||
DESCRIPTION : Get x elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixLineYElements
|
||||
DESCRIPTION : Get y elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixLineZElements
|
||||
DESCRIPTION : Get z elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf2_sw12(td_sw12 _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vPrintfMatrix
|
||||
DESCRIPTION : Print a Matrix : Name + its values
|
||||
INPUT : Name : string
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
|
||||
__inline void sw12_3D_fn_vPrintfMatrix( char * Name, sw12_3D_tdstMatrix * MatA) \
|
||||
{
|
||||
MTH3D_M_vPrintfMatrix( Name, MatA );
|
||||
}
|
||||
|
||||
#define sw12_3D_M_vPrintfMatrix( Name, MatA) sw12_3D_fn_vPrintfMatrix( Name, MatA)
|
||||
|
||||
#endif /* __MATRICES_SW12_3D__ */
|
427
Rayman_X/cpa/public/MTH/Specif/Mat/Msw_3D.h
Normal file
427
Rayman_X/cpa/public/MTH/Specif/Mat/Msw_3D.h
Normal file
@@ -0,0 +1,427 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Msw_3D.h
|
||||
MODULE : sw (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Matrix implementation
|
||||
|
||||
VERSION : sw V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef __MATRICES_SW_3D__
|
||||
#define __MATRICES_SW_3D__
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 23.04.98 19:26 (44640)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#define sw_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vCopyMatrix( MatDest, MatA) MTH3D_M_vCopyMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vAddMatrix( MatDest, MatA, MatB) MTH3D_M_vAddMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSubMatrix( MatDest, MatA, MatB) MTH3D_M_vSubMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vNegMatrix( MatDest, MatA) MTH3D_M_vNegMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulTranspMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulTranspMatrixMatrix
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
a: SCA_td_sw, MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sw_3D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
MTH3D_M_vMulScalarMatrix(MatDest, a, MatA)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix, a: SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sw_3D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
MTH3D_M_vDivScalarMatrix(MatDest, MatA, a)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSqrMatrix(MatDest, MatA) MTH3D_M_vSqrMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA)
|
||||
|
||||
|
||||
/* sw_3D_M_vTranpMatrixWithoutBuffer(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw_3D_M_vTranpMatrixWithoutBuffer sw_3D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vTranspMatrix(Mat_Dest, Mat_A) MTH3D_M_vTranspMatrix(Mat_Dest, Mat_A)
|
||||
|
||||
/* sw_3D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw_3D_M_vTranpMatrix sw_3D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : trace MatA : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xTraceMatrix(MatA) MTH3D_M_xTraceMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetIdentityMatrix(MatDest) MTH3D_M_vSetIdentityMatrix(MatDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of sw_3D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_bEqualMatrix(MatA, MatB) MTH3D_M_bEqualMatrix(MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of sw_3D_tdstMatrix
|
||||
eps : SCA_td_sw
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
/*
|
||||
#define sw_3D_M_bMatchMatrix(MatA, MatB, eps) MTH3D_M_bMatchMatrix(MatA, MatB, eps)
|
||||
*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
a : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vFillMatrix(MatDest, a) MTH3D_M_vFillMatrix(MatDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : det MatA : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xDetMatrix(MatA) MTH3D_M_xDetMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vComMatrixWithoutBuffer
|
||||
DESCRIPTION : Calculate the Cofactor Matrix of a matrix : MatDest= Cofactor Matrix of MatA
|
||||
INPUT : Matdest, MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vInverMatrix(MatDest, MatA) MTH3D_M_vInverMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y, z column col values in MatA
|
||||
INPUT : x, y, z : SCA_td_sw
|
||||
col : int
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA) \
|
||||
MTH3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y, z values in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
x, y, z : SCA_td_sw
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col) \
|
||||
MTH3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xGetMatrixElement( lin, col, MatA) MTH3D_M_xGetMatrixElement( lin, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
a : SCA_td_sw
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixElement( MatDest, a, lin, col) MTH3D_M_vSetMatrixElement( MatDest, a, lin, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixCol0Elements
|
||||
DESCRIPTION : Set x, y, z values of column 0 in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixCol1Elements
|
||||
DESCRIPTION : Set x, y, z values of column 1 in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixCol2Elements
|
||||
DESCRIPTION : Set x, y, z values of column 2 in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixLineXElements
|
||||
DESCRIPTION : Set x elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixLineYElements
|
||||
DESCRIPTION : Set y elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixLineZElements
|
||||
DESCRIPTION : Set z elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixCol0Elements
|
||||
DESCRIPTION : Get x, y, z values of column 0 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixCol1Elements
|
||||
DESCRIPTION : Get x, y, z values of column 1 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixCol2Elements
|
||||
DESCRIPTION : Get x, y, z values of column 2 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixLineXElements
|
||||
DESCRIPTION : Get x elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixLineYElements
|
||||
DESCRIPTION : Get y elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixLineZElements
|
||||
DESCRIPTION : Get z elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : Pf2_sw
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf2_sw(td_sw _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vPrintfMatrix
|
||||
DESCRIPTION : Print a Matrix : Name + its values
|
||||
INPUT : Name : string
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
|
||||
__inline sw_3D_fn_vPrintfMatrix( char * Name, sw_3D_tdstMatrix * MatA) \
|
||||
{
|
||||
MTH3D_M_vPrintfMatrix( Name, MatA );
|
||||
}
|
||||
|
||||
#define sw_3D_M_vPrintfMatrix( Name, MatA) sw_3D_fn_vPrintfMatrix( Name, MatA)
|
||||
|
||||
#endif /* __MATRICES_SW_3D__ */
|
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsl12_3D.h
Normal file
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsl12_3D.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Xsl12_3D.h
|
||||
MODULE : sl12 (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vector-Matrix implementation
|
||||
|
||||
VERSION : sl12 V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 23.04.98 19:26 (14197)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef __MATRICES_VECTOR_SL12_3D__
|
||||
#define __MATRICES_VECTOR_SL12_3D__
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVector( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
MTH3D_M_vGetColumnInMatrix( VectDest, MatA, col )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
VectA : address of sl12_3D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
MTH3D_M_vSetColumnInMatrix( MatDest, VectA, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
MTH3D_M_vGetLineInMatrix( VectDest, MatA, lin )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
VectA : address of sl12_3D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
MTH3D_M_vSetLineInMatrix( MatDest, VectA, lin)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
MTH3D_M_vGetDiagInMatrix( VectDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
MTH3D_M_vSetDiagInMatrix( MatDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest, VcDest: address of sl12_3D_tdstVector
|
||||
MatA : address of sl12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA) \
|
||||
MTH3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of sl12_3D_tdstMatrix
|
||||
VectA, VectB, VectC : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC) \
|
||||
MTH3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC)
|
||||
|
||||
|
||||
|
||||
#endif /* __MATRICES_VECTOR_SL12_3D__ */
|
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsl_3D.h
Normal file
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsl_3D.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Xsl_3D.h
|
||||
MODULE : sl (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vector-Matrix implementation
|
||||
|
||||
VERSION : sl V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 23.04.98 19:26 (14012)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef __MATRICES_VECTOR_SL_3D__
|
||||
#define __MATRICES_VECTOR_SL_3D__
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVector( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
MTH3D_M_vGetColumnInMatrix( VectDest, MatA, col )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
MTH3D_M_vSetColumnInMatrix( MatDest, VectA, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
MTH3D_M_vGetLineInMatrix( VectDest, MatA, lin )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
MTH3D_M_vSetLineInMatrix( MatDest, VectA, lin)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
MTH3D_M_vGetDiagInMatrix( VectDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
MTH3D_M_vSetDiagInMatrix( MatDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest, VcDest: address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA) \
|
||||
MTH3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA, VectB, VectC : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC) \
|
||||
MTH3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC)
|
||||
|
||||
|
||||
|
||||
#endif /* __MATRICES_VECTOR_SL_3D__ */
|
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsw12_3D.h
Normal file
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsw12_3D.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Xsw12_3D.h
|
||||
MODULE : sw12 (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vector-Matrix implementation
|
||||
|
||||
VERSION : sw12 V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 24.04.98 17:45 (13587)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef __MATRICES_VECTOR_SW12_3D__
|
||||
#define __MATRICES_VECTOR_SW12_3D__
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVector( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
MTH3D_M_vGetColumnInMatrix( VectDest, MatA, col )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
MTH3D_M_vSetColumnInMatrix( MatDest, VectA, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
MTH3D_M_vGetLineInMatrix( VectDest, MatA, lin )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
MTH3D_M_vSetLineInMatrix( MatDest, VectA, lin)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
MTH3D_M_vGetDiagInMatrix( VectDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
MTH3D_M_vSetDiagInMatrix( MatDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest, VcDest: address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA) \
|
||||
MTH3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA, VectB, VectC : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC) \
|
||||
MTH3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC)
|
||||
|
||||
|
||||
|
||||
#endif /* __MATRICES_VECTOR_SW12_3D__ */
|
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsw_3D.h
Normal file
139
Rayman_X/cpa/public/MTH/Specif/Mat/Xsw_3D.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : Xsw_3D.h
|
||||
MODULE : sw (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vector-Matrix implementation
|
||||
|
||||
VERSION : sw V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------27/04/98 16:23-------------------
|
||||
* Conversion : OK avec version 23.04.98 19:26 (13883)
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef __MATRICES_VECTOR_SW_3D__
|
||||
#define __MATRICES_VECTOR_SW_3D__
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVector( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
MTH3D_M_vGetColumnInMatrix( VectDest, MatA, col )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
MTH3D_M_vSetColumnInMatrix( MatDest, VectA, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
MTH3D_M_vGetLineInMatrix( VectDest, MatA, lin )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
MTH3D_M_vSetLineInMatrix( MatDest, VectA, lin)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
MTH3D_M_vGetDiagInMatrix( VectDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
MTH3D_M_vSetDiagInMatrix( MatDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest, VcDest: address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA) \
|
||||
MTH3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA, VectB, VectC : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC) \
|
||||
MTH3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC)
|
||||
|
||||
|
||||
|
||||
#endif /* __MATRICES_VECTOR_SW_3D__ */
|
234
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sl.h
Normal file
234
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sl.h
Normal file
@@ -0,0 +1,234 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : SCA_sl.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 15:58-------------------
|
||||
* Conversion : OK (avec SCA_sl.h du 23.04.98 19:26 (18017))
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef _SLREAL_H_
|
||||
#define _SLREAL_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/*-----------------*/
|
||||
/* Fixed coma case */
|
||||
/*-----------------*/
|
||||
/* 1.31.0 */
|
||||
|
||||
/*---------------------------------*/
|
||||
/* Specific Values for fixed point */
|
||||
/*---------------------------------*/
|
||||
#define SCA_td_sl MTH_tdxReal
|
||||
|
||||
/*#define SCA_sl_C_slComaDecal 0*/
|
||||
/*#define SCA_sl_C_slComaCoef 1*/
|
||||
|
||||
/*#define SCA_sl_C_dfMax 2147483648*/
|
||||
/*#define SCA_sl_C_dfMin (-SCA_sl_C_dfMax)*/
|
||||
|
||||
/*#define SCA_sl_C_slMax (0x7FFFFFE0)*/
|
||||
/*#define SCA_sl_C_slMin (0xEFFFFFE0)*/
|
||||
/*#define SCA_sl_C_slError (0x7FFFFFFF)*/
|
||||
|
||||
/*#define SCA_sl_C_slNegMask (0x80000000)*/
|
||||
/*#define SCA_sl_C_slPosMask (0x7FFFFFFF)*/
|
||||
/*#define SCA_sl_C_slDecMask (0x00000000)*/
|
||||
/*#define SCA_sl_C_slEntMask (0xFFFFFFFF)*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* ---------------- Constants ---------------------------*/
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sl_C_ZERO MTH_C_ZERO
|
||||
#define SCA_sl_C_ONE MTH_C_ONE
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Conversion functions */
|
||||
/*--------------------------------------------------------*/
|
||||
__inline SCA_td_sl SCA_sl_fn_slDouble2Real( double _dfValue )
|
||||
{
|
||||
return MTH_M_xDoubleToReal( _dfValue );
|
||||
}
|
||||
/*--------------------------------------------------------*/
|
||||
__inline double SCA_sl_fn_Real2Double( SCA_td_sl _xValue )
|
||||
{
|
||||
return MTH_M_xRealToDouble( _xValue );
|
||||
}
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Conversions : Macros definitions */
|
||||
/*--------------------------------------------*/
|
||||
#define SCA_sl_M_slDoubleToReal(_dfValue) MTH_M_xDoubleToReal(_dfValue)
|
||||
#define SCA_sl_M_slFloatToReal(_fValue) MTH_M_xFloatToReal(_fValue)
|
||||
#define SCA_sl_M_slIntToReal(_iValue) MTH_M_xLongToReal(_iValue) /*???*/
|
||||
|
||||
#define SCA_sl_M_RealToDouble(_xValue) MTH_M_xRealToDouble(_xValue)
|
||||
#define SCA_sl_M_RealToFloat(_xValue) MTH_M_xrealToFloat(_xValue)
|
||||
#define SCA_sl_M_RealToInt(_xValue) MTh_M_xRealToLong(_xValue) /*???*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Constantes */
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sl_C_slTwo MTH_C_2
|
||||
|
||||
/* ##CONSTANTE#--------------------------------------------------------------------------
|
||||
Real Constantes declaration
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#define SCA_sl_C_InfinitPlus MTH_C_InfinitPlus
|
||||
#define SCA_sl_InfinitMinus MTH_C_InfinitMinus
|
||||
#define SCA_sl_EpsilonPlus MTH_C_EpsilonPlus
|
||||
#define SCA_sl_EpsilonMinus MTH_C_EpsilonMinus
|
||||
|
||||
#define SCA_sl_Pi MTH_C_Pi
|
||||
#define SCA_sl_2Pi MTH_C_2Pi
|
||||
#define SCA_sl_PiBy2 MTH_C_PiBy2
|
||||
#define SCA_sl_PiBy4 MTH_C_PiBy4
|
||||
#define SCA_sl_PiBy8 MTH_C_PiBy8
|
||||
#define SCA_sl_PiBy180 MTH_C_PiBy180
|
||||
#define SCA_sl_180ByPi MTH_C_180ByPi
|
||||
#define SCA_sl_e MTH_C_e
|
||||
|
||||
#define SCA_sl_MinusONE MTH_C_MinusONE
|
||||
|
||||
#define SCA_sl_2 MTH_C_2
|
||||
#define SCA_sl_3 MTH_C_3
|
||||
#define SCA_sl_4 MTH_C_4
|
||||
#define SCA_sl_5 MTH_C_5
|
||||
#define SCA_sl_8 (double) 8.0
|
||||
|
||||
#define SCA_sl_Minus2 MTH_C_Minus2
|
||||
#define SCA_sl_Minus3 MTH_C_Minus3
|
||||
#define SCA_sl_Minus4 MTH_C_Minus4
|
||||
#define SCA_sl_Minus5 MTH_C_Minus5
|
||||
|
||||
#define SCA_sl_Inv2 MTH_C_Inv2
|
||||
#define SCA_sl_Inv3 MTH_C_Inv3
|
||||
#define SCA_sl_Inv4 MTH_C_Inv4
|
||||
#define SCA_sl_Inv5 MTH_C_Inv5
|
||||
|
||||
#define SCA_sl_MinusInv2 MTH_C_MinusInv2
|
||||
#define SCA_sl_MinusInv3 MTH_C_MinusInv3
|
||||
#define SCA_sl_MinusInv4 MTH_C_MinusInv4
|
||||
#define SCA_sl_MinusInv5 MTH_C_MinusInv5
|
||||
|
||||
#define SCA_sl_Sqrt2 MTH_C_Sqrt2
|
||||
#define SCA_sl_Sqrt3 MTH_C_Sqrt3
|
||||
#define SCA_sl_Sqrt4 MTH_C_Sqrt4
|
||||
#define SCA_sl_Sqrt5 MTH_C_Sqrt5
|
||||
|
||||
#define SCA_sl_MinusSqrt2 MTH_C_MinusSqrt2
|
||||
#define SCA_sl_MinusSqrt3 MTH_C_MinusSqrt3
|
||||
#define SCA_sl_MinusSqrt4 MTH_C_MinusSqrt4
|
||||
#define SCA_sl_MinusSqrt5 MTH_C_MinusSqrt5
|
||||
|
||||
#define SCA_sl_InvSqrt2 MTH_C_InvSqrt2
|
||||
#define SCA_sl_InvSqrt3 MTH_C_InvSqrt3
|
||||
#define SCA_sl_InvSqrt4 MTH_C_InvSqrt4
|
||||
#define SCA_sl_InvSqrt5 MTH_C_InvSqrt5
|
||||
|
||||
#define SCA_sl_MinusInvSqrt2 MTH_C_MinusInvSqrt2
|
||||
#define SCA_sl_MinusInvSqrt3 MTH_C_MinusInvSqrt3
|
||||
#define SCA_sl_MinusInvSqrt4 MTH_C_MinusInvSqrt4
|
||||
#define SCA_sl_MinusInvSqrt5 MTH_C_MinusInvSqrt5
|
||||
|
||||
#define SCA_sl_MAX_UNSIGNED_CHAR MTH_C_MAX_UNSIGNED_CHAR
|
||||
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Operations */
|
||||
/*--------------------------------------------------------*/
|
||||
/* Comparaisons */
|
||||
#define SCA_sl_M_bIsNull(_xOp) MTH_M_bIsNull(_xOp)
|
||||
#define SCA_sl_M_bEqualZero(_xOp) MTH_M_bEqualZero(_xOp)
|
||||
#define SCA_sl_M_bIsNegative(_xOp) MTH_M_bLessZero(_xOp)
|
||||
#define SCA_sl_M_bIsPositive(_xOp) MTH_M_bGreaterZero(_xOp)
|
||||
#define SCA_sl_M_bGreater(_xOp1,_xOp2) MTH_M_bGreater(_xOp1,_xOp2)
|
||||
#define SCA_sl_M_bLess(_xOp1,_xOp2) MTH_M_bLess_xOp1,_xOp2)
|
||||
#define SCA_sl_M_bGreaterEqual(_xOp1,_xOp2) MTH_M_bGreaterEqual(_xOp1,_xOp2)
|
||||
#define SCA_sl_M_bLessEqual(_xOp1,_xOp2) MTH_M_bLessEqual(_xOp1,_xOp2)
|
||||
#define SCA_sl_M_bEqual(_xOp1,_xOp2) MTH_M_bEqual(_xOp1,_xOp2)
|
||||
#define SCA_sl_M_bDifferent(_xOp1,_xOp2) MTH_M_bDifferent(_xOp1,_xOp2)
|
||||
|
||||
/* Operations */
|
||||
#define SCA_sl_M_slNeg(_xOp) MTH_M_xNeg(_xOp)
|
||||
#define SCA_sl_M_slAdd(_xOp1,_xOp2) MTH_M_xAdd(_xOp1,_xOp2)
|
||||
#define SCA_sl_M_slSub(_xOp1,_xOp2) MTH_M_xsub(_xOp1,_xOp2)
|
||||
#define SCA_sl_M_slMul(_xOp1,_xOp2) MTH_M_xMul(_xOp1,_xOp2)
|
||||
#define SCA_sl_M_slDiv(_xOp1,_xOp2) MTH_M_xDiv(_xOp1,_xOp2)
|
||||
|
||||
#define SCA_sl_M_slAbs(_xOp) MTH_M_xAbs(_xOp)
|
||||
#define SCA_sl_M_slNegAbs(_xOp) MTH_M_xNegAbs(_xOp)
|
||||
#define SCA_sl_M_slInv(_xOp) MTH_M_xInv(_xOp)
|
||||
#define SCA_sl_M_slSqr(_xOp) MTH_M_xSqr(_xOp,_xOp)
|
||||
#define SCA_sl_M_slCub(_xOp) MTH_M_xMul(_xOp,MTH_M_xSqr(_xOp))
|
||||
#define SCA_sl_M_slSqrt(_xOp) MTH_M_xSqrt(_xOp)
|
||||
#define SCA_sl_M_slInvSqrt(_xOp) MTH_M_xInvSqrt(_xOp)
|
||||
|
||||
#define SCA_sl_M_slSin(_xOp) MTH_M_xSin(_xOp)
|
||||
#define SCA_sl_M_slCos(_xOp) MTH_M_xSin(_xOp)
|
||||
/*
|
||||
#define sl_M_Tan(_xOp) (SCA_sl_fn_Tan(_xOp))
|
||||
#define sl_M_ASin(_xOp) (SCA_sl_fn_ASin(_xOp))
|
||||
#define sl_M_ACos(_xOp) (SCA_sl_fn_ACos(_xOp))
|
||||
*/
|
||||
/*
|
||||
#define sl_M_Sin(_xOp) SCA_sl_M_slDoubleToReal(sin(sl_M_Real2Double(_xOp)))
|
||||
#define sl_M_Cos(_xOp) SCA_sl_M_slDoubleToReal(cos(sl_M_Real2Double(_xOp)))
|
||||
*/
|
||||
|
||||
#define SCA_sl_M_slTan(_xOp) MTH_M_xTan(_xOp)
|
||||
#define SCA_sl_M_slASin(_xOp) MTH_M_xASin(_xOp)
|
||||
#define SCA_sl_M_slACos(_xOp) MTH_M_xACos(_xOp)
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 3D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl_M_slMulSubMul
|
||||
DESCRIPTION : Return the subtraction of two multiplications
|
||||
INPUT : a, b, c, d : SCA_td_sl
|
||||
OUTPUT : a*b - c*d : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define SCA_sl_M_slMulSubMul(a, b, c, d) MTH_M_xMulSubMul(a, b, c, d)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl_M_slMulAddMulAddMul
|
||||
DESCRIPTION : Return the adition of three multiplications
|
||||
INPUT : a, b, c, d, e, f : SCA_td_sl
|
||||
OUTPUT : a*b + c*d + e*f : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define SCA_sl_M_slMulAddMulAddMul(a, b, c, d, e, f) MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl_M_slSqrAddSqrAddSqr
|
||||
DESCRIPTION : Return the adition of three squares
|
||||
INPUT : a, b, c : SCA_td_sl
|
||||
OUTPUT : a*a + b*b + c*c : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define SCA_sl_M_slSqrAddSqrAddSqr(a, b, c) MTH_M_xSqrAddSqrAddSqr(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl_M_slMul3
|
||||
DESCRIPTION : Return the multiplication of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sl
|
||||
OUTPUT : a*b*c : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define SCA_sl_M_slMul3(a, b, c) MTH_M_xMul3(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl_M_slAdd3
|
||||
DESCRIPTION : Return the addition of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sl
|
||||
OUTPUT : a+b+c : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define SCA_sl_M_slAdd3(a, b, c) MTH_M_xAdd3(a, b, c)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SLREAL_H_ */
|
284
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sl12.h
Normal file
284
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sl12.h
Normal file
@@ -0,0 +1,284 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : SCA_sl12.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 17:52-------------------
|
||||
* Conversion : OK (avec version 23.04.98 19:26 (20523))
|
||||
* --------------------------------------------------*/
|
||||
#ifndef _SCA_sl12_H_
|
||||
#define _SCA_sl12_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/*-----------------*/
|
||||
/* Fixed coma case */
|
||||
/*-----------------*/
|
||||
/* 1.19.12 */
|
||||
|
||||
/*---------------------------------*/
|
||||
/* Specific Values for Fixed point */
|
||||
/*---------------------------------*/
|
||||
#define SCA_td_sl12 MTH_tdxReal
|
||||
|
||||
/*#define SCA_sl12_C_sl12ComaDecal 12*/
|
||||
/*#define SCA_sl12_C_sl12ComaCoef 4096*/
|
||||
|
||||
/*#define SCA_sl12_C_dfMax 524000.0*/
|
||||
/*#define SCA_sl12_C_dfMin (-SCA_sl12_C_dfMax)*/
|
||||
|
||||
/*#define SCA_sl12_C_sl12Max (0x7FFFFFE0)*/
|
||||
/*#define SCA_sl12_C_sl12Min (0xEFFFFFE0)*/
|
||||
/*#define SCA_sl12_C_sl12ForceMinus (0x80000000)*/
|
||||
/*#define SCA_sl12_C_sl12ForcePlus (0x7FFFFFFF)*/
|
||||
/*#define SCA_sl12_C_sl12Error (0x7FFFFFFF)*/
|
||||
|
||||
/*#define SCA_sl12_C_sl12NegMask (0x80000000)*/
|
||||
/*#define SCA_sl12_C_sl12PosMask (0x7FFFFFFF)*/
|
||||
/*#define SCA_sl12_C_sl12DecMask (0x00000FFF)*/
|
||||
/*#define SCA_sl12_C_sl12EntMask (0xFFFFF000)*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* ---------------- Constants ---------------------------*/
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sl12_C_ZERO MTH_C_ZERO
|
||||
#define SCA_sl12_C_ONE MTH_C_ONE
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Conversion functions */
|
||||
/*--------------------------------------------------------*/
|
||||
__inline SCA_td_sl12 SCA_sl12_fn_sl12Double2Real( double _dfValue )
|
||||
{
|
||||
return MTH_M_xDoubleToReal( _dfValue );
|
||||
}
|
||||
/*--------------------------------------------------------*/
|
||||
__inline double SCA_sl12_fn_Real2Double( SCA_td_sl12 _xValue )
|
||||
{
|
||||
return MTH_M_xRealToDouble( _xValue );
|
||||
}
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Conversions : Macros definitions */
|
||||
/*--------------------------------------------*/
|
||||
#define SCA_sl12_M_sl12DoubleToReal(_dfValue) MTH_M_xDoubleToReal(_dfValue)
|
||||
#define SCA_sl12_M_sl12FloatToReal(_fValue) MTH_M_xFloatToReal(_fValue)
|
||||
#define SCA_sl12_M_sl12IntToReal(_iValue) MTH_M_xLongToReal(_iValue) /*???*/
|
||||
|
||||
#define SCA_sl12_M_RealToDouble(_xValue) MTH_M_xRealToDouble(_xValue)
|
||||
#define SCA_sl12_M_RealToFloat(_xValue) MTH_M_xrealToFloat(_xValue)
|
||||
#define SCA_sl12_M_RealToInt(_xValue) MTh_M_xRealToLong(_xValue) /*???*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Constantes */
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sl12_C_sl12Two MTH_C_2
|
||||
|
||||
/* ##CONSTANTE#--------------------------------------------------------------------------
|
||||
Real Constantes declaration
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#define SCA_sl12_C_InfinitPlus MTH_C_InfinitPlus
|
||||
#define SCA_sl12_InfinitMinus MTH_C_InfinitMinus
|
||||
#define SCA_sl12_EpsilonPlus MTH_C_EpsilonPlus
|
||||
#define SCA_sl12_EpsilonMinus MTH_C_EpsilonMinus
|
||||
|
||||
#define SCA_sl12_Pi MTH_C_Pi
|
||||
#define SCA_sl12_2Pi MTH_C_2Pi
|
||||
#define SCA_sl12_PiBy2 MTH_C_PiBy2
|
||||
#define SCA_sl12_PiBy4 MTH_C_PiBy4
|
||||
#define SCA_sl12_PiBy8 MTH_C_PiBy8
|
||||
#define SCA_sl12_PiBy180 MTH_C_PiBy180
|
||||
#define SCA_sl12_180ByPi MTH_C_180ByPi
|
||||
#define SCA_sl12_e MTH_C_e
|
||||
|
||||
#define SCA_sl12_MinusONE MTH_C_MinusONE
|
||||
|
||||
#define SCA_sl12_2 MTH_C_2
|
||||
#define SCA_sl12_3 MTH_C_3
|
||||
#define SCA_sl12_4 MTH_C_4
|
||||
#define SCA_sl12_5 MTH_C_5
|
||||
#define SCA_sl12_8 (double) 8.0
|
||||
|
||||
#define SCA_sl12_Minus2 MTH_C_Minus2
|
||||
#define SCA_sl12_Minus3 MTH_C_Minus3
|
||||
#define SCA_sl12_Minus4 MTH_C_Minus4
|
||||
#define SCA_sl12_Minus5 MTH_C_Minus5
|
||||
|
||||
#define SCA_sl12_Inv2 MTH_C_Inv2
|
||||
#define SCA_sl12_Inv3 MTH_C_Inv3
|
||||
#define SCA_sl12_Inv4 MTH_C_Inv4
|
||||
#define SCA_sl12_Inv5 MTH_C_Inv5
|
||||
|
||||
#define SCA_sl12_MinusInv2 MTH_C_MinusInv2
|
||||
#define SCA_sl12_MinusInv3 MTH_C_MinusInv3
|
||||
#define SCA_sl12_MinusInv4 MTH_C_MinusInv4
|
||||
#define SCA_sl12_MinusInv5 MTH_C_MinusInv5
|
||||
|
||||
#define SCA_sl12_Sqrt2 MTH_C_Sqrt2
|
||||
#define SCA_sl12_Sqrt3 MTH_C_Sqrt3
|
||||
#define SCA_sl12_Sqrt4 MTH_C_Sqrt4
|
||||
#define SCA_sl12_Sqrt5 MTH_C_Sqrt5
|
||||
|
||||
#define SCA_sl12_MinusSqrt2 MTH_C_MinusSqrt2
|
||||
#define SCA_sl12_MinusSqrt3 MTH_C_MinusSqrt3
|
||||
#define SCA_sl12_MinusSqrt4 MTH_C_MinusSqrt4
|
||||
#define SCA_sl12_MinusSqrt5 MTH_C_MinusSqrt5
|
||||
|
||||
#define SCA_sl12_InvSqrt2 MTH_C_InvSqrt2
|
||||
#define SCA_sl12_InvSqrt3 MTH_C_InvSqrt3
|
||||
#define SCA_sl12_InvSqrt4 MTH_C_InvSqrt4
|
||||
#define SCA_sl12_InvSqrt5 MTH_C_InvSqrt5
|
||||
|
||||
#define SCA_sl12_MinusInvSqrt2 MTH_C_MinusInvSqrt2
|
||||
#define SCA_sl12_MinusInvSqrt3 MTH_C_MinusInvSqrt3
|
||||
#define SCA_sl12_MinusInvSqrt4 MTH_C_MinusInvSqrt4
|
||||
#define SCA_sl12_MinusInvSqrt5 MTH_C_MinusInvSqrt5
|
||||
|
||||
#define SCA_sl12_MAX_UNSIGNED_CHAR MTH_C_MAX_UNSIGNED_CHAR
|
||||
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Operations */
|
||||
/*--------------------------------------------------------*/
|
||||
/* Comparaisons */
|
||||
#define SCA_sl12_M_bIsNull(_xOp) MTH_M_bIsNull(_xOp)
|
||||
#define SCA_sl12_M_bEqualZero(_sl12Op) MTH_M_bEqualZero(_sl12Op)
|
||||
#define SCA_sl12_M_bIsNegative(_xOp) MTH_M_bLessZero((_xOp)
|
||||
#define SCA_sl12_M_bIsPositive(_xOp) MTH_M_bGreaterZero(_xOp)
|
||||
#define SCA_sl12_M_bGreater(_xOp1,_xOp2) MTH_M_bGreater(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_bLess(_xOp1,_xOp2) MTH_M_bLess_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_bGreaterEqual(_xOp1,_xOp2) MTH_M_bGreaterEqual(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_bLessEqual(_xOp1,_xOp2) MTH_M_bLessEqual(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_bEqual(_xOp1,_xOp2) MTH_M_bEqual(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_bDifferent(_xOp1,_xOp2) MTH_M_bDifferent(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_sl12Min(A,B) MTH_M_xMin(A,B)
|
||||
#define SCA_sl12_M_sl12Max(A,B) MTH_M_xMax(A,B)
|
||||
|
||||
/* Operations */
|
||||
#define SCA_sl12_M_sl12Neg(_xOp) MTH_M_xNeg(_xOp)
|
||||
#define SCA_sl12_M_sl12Add(_xOp1,_xOp2) MTH_M_xAdd(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_sl12Sub(_xOp1,_xOp2) MTH_M_xsub(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_sl12Mul(_xOp1,_xOp2) MTH_M_xMul(_xOp1,_xOp2)
|
||||
#define SCA_sl12_M_sl12Div(_xOp1,_xOp2) MTH_M_xDiv(_xOp1,_xOp2)
|
||||
|
||||
#define SCA_sl12_M_sl12Abs(_xOp) MTH_M_xAbs(_xOp)
|
||||
#define SCA_sl12_M_sl12NegAbs(_xOp) MTH_M_xNegAbs(_xOp)
|
||||
#define SCA_sl12_M_sl12Inv(_xOp) MTH_M_xInv(_xOp)
|
||||
#define SCA_sl12_M_sl12Sqr(_xOp) MTH_M_xSqr(_xOp,_xOp)
|
||||
#define SCA_sl12_M_sl12Cub(_xOp) MTH_M_xMul(_xOp,MTH_M_xSqr(_xOp))
|
||||
#define SCA_sl12_M_sl12Sqrt(_xOp) MTH_M_xSqrt(_xOp)
|
||||
#define SCA_sl12_M_sl12InvSqrt(_xOp) MTH_M_xInvSqrt(_xOp)
|
||||
|
||||
#define SCA_sl12_M_sl12Sin(_xOp) MTH_M_xSin(_xOp)
|
||||
#define SCA_sl12_M_sl12Cos(_xOp) MTH_M_xSin(_xOp)
|
||||
/*
|
||||
#define sl12_M_Tan(_xOp) (SCA_sl12_fn_Tan(_xOp))
|
||||
#define sl12_M_ASin(_xOp) (SCA_sl12_fn_ASin(_xOp))
|
||||
#define sl12_M_ACos(_xOp) (SCA_sl12_fn_ACos(_xOp))
|
||||
*/
|
||||
/*
|
||||
#define sl12_M_Sin(_xOp) SCA_sl12_M_sl12DoubleToReal(sin(sl12_M_Real2Double(_xOp)))
|
||||
#define sl12_M_Cos(_xOp) SCA_sl12_M_sl12DoubleToReal(cos(sl12_M_Real2Double(_xOp)))
|
||||
*/
|
||||
|
||||
#define SCA_sl12_M_sl12Tan(_xOp) MTH_M_xTan(_xOp)
|
||||
#define SCA_sl12_M_sl12ASin(_xOp) MTH_M_xASin(_xOp)
|
||||
#define SCA_sl12_M_sl12ACos(_xOp) MTH_M_xACos(_xOp)
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 3D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12MulSubMul
|
||||
DESCRIPTION : Return the subtraction of two multiplications
|
||||
INPUT : a, b, c, d : SCA_td_sl12
|
||||
OUTPUT : a*b - c*d : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12MulSubMul(a, b, c, d) MTH_M_xMulSubMul(a, b, c, d)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12MulAddMulAddMul
|
||||
DESCRIPTION : Return the adition of three multiplications
|
||||
INPUT : a, b, c, d, e, f : SCA_td_sl12
|
||||
OUTPUT : a*b + c*d + e*f : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12MulAddMulAddMul(a, b, c, d, e, f) MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12SqrAddSqrAddSqr
|
||||
DESCRIPTION : Return the adition of three squares
|
||||
INPUT : a, b, c : SCA_td_sl12
|
||||
OUTPUT : a*a + b*b + c*c : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12SqrAddSqrAddSqr(a, b, c) MTH_M_xSqrAddSqrAddSqr(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12Mul3
|
||||
DESCRIPTION : Return the multiplication of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sl12
|
||||
OUTPUT : a*b*c : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12Mul3(a, b, c) MTH_M_xMul3(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12Add3
|
||||
DESCRIPTION : Return the addition of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sl12
|
||||
OUTPUT : a+b+c : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12Add3(a, b, c) MTH_M_xAdd3(a, b, c)
|
||||
|
||||
#define SCA_sl12_M_sl12ACos(_xOp) MTH_M_xACos(_xOp)
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 3D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12MulSubMul
|
||||
DESCRIPTION : Return the subtraction of two multiplications
|
||||
INPUT : a, b, c, d : SCA_td_sl12
|
||||
OUTPUT : a*b - c*d : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12MulSubMul(a, b, c, d) MTH_M_xMulSubMul(a, b, c, d)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12MulAddMulAddMul
|
||||
DESCRIPTION : Return the adition of three multiplications
|
||||
INPUT : a, b, c, d, e, f : SCA_td_sl12
|
||||
OUTPUT : a*b + c*d + e*f : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12MulAddMulAddMul(a, b, c, d, e, f) MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12SqrAddSqrAddSqr
|
||||
DESCRIPTION : Return the adition of three squares
|
||||
INPUT : a, b, c : SCA_td_sl12
|
||||
OUTPUT : a*a + b*b + c*c : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12SqrAddSqrAddSqr(a, b, c) MTH_M_xSqrAddSqrAddSqr(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12Mul3
|
||||
DESCRIPTION : Return the multiplication of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sl12
|
||||
OUTPUT : a*b*c : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12Mul3(a, b, c) MTH_M_xMul3(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sl12_M_sl12Add3
|
||||
DESCRIPTION : Return the addition of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sl12
|
||||
OUTPUT : a+b+c : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define SCA_sl12_M_sl12Add3(a, b, c) MTH_M_xAdd3(a, b, c)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SCA_sl12_H_ */
|
237
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sw.h
Normal file
237
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sw.h
Normal file
@@ -0,0 +1,237 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : SCA_sw.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 17:45-------------------
|
||||
* Conversion : OK (avec version 23.04.98 19:26 (18823))
|
||||
* --------------------------------------------------*/
|
||||
#ifndef _SCA_sw_H_
|
||||
#define _SCA_sw_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* New */
|
||||
/*-----------------*/
|
||||
/* Fixed coma case */
|
||||
/*-----------------*/
|
||||
/* 1.15.0 */
|
||||
|
||||
/*---------------------------------*/
|
||||
/* Specific Values for fixed point */
|
||||
/*---------------------------------*/
|
||||
#define SCA_td_sw MTH_tdxReal
|
||||
|
||||
/*#define SCA_sw_C_swComaDecal 0*/
|
||||
/*#define SCA_sw_C_swComaCoef 1*/
|
||||
|
||||
/*#define SCA_sw_C_dfMax 32768*/
|
||||
/*#define SCA_sw_C_dfMin (-SCA_sw_C_dfMax)*/
|
||||
|
||||
/*#define SCA_sw_C_swMax 32767*/
|
||||
/*#define SCA_sw_C_swMin -32767*/
|
||||
/*#define SCA_sw_C_swError -32768*/
|
||||
|
||||
/*#define SCA_sw_C_swNegMask (0x8000)*/
|
||||
/*#define SCA_sw_C_swPosMask (0x7FFF)*/
|
||||
/*#define SCA_sw_C_swDecMask (0x0000)*/
|
||||
/*#define SCA_sw_C_swEntMask (0xFFFF)*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* ---------------- Constants ---------------------------*/
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sw_C_ZERO MTH_C_ZERO
|
||||
#define SCA_sw_C_ONE MTH_C_ONE
|
||||
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Conversion functions */
|
||||
/*--------------------------------------------------------*/
|
||||
__inline SCA_td_sw SCA_sw_fn_swDouble2Real( double _dfValue )
|
||||
{
|
||||
return MTH_M_xDoubleToReal( _dfValue );
|
||||
}
|
||||
/*--------------------------------------------------------*/
|
||||
__inline double SCA_sw_fn_Real2Double( SCA_td_sw _xValue )
|
||||
{
|
||||
return MTH_M_xRealToDouble( _xValue );
|
||||
}
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Conversions : Macros definitions */
|
||||
/*--------------------------------------------*/
|
||||
#define SCA_sw_M_swDoubleToReal(_dfValue) MTH_M_xDoubleToReal(_dfValue)
|
||||
#define SCA_sw_M_swFloatToReal(_fValue) MTH_M_xFloatToReal(_fValue)
|
||||
#define SCA_sw_M_swIntToReal(_iValue) MTH_M_xLongToReal(_iValue) /*???*/
|
||||
|
||||
#define SCA_sw_M_RealToDouble(_xValue) MTH_M_xRealToDouble(_xValue)
|
||||
#define SCA_sw_M_RealToFloat(_xValue) MTH_M_xrealToFloat(_xValue)
|
||||
#define SCA_sw_M_RealToInt(_xValue) MTh_M_xRealToLong(_xValue) /*???*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Constantes */
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sw_C_swTwo MTH_C_2
|
||||
|
||||
/* ##CONSTANTE#--------------------------------------------------------------------------
|
||||
Real Constantes declaration
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#define SCA_sw_C_InfinitPlus MTH_C_InfinitPlus
|
||||
#define SCA_sw_InfinitMinus MTH_C_InfinitMinus
|
||||
#define SCA_sw_EpsilonPlus MTH_C_EpsilonPlus
|
||||
#define SCA_sw_EpsilonMinus MTH_C_EpsilonMinus
|
||||
|
||||
#define SCA_sw_Pi MTH_C_Pi
|
||||
#define SCA_sw_2Pi MTH_C_2Pi
|
||||
#define SCA_sw_PiBy2 MTH_C_PiBy2
|
||||
#define SCA_sw_PiBy4 MTH_C_PiBy4
|
||||
#define SCA_sw_PiBy8 MTH_C_PiBy8
|
||||
#define SCA_sw_PiBy180 MTH_C_PiBy180
|
||||
#define SCA_sw_180ByPi MTH_C_180ByPi
|
||||
#define SCA_sw_e MTH_C_e
|
||||
|
||||
#define SCA_sw_MinusONE MTH_C_MinusONE
|
||||
|
||||
#define SCA_sw_2 MTH_C_2
|
||||
#define SCA_sw_3 MTH_C_3
|
||||
#define SCA_sw_4 MTH_C_4
|
||||
#define SCA_sw_5 MTH_C_5
|
||||
#define SCA_sw_8 (double) 8.0
|
||||
|
||||
#define SCA_sw_Minus2 MTH_C_Minus2
|
||||
#define SCA_sw_Minus3 MTH_C_Minus3
|
||||
#define SCA_sw_Minus4 MTH_C_Minus4
|
||||
#define SCA_sw_Minus5 MTH_C_Minus5
|
||||
|
||||
#define SCA_sw_Inv2 MTH_C_Inv2
|
||||
#define SCA_sw_Inv3 MTH_C_Inv3
|
||||
#define SCA_sw_Inv4 MTH_C_Inv4
|
||||
#define SCA_sw_Inv5 MTH_C_Inv5
|
||||
|
||||
#define SCA_sw_MinusInv2 MTH_C_MinusInv2
|
||||
#define SCA_sw_MinusInv3 MTH_C_MinusInv3
|
||||
#define SCA_sw_MinusInv4 MTH_C_MinusInv4
|
||||
#define SCA_sw_MinusInv5 MTH_C_MinusInv5
|
||||
|
||||
#define SCA_sw_Sqrt2 MTH_C_Sqrt2
|
||||
#define SCA_sw_Sqrt3 MTH_C_Sqrt3
|
||||
#define SCA_sw_Sqrt4 MTH_C_Sqrt4
|
||||
#define SCA_sw_Sqrt5 MTH_C_Sqrt5
|
||||
|
||||
#define SCA_sw_MinusSqrt2 MTH_C_MinusSqrt2
|
||||
#define SCA_sw_MinusSqrt3 MTH_C_MinusSqrt3
|
||||
#define SCA_sw_MinusSqrt4 MTH_C_MinusSqrt4
|
||||
#define SCA_sw_MinusSqrt5 MTH_C_MinusSqrt5
|
||||
|
||||
#define SCA_sw_InvSqrt2 MTH_C_InvSqrt2
|
||||
#define SCA_sw_InvSqrt3 MTH_C_InvSqrt3
|
||||
#define SCA_sw_InvSqrt4 MTH_C_InvSqrt4
|
||||
#define SCA_sw_InvSqrt5 MTH_C_InvSqrt5
|
||||
|
||||
#define SCA_sw_MinusInvSqrt2 MTH_C_MinusInvSqrt2
|
||||
#define SCA_sw_MinusInvSqrt3 MTH_C_MinusInvSqrt3
|
||||
#define SCA_sw_MinusInvSqrt4 MTH_C_MinusInvSqrt4
|
||||
#define SCA_sw_MinusInvSqrt5 MTH_C_MinusInvSqrt5
|
||||
|
||||
#define SCA_sw_MAX_UNSIGNED_CHAR MTH_C_MAX_UNSIGNED_CHAR
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Operations */
|
||||
/*--------------------------------------------------------*/
|
||||
/* Comparaisons */
|
||||
#define SCA_sw_M_bIsNull(_xOp) MTH_M_bIsNull(_xOp)
|
||||
#define SCA_sw_M_bEqualZero(_xOp) MTH_M_bEqualZero(_xOp)
|
||||
#define SCA_sw_M_bIsNegative(_xOp) MTH_M_bLessZero(_xOp)
|
||||
#define SCA_sw_M_bIsPositive(_xOp) MTH_M_bGreaterZero(_xOp)
|
||||
#define SCA_sw_M_bGreater(_xOp1,_xOp2) MTH_M_bGreater(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_bLess(_xOp1,_xOp2) MTH_M_bLess_xOp1,_xOp2)
|
||||
#define SCA_sw_M_bGreaterEqual(_xOp1,_xOp2) MTH_M_bGreaterEqual(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_bLessEqual(_xOp1,_xOp2) MTH_M_bLessEqual(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_bEqual(_xOp1,_xOp2) MTH_M_bEqual(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_bDifferent(_xOp1,_xOp2) MTH_M_bDifferent(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_swMax(A,B) MTH_M_xMax(A,B)
|
||||
#define SCA_sw_M_swMin(A,B) MTH_M_xMin(A,B)
|
||||
|
||||
|
||||
/* Operations */
|
||||
#define SCA_sw_M_swNeg(_xOp) MTH_M_xNeg(_xOp)
|
||||
#define SCA_sw_M_swAdd(_xOp1,_xOp2) MTH_M_xAdd(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_swSub(_xOp1,_xOp2) MTH_M_xsub(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_swMul(_xOp1,_xOp2) MTH_M_xMul(_xOp1,_xOp2)
|
||||
#define SCA_sw_M_swDiv(_xOp1,_xOp2) MTH_M_xDiv(_xOp1,_xOp2)
|
||||
|
||||
#define SCA_sw_M_swAbs(_xOp) MTH_M_xAbs(_xOp)
|
||||
#define SCA_sw_M_swNegAbs(_xOp) MTH_M_xNegAbs(_xOp)
|
||||
#define SCA_sw_M_swInv(_xOp) MTH_M_xInv(_xOp)
|
||||
#define SCA_sw_M_swSqr(_xOp) MTH_M_xSqr(_xOp,_xOp)
|
||||
#define SCA_sw_M_swCub(_xOp) MTH_M_xMul(_xOp,MTH_M_xSqr(_xOp))
|
||||
#define SCA_sw_M_swSqrt(_xOp) MTH_M_xSqrt(_xOp)
|
||||
#define SCA_sw_M_swInvSqrt(_xOp) MTH_M_xInvSqrt(_xOp)
|
||||
|
||||
#define SCA_sw_M_swSin(_xOp) MTH_M_xSin(_xOp)
|
||||
#define SCA_sw_M_swCos(_xOp) MTH_M_xSin(_xOp)
|
||||
/*
|
||||
#define sw_M_Tan(_xOp) (SCA_sw_fn_Tan(_xOp))
|
||||
#define sw_M_ASin(_xOp) (SCA_sw_fn_ASin(_xOp))
|
||||
#define sw_M_ACos(_xOp) (SCA_sw_fn_ACos(_xOp))
|
||||
*/
|
||||
/*
|
||||
#define sw_M_Sin(_xOp) SCA_sw_M_swDoubleToReal(sin(sw_M_Real2Double(_xOp)))
|
||||
#define sw_M_Cos(_xOp) SCA_sw_M_swDoubleToReal(cos(sw_M_Real2Double(_xOp)))
|
||||
*/
|
||||
|
||||
#define SCA_sw_M_swTan(_xOp) MTH_M_xTan(_xOp)
|
||||
#define SCA_sw_M_swASin(_xOp) MTH_M_xASin(_xOp)
|
||||
#define SCA_sw_M_swACos(_xOp) MTH_M_xACos(_xOp)
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 3D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw_M_swMulSubMul
|
||||
DESCRIPTION : Return the subtraction of two multiplications
|
||||
INPUT : a, b, c, d : SCA_td_sw
|
||||
OUTPUT : a*b - c*d : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define SCA_sw_M_swMulSubMul(a, b, c, d) MTH_M_xMulSubMul(a, b, c, d)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw_M_swMulAddMulAddMul
|
||||
DESCRIPTION : Return the adition of three multiplications
|
||||
INPUT : a, b, c, d, e, f : SCA_td_sw
|
||||
OUTPUT : a*b + c*d + e*f : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define SCA_sw_M_swMulAddMulAddMul(a, b, c, d, e, f) MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw_M_swSqrAddSqrAddSqr
|
||||
DESCRIPTION : Return the adition of three squares
|
||||
INPUT : a, b, c : SCA_td_sw
|
||||
OUTPUT : a*a + b*b + c*c : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define SCA_sw_M_swSqrAddSqrAddSqr(a, b, c) MTH_M_xSqrAddSqrAddSqr(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw_M_swMul3
|
||||
DESCRIPTION : Return the multiplication of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sw
|
||||
OUTPUT : a*b*c : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define SCA_sw_M_swMul3(a, b, c) MTH_M_xMul3(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw_M_swAdd3
|
||||
DESCRIPTION : Return the addition of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sw
|
||||
OUTPUT : a+b+c : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define SCA_sw_M_swAdd3(a, b, c) MTH_M_xAdd3(a, b, c)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SCA_sw_H_ */
|
237
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sw12.h
Normal file
237
Rayman_X/cpa/public/MTH/Specif/SCA/SCA_sw12.h
Normal file
@@ -0,0 +1,237 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : SCA_sw12.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 17:45-------------------
|
||||
* Conversion : OK (avec version du 23.04.98 19:26 (19635))
|
||||
* --------------------------------------------------*/
|
||||
#ifndef _SCA_sw12_H_
|
||||
#define _SCA_sw12_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* New */
|
||||
/*-----------------*/
|
||||
/* Fixed coma case */
|
||||
/*-----------------*/
|
||||
/* 1.3.12 */
|
||||
|
||||
/*---------------------------------*/
|
||||
/* Specific Values for fixed point */
|
||||
/*---------------------------------*/
|
||||
#define SCA_td_sw12 MTH_tdxReal
|
||||
|
||||
/*#define SCA_sw12_C_sw12ComaDecal 0*/
|
||||
/*#define SCA_sw12_C_sw12ComaCoef 1*/
|
||||
|
||||
/*#define SCA_sw12_C_dfMax 32768*/
|
||||
/*#define SCA_sw12_C_dfMin (-SCA_sw12_C_dfMax)*/
|
||||
|
||||
/*#define SCA_sw12_C_sw12Max 32767*/
|
||||
/*#define SCA_sw12_C_sw12Min -32767*/
|
||||
/*#define SCA_sw12_C_sw12Error -32768*/
|
||||
|
||||
/*#define SCA_sw12_C_sw12NegMask (0x8000)*/
|
||||
/*#define SCA_sw12_C_sw12PosMask (0x7FFF)*/
|
||||
/*#define SCA_sw12_C_sw12DecMask (0x0000)*/
|
||||
/*#define SCA_sw12_C_sw12EntMask (0xFFFF)*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* ---------------- Constants ---------------------------*/
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sw12_C_ZERO MTH_C_ZERO
|
||||
#define SCA_sw12_C_ONE MTH_C_ONE
|
||||
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Conversion functions */
|
||||
/*--------------------------------------------------------*/
|
||||
__inline SCA_td_sw12 SCA_sw12_fn_sw12Double2Real( double _dfValue )
|
||||
{
|
||||
return MTH_M_xDoubleToReal( _dfValue );
|
||||
}
|
||||
/*--------------------------------------------------------*/
|
||||
__inline double SCA_sw12_fn_Real2Double( SCA_td_sw12 _xValue )
|
||||
{
|
||||
return MTH_M_xRealToDouble( _xValue );
|
||||
}
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Conversions : Macros definitions */
|
||||
/*--------------------------------------------*/
|
||||
#define SCA_sw12_M_sw12DoubleToReal(_dfValue) MTH_M_xDoubleToReal(_dfValue)
|
||||
#define SCA_sw12_M_sw12FloatToReal(_fValue) MTH_M_xFloatToReal(_fValue)
|
||||
#define SCA_sw12_M_sw12IntToReal(_iValue) MTH_M_xLongToReal(_iValue) /*???*/
|
||||
|
||||
#define SCA_sw12_M_RealToDouble(_xValue) MTH_M_xRealToDouble(_xValue)
|
||||
#define SCA_sw12_M_RealToFloat(_xValue) MTH_M_xrealToFloat(_xValue)
|
||||
#define SCA_sw12_M_RealToInt(_xValue) MTh_M_xRealToLong(_xValue) /*???*/
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Constantes */
|
||||
/*--------------------------------------------------------*/
|
||||
#define SCA_sw12_C_sw12Two MTH_C_2
|
||||
|
||||
/* ##CONSTANTE#--------------------------------------------------------------------------
|
||||
Real Constantes declaration
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
#define SCA_sw12_C_InfinitPlus MTH_C_InfinitPlus
|
||||
#define SCA_sw12_InfinitMinus MTH_C_InfinitMinus
|
||||
#define SCA_sw12_EpsilonPlus MTH_C_EpsilonPlus
|
||||
#define SCA_sw12_EpsilonMinus MTH_C_EpsilonMinus
|
||||
|
||||
#define SCA_sw12_Pi MTH_C_Pi
|
||||
#define SCA_sw12_2Pi MTH_C_2Pi
|
||||
#define SCA_sw12_PiBy2 MTH_C_PiBy2
|
||||
#define SCA_sw12_PiBy4 MTH_C_PiBy4
|
||||
#define SCA_sw12_PiBy8 MTH_C_PiBy8
|
||||
#define SCA_sw12_PiBy180 MTH_C_PiBy180
|
||||
#define SCA_sw12_180ByPi MTH_C_180ByPi
|
||||
#define SCA_sw12_e MTH_C_e
|
||||
|
||||
#define SCA_sw12_MinusONE MTH_C_MinusONE
|
||||
|
||||
#define SCA_sw12_2 MTH_C_2
|
||||
#define SCA_sw12_3 MTH_C_3
|
||||
#define SCA_sw12_4 MTH_C_4
|
||||
#define SCA_sw12_5 MTH_C_5
|
||||
#define SCA_sw12_8 (double) 8.0
|
||||
|
||||
#define SCA_sw12_Minus2 MTH_C_Minus2
|
||||
#define SCA_sw12_Minus3 MTH_C_Minus3
|
||||
#define SCA_sw12_Minus4 MTH_C_Minus4
|
||||
#define SCA_sw12_Minus5 MTH_C_Minus5
|
||||
|
||||
#define SCA_sw12_Inv2 MTH_C_Inv2
|
||||
#define SCA_sw12_Inv3 MTH_C_Inv3
|
||||
#define SCA_sw12_Inv4 MTH_C_Inv4
|
||||
#define SCA_sw12_Inv5 MTH_C_Inv5
|
||||
|
||||
#define SCA_sw12_MinusInv2 MTH_C_MinusInv2
|
||||
#define SCA_sw12_MinusInv3 MTH_C_MinusInv3
|
||||
#define SCA_sw12_MinusInv4 MTH_C_MinusInv4
|
||||
#define SCA_sw12_MinusInv5 MTH_C_MinusInv5
|
||||
|
||||
#define SCA_sw12_Sqrt2 MTH_C_Sqrt2
|
||||
#define SCA_sw12_Sqrt3 MTH_C_Sqrt3
|
||||
#define SCA_sw12_Sqrt4 MTH_C_Sqrt4
|
||||
#define SCA_sw12_Sqrt5 MTH_C_Sqrt5
|
||||
|
||||
#define SCA_sw12_MinusSqrt2 MTH_C_MinusSqrt2
|
||||
#define SCA_sw12_MinusSqrt3 MTH_C_MinusSqrt3
|
||||
#define SCA_sw12_MinusSqrt4 MTH_C_MinusSqrt4
|
||||
#define SCA_sw12_MinusSqrt5 MTH_C_MinusSqrt5
|
||||
|
||||
#define SCA_sw12_InvSqrt2 MTH_C_InvSqrt2
|
||||
#define SCA_sw12_InvSqrt3 MTH_C_InvSqrt3
|
||||
#define SCA_sw12_InvSqrt4 MTH_C_InvSqrt4
|
||||
#define SCA_sw12_InvSqrt5 MTH_C_InvSqrt5
|
||||
|
||||
#define SCA_sw12_MinusInvSqrt2 MTH_C_MinusInvSqrt2
|
||||
#define SCA_sw12_MinusInvSqrt3 MTH_C_MinusInvSqrt3
|
||||
#define SCA_sw12_MinusInvSqrt4 MTH_C_MinusInvSqrt4
|
||||
#define SCA_sw12_MinusInvSqrt5 MTH_C_MinusInvSqrt5
|
||||
|
||||
#define SCA_sw12_MAX_UNSIGNED_CHAR MTH_C_MAX_UNSIGNED_CHAR
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* Operations */
|
||||
/*--------------------------------------------------------*/
|
||||
/* Comparaisons */
|
||||
#define SCA_sw12_M_bIsNull(_xOp) MTH_M_bIsNull(_xOp)
|
||||
#define SCA_sw12_M_bEqualZero(_sw12Op) MTH_M_bEqualZero(_sw12Op)
|
||||
#define SCA_sw12_M_bIsNegative(_xOp) MTH_M_bLessZero((_xOp)
|
||||
#define SCA_sw12_M_bIsPositive(_xOp) MTH_M_bGreaterZero(_xOp)
|
||||
#define SCA_sw12_M_bGreater(_xOp1,_xOp2) MTH_M_bGreater(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_bLess(_xOp1,_xOp2) MTH_M_bLess_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_bGreaterEqual(_xOp1,_xOp2) MTH_M_bGreaterEqual(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_bLessEqual(_xOp1,_xOp2) MTH_M_bLessEqual(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_bEqual(_xOp1,_xOp2) MTH_M_bEqual(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_bDifferent(_xOp1,_xOp2) MTH_M_bDifferent(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_sw12Max(A,B) MTH_M_xMax(A,B)
|
||||
#define SCA_sw12_M_sw12Min(A,B) MTH_M_xMin(A,B)
|
||||
|
||||
/* Operations */
|
||||
#define SCA_sw12_M_sw12Neg(_xOp) MTH_M_xNeg(_xOp)
|
||||
#define SCA_sw12_M_sw12Add(_xOp1,_xOp2) MTH_M_xAdd(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_sw12Sub(_xOp1,_xOp2) MTH_M_xsub(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_sw12Mul(_xOp1,_xOp2) MTH_M_xMul(_xOp1,_xOp2)
|
||||
#define SCA_sw12_M_sw12Div(_xOp1,_xOp2) MTH_M_xDiv(_xOp1,_xOp2)
|
||||
|
||||
#define SCA_sw12_M_sw12Abs(_xOp) MTH_M_xAbs(_xOp)
|
||||
#define SCA_sw12_M_sw12NegAbs(_xOp) MTH_M_xNegAbs(_xOp)
|
||||
#define SCA_sw12_M_sw12Inv(_xOp) MTH_M_xInv(_xOp)
|
||||
#define SCA_sw12_M_sw12Sqr(_xOp) MTH_M_xSqr(_xOp,_xOp)
|
||||
#define SCA_sw12_M_sw12Cub(_xOp) MTH_M_xMul(_xOp,MTH_M_xSqr(_xOp))
|
||||
#define SCA_sw12_M_sw12Sqrt(_xOp) MTH_M_xSqrt(_xOp)
|
||||
#define SCA_sw12_M_sw12InvSqrt(_xOp) MTH_M_xInvSqrt(_xOp)
|
||||
|
||||
#define SCA_sw12_M_sw12Sin(_xOp) MTH_M_xSin(_xOp)
|
||||
#define SCA_sw12_M_sw12Cos(_xOp) MTH_M_xSin(_xOp)
|
||||
/*
|
||||
#define sw12_M_Tan(_xOp) (SCA_sw12_fn_Tan(_xOp))
|
||||
#define sw12_M_ASin(_xOp) (SCA_sw12_fn_ASin(_xOp))
|
||||
#define sw12_M_ACos(_xOp) (SCA_sw12_fn_ACos(_xOp))
|
||||
*/
|
||||
/*
|
||||
#define sw12_M_Sin(_xOp) SCA_sw12_M_sw12DoubleToReal(sin(sw12_M_Real2Double(_xOp)))
|
||||
#define sw12_M_Cos(_xOp) SCA_sw12_M_sw12DoubleToReal(cos(sw12_M_Real2Double(_xOp)))
|
||||
*/
|
||||
|
||||
#define SCA_sw12_M_sw12Tan(_xOp) MTH_M_xTan(_xOp)
|
||||
#define SCA_sw12_M_sw12ASin(_xOp) MTH_M_xASin(_xOp)
|
||||
#define SCA_sw12_M_sw12ACos(_xOp) MTH_M_xACos(_xOp)
|
||||
|
||||
|
||||
/* ##-##############################
|
||||
## Tools for MulMatrixMatrix 3D
|
||||
################################# */
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw12_M_sw12MulSubMul
|
||||
DESCRIPTION : Return the subtraction of two multiplications
|
||||
INPUT : a, b, c, d : SCA_td_sw12
|
||||
OUTPUT : a*b - c*d : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define SCA_sw12_M_sw12MulSubMul(a, b, c, d) MTH_M_xMulSubMul(a, b, c, d)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw12_M_sw12MulAddMulAddMul
|
||||
DESCRIPTION : Return the adition of three multiplications
|
||||
INPUT : a, b, c, d, e, f : SCA_td_sw12
|
||||
OUTPUT : a*b + c*d + e*f : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define SCA_sw12_M_sw12MulAddMulAddMul(a, b, c, d, e, f) MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw12_M_sw12SqrAddSqrAddSqr
|
||||
DESCRIPTION : Return the adition of three squares
|
||||
INPUT : a, b, c : SCA_td_sw12
|
||||
OUTPUT : a*a + b*b + c*c : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define SCA_sw12_M_sw12SqrAddSqrAddSqr(a, b, c) MTH_M_xSqrAddSqrAddSqr(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw12_M_sw12Mul3
|
||||
DESCRIPTION : Return the multiplication of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sw12
|
||||
OUTPUT : a*b*c : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define SCA_sw12_M_sw12Mul3(a, b, c) MTH_M_xMul3(a, b, c)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : SCA_sw12_M_sw12Add3
|
||||
DESCRIPTION : Return the addition of three real numbers
|
||||
INPUT : a, b, c : SCA_td_sw12
|
||||
OUTPUT : a+b+c : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define SCA_sw12_M_sw12Add3(a, b, c) MTH_M_xAdd3(a, b, c)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SCA_sw12_H_ */
|
||||
|
78
Rayman_X/cpa/public/MTH/Specif/SCA/converse.h
Normal file
78
Rayman_X/cpa/public/MTH/Specif/SCA/converse.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*--------------------------------*/
|
||||
/* Conversion of numericals types */
|
||||
/*--------------------------------*/
|
||||
/* Version 1.0 */
|
||||
/* Author : S Leroy */
|
||||
/* Date : 4/03/98 */
|
||||
/* Modification : 4/03/98 */
|
||||
/*--------------------------------*/
|
||||
/* PC Version by M Trabucato */
|
||||
/*--------------------------------*/
|
||||
/* Conversion : OK (avec version 27.04.98 12:03 (11041)) */
|
||||
/*--------------------------------*/
|
||||
|
||||
#ifndef _CONVERSE_H_
|
||||
#define _CONVERSE_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sl12.h"
|
||||
#include "MTH\Specif\SCA\SCA_sl.h"
|
||||
#include "MTH\Specif\SCA\SCA_sw12.h"
|
||||
#include "MTH\Specif\SCA\SCA_sw.h"
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#define SCA_M_sw12_Div_SwBySw(a,b) MTH_M_xDiv(a,b)
|
||||
#define SCA_M_sw_Div_SwBySl12(a,b) MTH_M_xDiv(a,b)
|
||||
#define SCA_M_sl12_Div_SlBySl(a,b) MTH_M_xDiv(a,b)
|
||||
#define SCA_M_sl12_Div_SwBySw(a,b) MTH_M_xDiv(a,b)
|
||||
|
||||
|
||||
/* sl <- sl12 * sl */
|
||||
#define SCA_M_sl_Mul_Sl12BySl(a,b) MTH_M_xMul(a,b)
|
||||
#define SCA_M_sl_Mul_Sw12BySw(a,b) MTH_M_xMul(a,b)
|
||||
#define SCA_M_sl_Mul_Sl12BySl(a,b) MTH_M_xMul(a,b)
|
||||
#define SCA_M_sl_Mul_Sl12BySw(a,b) MTH_M_xMul(a,b)
|
||||
#define SCA_M_sw_Mul_Sw12BySw(a,b) MTH_M_xMul(a,b)
|
||||
|
||||
/*------------*/
|
||||
/* sl <- sw^2 */
|
||||
/*------------*/
|
||||
#define SCA_M_sl_Sqr_sw(_xOp) MTH_M_xSqr(_xOp)
|
||||
|
||||
|
||||
/* Macro definitions */
|
||||
#define SCA_M_converse_scTosl12(_sc) (_sc)
|
||||
|
||||
#define SCA_M_converse_swTosl(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_swTosw12(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_swTosl12(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_slTosw(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_slTosw12(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_slTosl12(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_sl12Tosl(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_sl12Tosw(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_sl12Tosw12(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_sw12Tosl12(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_sw12Tosw(_sl12Value) (_sl12Value)
|
||||
#define SCA_M_converse_sw12Tosl(_sl12Value) (_sl12Value)
|
||||
|
||||
/* ShortCuts */
|
||||
#define scTosl12(_sc) SCA_M_converse_scTosl12(_sc)
|
||||
#define swTosl(_sl12Value) SCA_M_converse_swTosl(_sl12Value)
|
||||
#define swTosw12(_sl12Value) SCA_M_converse_swTosw12(_sl12Value)
|
||||
#define swTosl12(_sl12Value) SCA_M_converse_swTosl12(_sl12Value)
|
||||
#define slTosw(_sl12Value) SCA_M_converse_slTosw(_sl12Value)
|
||||
#define slTosw12(_sl12Value) SCA_M_converse_slTosw12(_sl12Value)
|
||||
#define slTosl12(_sl12Value) SCA_M_converse_slTosl12(_sl12Value)
|
||||
#define sl12Tosl(_sl12Value) SCA_M_converse_sl12Tosl(_sl12Value)
|
||||
#define sl12Tosw(_sl12Value) SCA_M_converse_sl12Tosw(_sl12Value)
|
||||
#define sl12Tosw12(_sl12Value) SCA_M_converse_sl12Tosw12(_sl12Value)
|
||||
#define sw12Tosl12(_sl12Value) SCA_M_converse_sw12Tosl12(_sl12Value)
|
||||
#define sw12Tosw(_sl12Value) SCA_M_converse_sw12Tosw(_sl12Value)
|
||||
#define sw12Tosl(_sl12Value) SCA_M_converse_sw12Tosl(_sl12Value)
|
||||
#define EntDecTosl12(_xEnt,_xDec) (MTH_M_xAdd(_xEnt,(MTH_M_xDiv(_Dec,MTH_M_xLongtoReal(10000)))))
|
||||
|
||||
|
||||
#endif /* _CONVERSE_H_ */
|
72
Rayman_X/cpa/public/MTH/Specif/SCA/sl.h
Normal file
72
Rayman_X/cpa/public/MTH/Specif/SCA/sl.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : sl.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 17:45-------------------
|
||||
* Conversion : useless (avec version 24.04.98 11:32 (2513))
|
||||
* --------------------------------------------------*/
|
||||
#ifndef _sl_H_
|
||||
#define _sl_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sl.h"
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* Define the type DNM_tdxReal */
|
||||
#define td_sl SCA_td_sl
|
||||
|
||||
/* Constants */
|
||||
#define sl_ZERO SCA_sl_C_ZERO
|
||||
#define sl_ONE SCA_sl_C_ONE
|
||||
|
||||
/* Comparisons */
|
||||
#define sl_bGreater(_slOp1,_slOp2) SCA_sl_M_bGreater(_slOp1,_slOp2)
|
||||
#define sl_bGreaterEqual(_slOp1,_slOp2) SCA_sl_M_bGreaterEqual(_slOp1,_slOp2)
|
||||
#define sl_bLess(_slOp1,_slOp2) SCA_sl_M_bLess(_slOp1,_slOp2)
|
||||
#define sl_bLessEqual(_slOp1,_slOp2) SCA_sl_M_bLessEqual(_slOp1,_slOp2)
|
||||
#define sl_bEqual(_slOp1,_slOp2) SCA_sl_M_bEqual(_slOp1,_slOp2)
|
||||
#define sl_bDiferent(_slOp1,_slOp2) SCA_sl_M_bDifferent(_slOp1,_slOp2)
|
||||
#define sl_bIsNull(_slOp) SCA_sl_M_bIsNull(_slOp)
|
||||
#define sl_bEqualZero(_slOp) SCA_sl_M_bIsNull(_slOp)
|
||||
#define sl_bGreaterZero( A ) sl_bGreater( (A), sl_ZERO )
|
||||
#define sl_bLessZero( A ) sl_bLess( (A), sl_ZERO )
|
||||
#define sl_bDifferentZero( A ) sl_bDiferent( (A), sl_ZERO )
|
||||
|
||||
/* Conversions : Macros definitions */
|
||||
#define DoubleTosl(_dfValue) SCA_sl_M_slDoubleToReal(_dfValue)
|
||||
#define FloatTosl(_fValue) SCA_sl_M_slFloatToReal(_fValue)
|
||||
#define IntTosl(_iValue) SCA_sl_M_slIntToReal(_iValue)
|
||||
|
||||
#define sl12ToDouble(_sl12Value) SCA_sl12_M_RealToDouble(_sl12Value)
|
||||
#define sl12ToFloat(_sl12Value) SCA_sl12_M_RealToFloat(_sl12Value)
|
||||
#define sl12ToInt(_sl12Value) SCA_sl12_M_RealToInt(_sl12Value)
|
||||
|
||||
/* Operations */
|
||||
#define sl_Add(_slOp1,_slOp2) SCA_sl_M_slAdd(_slOp1,_slOp2)
|
||||
#define sl_Sub(_slOp1,_slOp2) SCA_sl_M_slSub(_slOp1,_slOp2)
|
||||
#define sl_Mul(_slOp1,_slOp2) SCA_sl_M_slMul(_slOp1,_slOp2)
|
||||
#define sl_Div(_slOp1,_slOp2) SCA_sl_M_slDiv(_slOp1,_slOp2)
|
||||
|
||||
#define sl_Inv(_slOp) SCA_sl_M_slInv(_slOp)
|
||||
#define sl_Neg(_slOp) SCA_sl_M_slNeg(_slOp)
|
||||
#define sl_Sqr(_slOp) sl_Mul(_slOp,_slOp)
|
||||
#define sl_Cub(_slOp) sl_Mul(_slOp,sl_Sqr(_slOp))
|
||||
#define sl_Sqrt(_slOp) SCA_sl_M_slSqrt(_slOp)
|
||||
#define sl_Abs(_slOp) SCA_sl_M_slAbs(_slOp)
|
||||
#define sl_Add3(a,b,c) SCA_sl_M_slAdd3(a,b,c)
|
||||
|
||||
#define sl_Sin(_slOp) SCA_sl_M_slSin(_slOp)
|
||||
#define sl_Cos(_slOp) SCA_sl_M_slCos(_slOp)
|
||||
#define sl_Tan(_slOp) SCA_sl_M_slTan(_slOp)
|
||||
|
||||
#define sl_ASin(_slOp) SCA_sl_M_slASin(_slOp)
|
||||
#define sl_ACos(_slOp) SCA_sl_M_slACos(_slOp)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
70
Rayman_X/cpa/public/MTH/Specif/SCA/sl12.h
Normal file
70
Rayman_X/cpa/public/MTH/Specif/SCA/sl12.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : sl12.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 15:58----------------------------
|
||||
* Conversion : useless (avec version 23.04.98 19:58 (2667))
|
||||
* -----------------------------------------------------------*/
|
||||
|
||||
#ifndef _SL12_H_
|
||||
#define _SL12_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sl12.h"
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* Define the type DNM_tdxReal */
|
||||
#define td_sl12 SCA_td_sl12
|
||||
|
||||
/* Constants */
|
||||
#define sl12_ZERO SCA_sl12_C_ZERO
|
||||
#define sl12_ONE SCA_sl12_C_ONE
|
||||
|
||||
/* Conversions : Macros definitions */
|
||||
#define DoubleTosl12(_dfValue) SCA_sl12_M_sl12DoubleToReal(_dfValue)
|
||||
#define FloatTosl12(_fValue) SCA_sl12_M_sl12FloatToReal(_fValue)
|
||||
#define IntTosl12(_iValue) SCA_sl12_M_sl12IntToReal(_iValue)
|
||||
|
||||
#define sl12ToDouble(_sl12Value) SCA_sl12_M_RealToDouble(_sl12Value)
|
||||
#define sl12ToFloat(_sl12Value) SCA_sl12_M_RealToFloat(_sl12Value)
|
||||
#define sl12ToInt(_sl12Value) SCA_sl12_M_RealToInt(_sl12Value)
|
||||
|
||||
/* Comparisons */
|
||||
#define sl12_bGreater(_sl12Op1,_sl12Op2) SCA_sl12_M_bGreater(_sl12Op1,_sl12Op2)
|
||||
#define sl12_bGreaterEqual(_sl12Op1,_sl12Op2) SCA_sl12_M_bGreaterEqual(_sl12Op1,_sl12Op2)
|
||||
#define sl12_bLess(_sl12Op1,_sl12Op2) SCA_sl12_M_bLess(_sl12Op1,_sl12Op2)
|
||||
#define sl12_bLessEqual(_sl12Op1,_sl12Op2) SCA_sl12_M_bLessEqual(_sl12Op1,_sl12Op2)
|
||||
#define sl12_bEqual(_sl12Op1,_sl12Op2) SCA_sl12_M_bEqual(_sl12Op1,_sl12Op2)
|
||||
#define sl12_bDiferent(_sl12Op1,_sl12Op2) SCA_sl12_M_bDifferent(_sl12Op1,_sl12Op2)
|
||||
#define sl12_bEqualZero(_sl12Op1) SCA_sl12_M_bIsNull(_sl12Op1)
|
||||
#define sl12_bIsNull(_sl12Op1) SCA_sl12_M_bIsNull(_sl12Op1)
|
||||
#define sl12_bInUnitEqual( x ) MTH_M_bInUnitEqual(x)
|
||||
|
||||
/* Operations */
|
||||
#define sl12_Add(_sl12Op1,_sl12Op2) SCA_sl12_M_sl12Add(_sl12Op1,_sl12Op2)
|
||||
#define sl12_Sub(_sl12Op1,_sl12Op2) SCA_sl12_M_sl12Sub(_sl12Op1,_sl12Op2)
|
||||
#define sl12_Mul(_sl12Op1,_sl12Op2) SCA_sl12_M_sl12Mul(_sl12Op1,_sl12Op2)
|
||||
#define sl12_Div(_sl12Op1,_sl12Op2) SCA_sl12_M_sl12Div(_sl12Op1,_sl12Op2)
|
||||
|
||||
#define sl12_Inv(_sl12Op) SCA_sl12_M_sl12Inv(_sl12Op)
|
||||
#define sl12_Neg(_sl12Op) SCA_sl12_M_sl12Neg(_sl12Op)
|
||||
#define sl12_Sqr(_sl12Op) SCA_sl12_M_sl12Sqr(_sl12Op)
|
||||
#define sl12_Cub(_sl12Op) sl12_Mul(_sl12Op,sl12_Sqr(_sl12Op))
|
||||
#define sl12_Sqrt(_sl12Op) SCA_sl12_M_sl12Sqrt(_sl12Op)
|
||||
#define sl12_Abs(_sl12Op) SCA_sl12_M_sl12Abs(_sl12Op)
|
||||
|
||||
#define sl12_Sin(_sl12Op) SCA_sl12_M_sl12Sin(_sl12Op)
|
||||
#define sl12_Cos(_sl12Op) SCA_sl12_M_sl12Cos(_sl12Op)
|
||||
#define sl12_Tan(_sl12Op) SCA_sl12_M_sl12Tan(_sl12Op)
|
||||
|
||||
#define sl12_ASin(_sl12Op) SCA_sl12_M_sl12ASin(_sl12Op)
|
||||
#define sl12_ACos(_sl12Op) SCA_sl12_M_sl12ACos(_sl12Op)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SL12_H_ */
|
64
Rayman_X/cpa/public/MTH/Specif/SCA/sw.h
Normal file
64
Rayman_X/cpa/public/MTH/Specif/SCA/sw.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : sw.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 15:58-------------------
|
||||
* Conversion : useless (avec version 23.04.98 19:58 (2066))
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef _SW_H_
|
||||
#define _SW_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sw.h"
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* Define the type DNM_tdxReal */
|
||||
#define td_sw SCA_td_sw
|
||||
|
||||
/* Constants */
|
||||
#define sw_ZERO SCA_sw_C_ZERO
|
||||
#define sw_ONE SCA_sw_C_ONE
|
||||
#define sw_TWO 8192
|
||||
|
||||
/* Comparisons */
|
||||
#define sw_bGreater(_swOp1,_swOp2) SCA_sw_M_bGreater(_swOp1,_swOp2)
|
||||
#define sw_bGreaterEqual(_swOp1,_swOp2) SCA_sw_M_bGreaterEqual(_swOp1,_swOp2)
|
||||
#define sw_bLess(_swOp1,_swOp2) SCA_sw_M_bLess(_swOp1,_swOp2)
|
||||
#define sw_bLessEqual(_swOp1,_swOp2) SCA_sw_M_bLessEqual(_swOp1,_swOp2)
|
||||
#define sw_bEqual(_swOp1,_swOp2) SCA_sw_M_bEqual(_swOp1,_swOp2)
|
||||
#define sw_bDiferent(_swOp1,_swOp2) SCA_sw_M_bDifferent(_swOp1,_swOp2)
|
||||
#define sw_bIsNull(_swOp) SCA_sw_M_bIsNull(_swOp)
|
||||
#define sw_bGreaterZero( A ) sw_bGreater( (A), sw_ZERO )
|
||||
#define sw_bGreaterEqualZero( A ) sw_bGreaterEqual( (A), sw_ZERO )
|
||||
#define sw_bLessZero( A ) sw_bLess( (A), sw_ZERO )
|
||||
#define sw_bLessEqualZero( A ) sw_bLessEqual( (A), sw_ZERO )
|
||||
|
||||
/* Operations */
|
||||
#define sw_Add(_swOp1,_swOp2) SCA_sw_M_swAdd(_swOp1,_swOp2)
|
||||
#define sw_Sub(_swOp1,_swOp2) SCA_sw_M_swSub(_swOp1,_swOp2)
|
||||
#define sw_Mul(_swOp1,_swOp2) SCA_sw_M_swMul(_swOp1,_swOp2)
|
||||
#define sw_Div(_swOp1,_swOp2) SCA_sw_M_swDiv(_swOp1,_swOp2)
|
||||
|
||||
#define sw_Inv(_swOp) SCA_sw_M_swInv(_swOp)
|
||||
#define sw_Neg(_swOp) SCA_sw_M_swNeg(_swOp)
|
||||
#define sw_Sqr(_swOp) SCA_sw_M_swSqr(_swOp)
|
||||
#define sw_Cub(_swOp) sw_Mul(_swOp,sw_Sqr(_swOp))
|
||||
#define sw_Sqrt(_swOp) SCA_sw_M_swSqrt(_swOp)
|
||||
#define sw_Abs(_swOp) SCA_sw_M_swAbs(_swOp)
|
||||
|
||||
#define sw_Sin(_swOp) SCA_sw_M_swSin(_swOp)
|
||||
#define sw_Cos(_swOp) SCA_sw_M_swCos(_swOp)
|
||||
#define sw_Tan(_swOp) SCA_sw_M_swTan(_swOp)
|
||||
|
||||
#define sw_ASin(_swOp) SCA_sw_M_swASin(_swOp)
|
||||
#define sw_ACos(_swOp) SCA_sw_M_swACos(_swOp)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SW_H_ */
|
62
Rayman_X/cpa/public/MTH/Specif/SCA/sw12.h
Normal file
62
Rayman_X/cpa/public/MTH/Specif/SCA/sw12.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* Filename : sw12.h */
|
||||
/* Author : Frederic Philippe */
|
||||
/* : Marc Trabucato */
|
||||
/* Target : PC */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* -----------------15/04/98 15:58-------------------
|
||||
* Conversion : OK (avec version 24.08.98 16:46 (2231))
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef _SW12_H_
|
||||
#define _SW12_H_
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sw12.h"
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/* Define the type DNM_tdxReal */
|
||||
#define td_sw12 SCA_td_sw12
|
||||
|
||||
/* Constants */
|
||||
#define sw12_ZERO SCA_sw12_C_ZERO
|
||||
#define sw12_ONE SCA_sw12_C_ONE
|
||||
|
||||
/* Comparisons */
|
||||
#define sw12_bGreater(_sw12Op1,_sw12Op2) SCA_sw12_M_bGreater(_sw12Op1,_sw12Op2)
|
||||
#define sw12_bGreaterEqual(_sw12Op1,_sw12Op2) SCA_sw12_M_bGreaterEqual(_sw12Op1,_sw12Op2)
|
||||
#define sw12_bLess(_sw12Op1,_sw12Op2) SCA_sw12_M_bLess(_sw12Op1,_sw12Op2)
|
||||
#define sw12_bLessEqual(_sw12Op1,_sw12Op2) SCA_sw12_M_bLessEqual(_sw12Op1,_sw12Op2)
|
||||
#define sw12_bEqual(_sw12Op1,_sw12Op2) SCA_sw12_M_bEqual(_sw12Op1,_sw12Op2)
|
||||
#define sw12_bDiferent(_sw12Op1,_sw12Op2) SCA_sw12_M_bDifferent(_sw12Op1,_sw12Op2)
|
||||
#define sw12_bIsNull(_sw12Op1,_sw12Op2) SCA_sw12_M_bIsNull(_sw12Op1,_sw12Op2)
|
||||
|
||||
/* Operations */
|
||||
#define sw12_Add(_sw12Op1,_sw12Op2) SCA_sw12_M_sw12Add(_sw12Op1,_sw12Op2)
|
||||
#define sw12_Sub(_sw12Op1,_sw12Op2) SCA_sw12_M_sw12Sub(_sw12Op1,_sw12Op2)
|
||||
#define sw12_Mul(_sw12Op1,_sw12Op2) SCA_sw12_M_sw12Mul(_sw12Op1,_sw12Op2)
|
||||
#define sw12_Div(_sw12Op1,_sw12Op2) SCA_sw12_M_sw12Div(_sw12Op1,_sw12Op2)
|
||||
|
||||
#define sw12_Add3(_sw12Op1,_sw12Op2,_sw12Op3) sw12_Add(_sw12Op1,sw12_Add(_sw12Op2,_sw12Op3))
|
||||
#define sw12_Mul3(_sw12Op1,_sw12Op2,_sw12Op3) sw12_Mul(_sw12Op1,sw12_Mul(_sw12Op2,_sw12Op3))
|
||||
|
||||
#define sw12_Inv(_sw12Op) SCA_sw12_M_sw12Inv(_sw12Op)
|
||||
#define sw12_Neg(_sw12Op) SCA_sw12_M_sw12Neg(_sw12Op)
|
||||
#define sw12_Sqr(_sw12Op) SCA_sw12_M_sw12Sqr(_sw12Op)
|
||||
#define sw12_Cub(_sw12Op) sw12_Mul(_sw12Op,sw12_Sqr(_sw12Op))
|
||||
#define sw12_Sqrt(_sw12Op) SCA_sw12_M_sw12Sqrt(_sw12Op)
|
||||
#define sw12_Abs(_sw12Op) SCA_sw12_M_sw12Abs(_sw12Op)
|
||||
|
||||
#define sw12_Sin(_sw12Op) SCA_sw12_M_sw12Sin(_sw12Op)
|
||||
#define sw12_Cos(_sw12Op) SCA_sw12_M_sw12Cos(_sw12Op)
|
||||
#define sw12_Tan(_sw12Op) SCA_sw12_M_sw12Tan(_sw12Op)
|
||||
|
||||
#define sw12_ASin(_sw12Op) SCA_sw12_M_sw12ASin(_sw12Op)
|
||||
#define sw12_ACos(_sw12Op) SCA_sw12_M_sw12ACos(_sw12Op)
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SW12_H_ */
|
323
Rayman_X/cpa/public/MTH/Specif/VEC/3D_conv.h
Normal file
323
Rayman_X/cpa/public/MTH/Specif/VEC/3D_conv.h
Normal file
@@ -0,0 +1,323 @@
|
||||
/*--------------------------------*/
|
||||
/* Conversion of numericals types */
|
||||
/*--------------------------------*/
|
||||
/* Version 1.0 */
|
||||
/* Author : S Leroy */
|
||||
/* Date : 5/03/98 */
|
||||
/* Modification : 9/03/98 */
|
||||
/*--------------------------------*/
|
||||
/* PC Version by M Trabucato */
|
||||
/*--------------------------------*/
|
||||
/* Conversion : OK (avec version 27.04.98 11:35 (22582) */
|
||||
/*--------------------------------*/
|
||||
|
||||
#ifndef _3DCONV_H_
|
||||
#define _3DCONV_H_
|
||||
|
||||
#include "MTH\Specif\VEC\sl12_3D.h"
|
||||
#include "MTH\Specif\VEC\sl_3D.h"
|
||||
#include "MTH\Specif\VEC\sw12_3D.h"
|
||||
#include "MTH\Specif\VEC\sw_3D.h"
|
||||
#include "MTH\Specif\SCA\converse.h"
|
||||
|
||||
/*--------------------------------------*/
|
||||
/* 2D Vector Outer Product */
|
||||
/*--------------------------------------*/
|
||||
__inline SCA_td_sl sl_fn_2DOuterProduct(
|
||||
SCA_td_sl x0,
|
||||
SCA_td_sl y0,
|
||||
SCA_td_sl x1,
|
||||
SCA_td_sl y1,
|
||||
SCA_td_sl x2,
|
||||
SCA_td_sl y2
|
||||
)
|
||||
{
|
||||
return MTH_M_xAdd3( MTH_M_xMul( x0 , MTH_M_xSub( y1 , y2 ) ) ,
|
||||
MTH_M_xMul( x1 , MTH_M_xSub( y2 , y0 ) ) ,
|
||||
MTH_M_xMul( x2 , MTH_M_xSub( y0 , y1 ) ) );
|
||||
}
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Vector Conversion */
|
||||
/*--------------------------------------------*/
|
||||
/* Vector Normalisation */
|
||||
__inline sw12_3D_tdstVector * VEC_p_sw12_3DNormalise_sl3D(
|
||||
sw12_3D_tdstVector * _p_stsw12_3D_Dest,
|
||||
sw12_3D_tdstVector * _p_stsl3_DSrc
|
||||
)
|
||||
{
|
||||
MTH3D_M_vNormalizeVector(_p_stsw12_3D_Dest,_p_stsl3_DSrc);
|
||||
return _p_stsw12_3D_Dest;
|
||||
}
|
||||
|
||||
/*------------------------------*/
|
||||
/* sw12_3D <- Normalise (sl_3D) */
|
||||
/*------------------------------*/
|
||||
__inline sw12_3D_tdstVector * VEC_p_sw12_3DNormalize_sw3D(
|
||||
sw12_3D_tdstVector * _p_stsw12_3D_Dest,
|
||||
sw_3D_tdstVector * _p_stsw_3DSrc
|
||||
)
|
||||
{
|
||||
MTH3D_M_vNormalizeVector(_p_stsw12_3D_Dest,_p_stsw_3DSrc);
|
||||
return _p_stsw12_3D_Dest;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------*/
|
||||
/* sw12_3D <- Normalise (sl12_3D) */
|
||||
/*--------------------------------*/
|
||||
__inline sw12_3D_tdstVector * VEC_p_sw12_3DNormalize_sl123D(
|
||||
sw12_3D_tdstVector * _p_stsw12_3D_Dest,
|
||||
sl12_3D_tdstVector * _p_stsl12_3DSrc
|
||||
)
|
||||
{
|
||||
MTH3D_M_vNormalizeVector(_p_stsw12_3D_Dest,_p_stsl12_3DSrc);
|
||||
return _p_stsw12_3D_Dest;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------*/
|
||||
/* Vector Normalisation functions */
|
||||
/*--------------------------------*/
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssl(VectDest, VectA) VEC_p_sw12_3DNormalize_sl3D(VectDest, VectA)
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssl12(VectDest, VectA) VEC_p_sw12_3DNormalize_sl123D(VectDest, VectA)
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssw(VectDest, VectA) VEC_p_sw12_3DNormalize_sw3D(VectDest, VectA)
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssw12(VectDest, VectA) VEC_p_sw12_3DNormalize_sw3D(VectDest, VectA)
|
||||
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Vector Conversion */
|
||||
/*--------------------------------------------*/
|
||||
/* Conversion sw3D in sl3D */
|
||||
__inline sl_3D_tdstVector * VEC_p_sw3DConverse_sw3DTosl3D(
|
||||
sl_3D_tdstVector * _p_stsl3DDest,
|
||||
sw_3D_tdstVector * _p_stsw3DSrc
|
||||
)
|
||||
{
|
||||
MTH3D_M_vCopyVector(_p_stsl3DDest,_p_stsw3DSrc);
|
||||
return _p_stsl3DDest;
|
||||
}
|
||||
|
||||
/* Conversion sl3D in sw3D */
|
||||
__inline sw_3D_tdstVector * VEC_p_sw3DConverse_sl3DTosw3D(
|
||||
sw_3D_tdstVector * _p_stsw3DDest,
|
||||
sl_3D_tdstVector * _p_stsl3DSrc
|
||||
)
|
||||
{
|
||||
MTH3D_M_vCopyVector(_p_stsw3DDest,_p_stsl3DSrc);
|
||||
return _p_stsw3DDest;
|
||||
}
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Vector/Matrix Multiplication */
|
||||
/*--------------------------------------------*/
|
||||
/* Specific functions */
|
||||
/* PC OK */
|
||||
__inline void sw12_3D_fn_vMulMatrixVector_Dsl_SswWithoutBuffer(
|
||||
sl_3D_tdstVector * p_VectDest,
|
||||
sw12_3D_tdstMatrix * p_MatA,
|
||||
sw_3D_tdstVector * p_VectA)
|
||||
{
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer(p_VectDest,p_MatA,p_VectA);
|
||||
}
|
||||
|
||||
/* Explicit name */
|
||||
/* To be optimzed of course */
|
||||
/* PC OK */
|
||||
__inline void sw12_3D_fn_vMulMatrixSw12Vector_Dsl_Ssl(
|
||||
sl_3D_tdstVector * p_VectDest,
|
||||
sw12_3D_tdstMatrix * p_MatA,
|
||||
sl_3D_tdstVector * p_VectA)
|
||||
|
||||
{
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer(p_VectDest,p_MatA,p_VectA);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
/* Mul Add Vector */
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------*/
|
||||
/* sw_3D_M_vMulAddVector( sw_3D, sl12, sw_3D, sw_3D) sw_3D = sl12*sw_3D + sw_3D */
|
||||
/*--------------------------------------------------------------------------------*/
|
||||
/* PC OK */
|
||||
__inline void sw_3D_fn_vMulAddVector_sw3D_sl12_sw3D_sw_3D(
|
||||
sw_3D_tdstVector * _p_stswVectorResult,
|
||||
td_sl12 _sl12_scalar,
|
||||
sw_3D_tdstVector * _p_stswVectorA,
|
||||
sw_3D_tdstVector * _p_stswVectorB
|
||||
)
|
||||
{
|
||||
MTH3D_M_vMulScalarVector( _p_stswVectorResult, _sl12_scalar, _p_stswVectorA);
|
||||
MTH3D_M_vAddVector( _p_stswVectorResult, _p_stswVectorResult, _p_stswVectorB);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* sl_3D_M_vMulAddVector : sl_3D <- sw * sw12_3D + sl_3D */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
__inline void sl_3D_fn_vMulAddVector_sl3D_sw_sw123D_sl3D(
|
||||
sl_3D_tdstVector * _p_stslVectorResult,
|
||||
td_sw _sw_scalar,
|
||||
sw12_3D_tdstVector * _p_stsw12VectorA,
|
||||
sl_3D_tdstVector * _p_stslVectorB
|
||||
)
|
||||
{
|
||||
MTH3D_M_vMulScalarVector( _p_stslVectorResult, _sw_scalar, _p_stsw12VectorA);
|
||||
MTH3D_M_vAddVector( _p_stslVectorResult, _p_stslVectorResult, _p_stslVectorB);
|
||||
}
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* sl_3D_M_vMulAddVector : sl_3D <- sw12 * sw_3D + sl_3D */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
#define sl_3D_M_vMulAddVector_sl3D_sw12_sw3D_sl3D( _p_sl_3DResult, _sw12, _p_sw_3D, _p_sl_3D) \
|
||||
{ \
|
||||
MTH3D_M_vMulScalarVector( _p_sl_3DResult, _sw12, _p_sw_3D); \
|
||||
MTH3D_M_vAddVector( _p_sl_3DResult, _p_sl_3DResult, _p_sl_3D); \
|
||||
}
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* sl_3D_M_vMulAddVector : sw_3D <- sw * sw12_3D + sw_3D */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
#define sw_3D_M_vMulAddVector_sw3D_sw_sw123D_sw3D( _p_sw_3DResult, _sw, _p_sw12_3D, _p_sw_3D) \
|
||||
{ \
|
||||
MTH3D_M_vMulScalarVector( _p_sw_3DResult, _sw, _p_sw12_3D); \
|
||||
MTH3D_M_vAddVector( _p_sw_3DResult, _p_sw_3DResult, _p_sw_3D); \
|
||||
}
|
||||
|
||||
#define sl_3D_M_vMulAddVector_sl3D_sw_sw123D_sl3D( sl_3DResult, sw, sw12_3D, sl_3D) sl_3D_fn_vMulAddVector_sl3D_sw_sw123D_sl3D( sl_3DResult, sw, sw12_3D, sl_3D)
|
||||
#define sw_3D_M_vMulAddVector_sw3D_sl12_sw3D_sw3D( sw_3DResult, sl12, sw_3D_1, sw_3D_2) sw_3D_fn_vMulAddVector_sw3D_sl12_sw3D_sw3D( sw_3DResult, sl12, sw_3D_1, sw_3D_2)
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
/* Dot Products */
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
/*----------------------------------------------*/
|
||||
/* sw_3D_M_xDotProductVector ( sw_3D, sw12_3D ) */
|
||||
/*----------------------------------------------*/
|
||||
/* PC OK */
|
||||
__inline td_sl VEC_3D_fn_sl_DotProductVector_sw_sw(
|
||||
sw_3D_tdstVector * _p_stswVectorA,
|
||||
sw_3D_tdstVector * _p_stswVectorB
|
||||
)
|
||||
{
|
||||
return MTH3D_M_xDotProductVector(_p_stswVectorA,_p_stswVectorB);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* sw_3D_M_sw_DotProductVector_sw_sw12 ( sw_3D, sw12_3D ) */
|
||||
/*--------------------------------------------------------*/
|
||||
__inline td_sw VEC_3D_fn_sw_DotProductVector_sw_sw12(
|
||||
sw_3D_tdstVector * _p_stswVector,
|
||||
sw12_3D_tdstVector * _p_stsw12Vector
|
||||
)
|
||||
{
|
||||
return MTH3D_M_xDotProductVector(_p_stswVector,_p_stsw12Vector);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------*/
|
||||
/* sw_3D_M_sl_DotProductVector_sl_sw12 ( sl_3D, sw12_3D ) */
|
||||
/*--------------------------------------------------------*/
|
||||
__inline td_sl VEC_3D_fn_sl_DotProductVector_sl_sw12(
|
||||
sl_3D_tdstVector * _p_stslVector,
|
||||
sw12_3D_tdstVector * _p_stsw12Vector
|
||||
)
|
||||
{
|
||||
return MTH3D_M_xDotProductVector(_p_stslVector,_p_stsw12Vector);
|
||||
}
|
||||
|
||||
#define VEC_3D_M_sl_DotProductVector_sw_sw( sw_3D_1, sw_3D_2 ) VEC_3D_fn_sl_DotProductVector_sw_sw( sw_3D_1, sw_3D_2 )
|
||||
#define VEC_3D_M_sw_DotProductVector_sw_sw12( sw_3D, sw12_3D ) VEC_3D_fn_sw_DotProductVector_sw_sw12( sw_3D, sw12_3D )
|
||||
#define VEC_3D_M_sl_DotProductVector_sl_sw12( sl_3D, sw12_3D ) VEC_3D_fn_sl_DotProductVector_sl_sw12( sl_3D, sw12_3D )
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* Mul Scalar Vector */
|
||||
/*------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------*/
|
||||
/* MulScalar sw_3D <- sl12 * sw_3D */
|
||||
/*----------------------------------------------*/
|
||||
/* PC OK */
|
||||
__inline sw_3D_tdstVector * sw_3D_fn_MulScalarVector_sl12_Sw3D
|
||||
(
|
||||
sw_3D_tdstVector * _p_stswVectorResult,
|
||||
td_sl12 _p_s12Scalar,
|
||||
sw_3D_tdstVector * _p_stswVector
|
||||
)
|
||||
{
|
||||
MTH3D_M_vMulScalarVector( _p_stswVectorResult, _p_s12Scalar, _p_stswVector);
|
||||
|
||||
return _p_stswVectorResult;
|
||||
}
|
||||
|
||||
/*----------------------------------------------*/
|
||||
/* MulScalar sw_3D <- sw * sw12_3D */
|
||||
/*----------------------------------------------*/
|
||||
__inline sw_3D_tdstVector * sw_3D_fn_MulScalarVector_sw_sw123D
|
||||
(
|
||||
sw_3D_tdstVector * _p_stswVectorResult,
|
||||
td_sw swScalar,
|
||||
sw12_3D_tdstVector * _p_stsw12Vector
|
||||
)
|
||||
{
|
||||
MTH3D_M_vMulScalarVector( _p_stswVectorResult, swScalar, _p_stsw12Vector);
|
||||
|
||||
return _p_stswVectorResult;
|
||||
}
|
||||
|
||||
#define sw_3D_M_MulScalarVector_sw_sw123D(Vectd,a,VectA) sw_3D_fn_MulScalarVector_sw_sw123D(Vectd,a,VectA)
|
||||
#define sw_3D_M_MulScalarVector_sl12_sw3D(Vectd,a,VectA) sw_3D_fn_MulScalarVector_sl12_sw3D(Vectd,a,VectA)
|
||||
/*------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* Div Vector Scalar */
|
||||
/*------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*-----------------------*/
|
||||
/* sw12_3D <- sw_3D / sw */
|
||||
/*-----------------------*/
|
||||
__inline sw12_3D_tdstVector * sw12_3D_fn_VectorDivScalar_sw3D_sw
|
||||
(
|
||||
sw12_3D_tdstVector * _p_stsw12VectorResult,
|
||||
sw_3D_tdstVector * _p_stswVector,
|
||||
td_sw swScalar
|
||||
)
|
||||
{
|
||||
MTH3D_M_vDivScalarVector( _p_stsw12VectorResult, _p_stswVector, swScalar);
|
||||
|
||||
return _p_stsw12VectorResult;
|
||||
}
|
||||
#define sw12_3D_M_VectorDivScalar_sw3D_sw(Vectd,Vecta,a) sw12_3D_fn_VectorDivScalar_sw3D_sw(Vectd,Vecta,a)
|
||||
/*------------------------------------------------------------*/
|
||||
/* Square norm of a vector */
|
||||
/*------------------------------------------------------------*/
|
||||
__inline td_sl sw_3D_fn_sl_SqrVector(
|
||||
sw_3D_tdstVector * _p_stswVectorA
|
||||
)
|
||||
{
|
||||
return MTH3D_M_xSqrVector(_p_stswVectorA);
|
||||
}
|
||||
#define sw_3D_M_sl_SqrVector_sw(VectA) sw_3D_fn_sl_SqrVector(VectA)
|
||||
/*--------------------------------*/
|
||||
/* Vector Normalisation functions */
|
||||
/*--------------------------------*/
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssl(VectDest, VectA) VEC_p_sw12_3DNormalize_sl3D(VectDest, VectA)
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssl12(VectDest, VectA) VEC_p_sw12_3DNormalize_sl123D(VectDest, VectA)
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssw(VectDest, VectA) VEC_p_sw12_3DNormalize_sw3D(VectDest, VectA)
|
||||
#define sw12_3D_vNormalizeVector_Dsw12_Ssw12(VectDest, VectA) VEC_p_sw12_3DNormalize_sw3D(VectDest, VectA)
|
||||
/*---------------------------------------------*/
|
||||
/* sl <- sl_3D_M_slVectorGapSqr (sw_3D, sw_3D) */
|
||||
/*---------------------------------------------*/
|
||||
#define sl_3D_M_slVectorGapSqr_sw3D_sw3D(VectA, VectB) MTH3D_M_xVectorGapSqr(VectA, VectB)
|
||||
|
||||
/*-----------------------------------------------------*/
|
||||
/* ul <- VEC_M_ulVectorGapSqr_sl3D_sl3D (sl_3D, sl_3D) */
|
||||
/*-----------------------------------------------------*/
|
||||
__inline unsigned long VEC_fn_ulVectorGapSqr_sl3D_sl3D(
|
||||
sl_3D_tdstVector *_p_stsl3D_A,
|
||||
sl_3D_tdstVector *_p_stsl3D_B
|
||||
)
|
||||
{
|
||||
return MTH_M_xRealToLong(MTH3D_M_xVectorGapSqr(_p_stsl3D_A, _p_stsl3D_B));
|
||||
}
|
||||
|
||||
#define VEC_M_ulVectorGapSqr_sl3D_sl3D(sl_3D_1, sl_3D_2) VEC_fn_ulVectorGapSqr_sl3D_sl3D(sl_3D_1, sl_3D_2)
|
||||
|
||||
/* Macro definitions */
|
||||
#define sw12_3D_M_vMulMatrixSw12Vector_Dsw_Ssl( VectDest, MatA, VectA) sw12_3D_fn_vMulMatrixSw12Vector_Dsl_Ssl( VectDest, MatA, VectA)
|
||||
#define sw12_3D_M_vMulMatrixVector_Dsl_SswWithoutBuffer( VectDest, MatA, VectA) sw12_3D_fn_vMulMatrixVector_Dsl_SswWithoutBuffer( VectDest, MatA, VectA)
|
||||
#define Conv_sl3DTosw3D(_p_stsl3D,_p_stsw3D) VEC_p_sw3DConverse_sl3DTosw3D(_p_stsl3D,_p_stsw3D)
|
||||
#define Conv_sw3DTosl3D(_p_stsw3D,_p_stsl3D) VEC_p_sw3DConverse_sw3DTosl3D(_p_stsw3D,_p_stsl3D)
|
||||
|
||||
#endif
|
439
Rayman_X/cpa/public/MTH/Specif/VEC/sl12_3D.h
Normal file
439
Rayman_X/cpa/public/MTH/Specif/VEC/sl12_3D.h
Normal file
@@ -0,0 +1,439 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : sl12_3D.h
|
||||
MODULE : sl12 (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vectorial implementation
|
||||
|
||||
VERSION : sl12 V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------15/04/98 18:36-------------------
|
||||
* Conversion : OK avec version 23.04.98 19:58 31153
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#ifndef _SCA_sl12_3D_H_
|
||||
#define _SCA_sl12_3D_H_
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sl12.h"
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* 3D Vector : */
|
||||
/*
|
||||
#if 0
|
||||
|
||||
typedef VECTOR sl12_3D_tdstVector;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct sl12_3D_tdstVector_
|
||||
{
|
||||
SCA_td_sl12 xX;
|
||||
SCA_td_sl12 xY;
|
||||
SCA_td_sl12 xZ;
|
||||
SCA_td_sl12 pad;
|
||||
} sl12_3D_tdstVector;
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define sl12_3D_tdstVector MTH3D_tdstVector
|
||||
|
||||
|
||||
|
||||
/* 3D Matrix */
|
||||
/*
|
||||
typedef struct sl12_3D_tdstMatrix_
|
||||
{
|
||||
sl12_3D_tdstVector stCol_0;
|
||||
sl12_3D_tdstVector stCol_1;
|
||||
sl12_3D_tdstVector stCol_2;
|
||||
|
||||
} sl12_3D_tdstMatrix;
|
||||
*/
|
||||
|
||||
#define sl12_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Vector Operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vAddVector
|
||||
DESCRIPTION : Add two vectors : VectDest= VectA + VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vAddVector( VectDest, VectA, VectB) MTH3D_M_vAddVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSubVector
|
||||
DESCRIPTION : Sub two vectors : VectDest= VectA - VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSubVector( VectDest, VectA, VectB) MTH3D_M_vSubVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vNegVector
|
||||
DESCRIPTION : Negation of a vector : VectDest= - VectA
|
||||
INPUT : VectDest, VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vNegVector( VectDest, VectA) MTH3D_M_vNegVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_bEqualVector
|
||||
DESCRIPTION : Test if two vectors are equal
|
||||
INPUT : VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : VectA==VectB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_bEqualVector( VectA, VectB) MTH3D_M_bEqualVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vAddScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= a.Id + VectA
|
||||
INPUT : VectDest: address of sl12_3D_tdstVector,
|
||||
a: SCA_td_sl12, VectA: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vAddScalarVector( VectDest, a, VectA) MTH3D_M_vAddScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSubScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= VectA - a.Id
|
||||
INPUT : VectDest: address of sl12_3D_tdstVector,
|
||||
a: SCA_td_sl12, VectA: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSubScalarVector( VectDest, a, VectA) MTH3D_M_vSubScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulScalarVector
|
||||
DESCRIPTION : Multiplicate a scalare with a vector : VectDest= a*VectA
|
||||
INPUT : VectDest: address of sl12_3D_tdstVector,
|
||||
a: SCA_td_sl12, VectA: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulScalarVector( VectDest, a, VectA) MTH3D_M_vMulScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vDivScalarVector
|
||||
DESCRIPTION : Divide a vector by a scalare : VectDest= VectA/a
|
||||
INPUT : VectDest, VectA: address of sl12_3D_tdstVector, a: SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vDivScalarVector( VectDest, VectA, a) MTH3D_M_vDivScalarVector( VectDest, VectA, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xDotProductVector
|
||||
DESCRIPTION : Return the Dot Product of two vectors
|
||||
INPUT : VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : VectA.VectB : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xDotProductVector( VectA, VectB) MTH3D_M_xDotProductVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vCrossProductVectorWithoutBuffer
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB,
|
||||
VectDest must be a other vector
|
||||
INPUT : VectDest, VectA, VectA: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_fn_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB) \
|
||||
MTH3D_M_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB)
|
||||
|
||||
#define sl12_3D_M_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB) \
|
||||
sl12_3D_fn_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB)
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vCrossProductVector
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB
|
||||
INPUT : VectDest, VectA, VectA: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vCrossProductVector(VectDest,VectA,VectB) MTH3D_M_vCrossProductVector(VectDest,VectA,VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xSqrVector
|
||||
DESCRIPTION : Return the square of a vector
|
||||
INPUT : VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : VectA.VectA : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xSqrVector( VectA) MTH3D_M_xSqrVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xNormVector
|
||||
DESCRIPTION : Return the norm of a vector
|
||||
INPUT : VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : ||VectA|| : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xNormVector( VectA ) MTH3D_M_xNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xInvNormVector
|
||||
DESCRIPTION : Return the inverse of the norm of a vector
|
||||
INPUT : VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : 1/||VectA|| : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xInvNormVector( VectA ) MTH3D_M_xInvNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xVectorGapSqr
|
||||
DESCRIPTION : Return the square Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : Sqr(||VectA-VectB||) : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xVectorGapSqr(VectA, VectB) MTH3D_M_xVectorGapSqr(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xVectorGap
|
||||
DESCRIPTION : Return the Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : ||VectA-VectB|| : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xVectorGap(VectA, VectB) MTH3D_M_xVectorGap(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vFillVector
|
||||
DESCRIPTION : Fill each vector element with a value
|
||||
INPUT : VectA: address of sl12_3D_tdstVector, a: SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vFillVector( VectDest, a) MTH3D_M_vFillVector( VectDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vNormalizeVector
|
||||
DESCRIPTION : Normalize a vector : VectDest= VectA/||VectA||
|
||||
INPUT : VectDest, VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
/* Cf 3D_Conv.h */
|
||||
/*#define sl12_3D_M_vNormalizeVector(VectDest, VectA) MTH3D_M_vNormalizeVector(VectDest, VectA)*/
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vGetVectorElements
|
||||
DESCRIPTION : Get x, y, z values of a vector
|
||||
INPUT : x, y, z : address of SCA_td_sl12, VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vGetVectorElements( Vx, Vy, Vz, VectA) MTH3D_M_vGetVectorElements( Vx, Vy, Vz, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetVectorElements
|
||||
DESCRIPTION : Set a vector with x, y, z values
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector, x, y, z : address of SCA_td_sl12,
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz) MTH3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xGetXofVector
|
||||
DESCRIPTION : Return x element of a vector
|
||||
INPUT : VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : x : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xGetXofVector( VectA ) MTH3D_M_xGetXofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetXofVector
|
||||
DESCRIPTION : Set x element of a vector
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector, Vx : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetXofVector( VectDest, Vx) MTH3D_M_vSetXofVector( VectDest, Vx)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xGetYofVector
|
||||
DESCRIPTION : Return y element of a vector
|
||||
INPUT : VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : y : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xGetYofVector( VectA ) MTH3D_M_xGetYofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetYofVector
|
||||
DESCRIPTION : Set y element of a vector
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector, Vy : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetYofVector( VectDest, Vy) MTH3D_M_vSetYofVector( VectDest, Vy)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xGetZofVector
|
||||
DESCRIPTION : Return z element of a vector
|
||||
INPUT : VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : z : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xGetZofVector( VectA ) MTH3D_M_xGetZofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetZofVector
|
||||
DESCRIPTION : Set z element of a vector
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector, Vz : SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetZofVector( VectDest, Vz) MTH3D_M_vSetZofVector( VectDest, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vCopyVector
|
||||
DESCRIPTION : Copy a vector : VectDest=VectA
|
||||
INPUT : VectDest, VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vCopyVector( VectDest, VectA) MTH3D_M_vCopyVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vNullVector
|
||||
DESCRIPTION : Set all elements of a vector to zero
|
||||
INPUT : VectDest : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vNullVector( VectDest) MTH3D_M_vNullVector( VectDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vScaleVector
|
||||
DESCRIPTION : Set each element of VectDest with the multiplication of element of VectA by element of VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vScaleVector( VectDest, VectA, VectB ) MTH3D_M_vScaleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMiddleVector
|
||||
DESCRIPTION : Calculate the middle of two vectors : VectDest= (VectA+VectB)/2
|
||||
INPUT : VectDest, VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMiddleVector( VectDest, VectA, VectB ) MTH3D_M_vMiddleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vLinearInterpolVector
|
||||
DESCRIPTION : Calculate the lineat interpolation of two vectors : VectDest= VectA + t.(VectB-VectA)
|
||||
INPUT : VectDest, VectA, VectB: address of sl12_3D_tdstVector, t: SCA_td_sl12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t) MTH3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMaxVector
|
||||
DESCRIPTION : Make a vector with max elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMaxVector( VectDest, VectA, VectB) MTH3D_M_vMaxVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMinVector
|
||||
DESCRIPTION : Make a vector with min elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMinVector( VectDest, VectA, VectB) MTH3D_M_vMinVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xDetxYVector
|
||||
DESCRIPTION : Return the 2D determinant between X and Y elements
|
||||
INPUT : VectA, VectB: address of sl12_3D_tdstVector
|
||||
OUTPUT : DetxY |VectA, VectB| : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xDetxYVector( VectA, VectB ) MTH3D_M_xDetxYVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xDetYZVector
|
||||
DESCRIPTION : Return the 2D determinant between Y and Z elements
|
||||
INPUT : VectA, VectB: address of sl12_3D_tdstVector
|
||||
OUTPUT : DetYZ |VectA, VectB| : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xDetYZVector( VectA, VectB ) MTH3D_M_xDetYZVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_xDetZXVector
|
||||
DESCRIPTION : Return the 2D determinant between Z and X elements
|
||||
INPUT : VectA, VectB: address of sl12_3D_tdstVector
|
||||
OUTPUT : DetZX |VectA, VectB| : SCA_td_sl12
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_xDetZXVector( VectA, VectB ) MTH3D_M_xDetZXVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_bIsNullVector
|
||||
DESCRIPTION : Test if a vector is null
|
||||
INPUT : VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : VectA==Null vector : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_bIsNullVector( VectA ) MTH3D_M_bIsNullVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vMulAddVector
|
||||
DESCRIPTION : Multiply a scalar to a vector, and add it to a other vector: VectDest = x.VectA + VectB
|
||||
INPUT : VectDest: address of sl12_3D_tdstVector,
|
||||
x: SCA_td_sl12, VectA, VectB : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vMulAddVector( VectDest, x, VectA, VectB) MTH3D_M_vMulAddVector( VectDest, x, VectA, VectB)
|
||||
|
||||
/* sl12_3D_M_vMullAddVector( VectDest, x, VectA, VectB) : VectDest = x.VectA + VectB */
|
||||
#define sl12_3D_M_vMullAddVector sl12_3D_M_vMulAddVector
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetBaseIVector
|
||||
DESCRIPTION : Set a vector to Ox base vector : VectDest = ( 1, 0, 0 )
|
||||
INPUT : VectDest: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetBaseIVector( VectDest ) MTH3D_M_vSetBaseIVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetBaseJVector
|
||||
DESCRIPTION : Set a vector to Oy base vector : VectDest = ( 0, 1, 0 )
|
||||
INPUT : VectDest: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetBaseJVector( VectDest ) MTH3D_M_vSetBaseJVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vSetBaseKVector
|
||||
DESCRIPTION : Set a vector to Oz base vector : VectDest = ( 0, 0, 1 )
|
||||
INPUT : VectDest: address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl12_3D_M_vSetBaseKVector( VectDest ) MTH3D_M_vSetBaseKVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl12_3D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sl12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf_sl12(td_sl12 _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
|
||||
__inline void sl12_3D_fn_vPrintfVector( char * Name, sl12_3D_tdstVector * VectA)
|
||||
{
|
||||
MTH3D_M_vPrintfVector( Name, VectA );
|
||||
}
|
||||
|
||||
#define sl12_3D_M_vPrintfVector( Name, VectA) sl12_3D_fn_vPrintfVector( Name, VectA)
|
||||
|
||||
|
||||
|
||||
#endif /* sl12_3D_H */
|
909
Rayman_X/cpa/public/MTH/Specif/VEC/sl_3D.h
Normal file
909
Rayman_X/cpa/public/MTH/Specif/VEC/sl_3D.h
Normal file
@@ -0,0 +1,909 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : sl_3D.h
|
||||
MODULE : sl (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vectorial implementation
|
||||
|
||||
VERSION : sl V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------15/04/98 18:36-------------------
|
||||
* Conversion : OK
|
||||
* --------------------------------------------------*/
|
||||
#ifndef _SCA_sl_3D_H_
|
||||
#define _SCA_sl_3D_H_
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sl.h"
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* 3D Vector : */
|
||||
/*
|
||||
#if 0
|
||||
|
||||
typedef VECTOR sl_3D_tdstVector;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct sl_3D_tdstVector_
|
||||
{
|
||||
SCA_td_sl xX;
|
||||
SCA_td_sl xY;
|
||||
SCA_td_sl xZ;
|
||||
SCA_td_sl pad;
|
||||
} sl_3D_tdstVector;
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define sl_3D_tdstVector MTH3D_tdstVector
|
||||
|
||||
|
||||
|
||||
/* 3D Matrix */
|
||||
/*
|
||||
typedef struct sl_3D_tdstMatrix_
|
||||
{
|
||||
sl_3D_tdstVector stCol_0;
|
||||
sl_3D_tdstVector stCol_1;
|
||||
sl_3D_tdstVector stCol_2;
|
||||
|
||||
} sl_3D_tdstMatrix;
|
||||
*/
|
||||
|
||||
#define sl_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Vector Operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vAddVector
|
||||
DESCRIPTION : Add two vectors : VectDest= VectA + VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vAddVector( VectDest, VectA, VectB) MTH3D_M_vAddVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSubVector
|
||||
DESCRIPTION : Sub two vectors : VectDest= VectA - VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSubVector( VectDest, VectA, VectB) MTH3D_M_vSubVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vNegVector
|
||||
DESCRIPTION : Negation of a vector : VectDest= - VectA
|
||||
INPUT : VectDest, VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vNegVector( VectDest, VectA) MTH3D_M_vNegVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_bEqualVector
|
||||
DESCRIPTION : Test if two vectors are equal
|
||||
INPUT : VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : VectA==VectB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_bEqualVector( VectA, VectB) MTH3D_M_bEqualVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vAddScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= a.Id + VectA
|
||||
INPUT : VectDest: address of sl_3D_tdstVector,
|
||||
a: SCA_td_sl, VectA: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vAddScalarVector( VectDest, a, VectA) MTH3D_M_vAddScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSubScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= VectA - a.Id
|
||||
INPUT : VectDest: address of sl_3D_tdstVector,
|
||||
a: SCA_td_sl, VectA: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSubScalarVector( VectDest, a, VectA) MTH3D_M_vSubScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulScalarVector
|
||||
DESCRIPTION : Multiplicate a scalare with a vector : VectDest= a*VectA
|
||||
INPUT : VectDest: address of sl_3D_tdstVector,
|
||||
a: SCA_td_sl, VectA: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulScalarVector( VectDest, a, VectA) MTH3D_M_vMulScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vDivScalarVector
|
||||
DESCRIPTION : Divide a vector by a scalare : VectDest= VectA/a
|
||||
INPUT : VectDest, VectA: address of sl_3D_tdstVector, a: SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vDivScalarVector( VectDest, VectA, a) MTH3D_M_vDivScalarVector( VectDest, VectA, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xDotProductVector
|
||||
DESCRIPTION : Return the Dot Product of two vectors
|
||||
INPUT : VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : VectA.VectB : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xDotProductVector( VectA, VectB) MTH3D_M_xDotProductVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vCrossProductVectorWithoutBuffer
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB,
|
||||
VectDest must be a other vector
|
||||
INPUT : VectDest, VectA, VectA: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_fn_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB) \
|
||||
MTH3D_M_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB)
|
||||
|
||||
#define sl_3D_M_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB) \
|
||||
sl_3D_fn_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB)
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vCrossProductVector
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB
|
||||
INPUT : VectDest, VectA, VectA: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vCrossProductVector(VectDest,VectA,VectB) MTH3D_M_vCrossProductVector(VectDest,VectA,VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xSqrVector
|
||||
DESCRIPTION : Return the square of a vector
|
||||
INPUT : VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : VectA.VectA : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xSqrVector( VectA) MTH3D_M_xSqrVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xNormVector
|
||||
DESCRIPTION : Return the norm of a vector
|
||||
INPUT : VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : ||VectA|| : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xNormVector( VectA ) MTH3D_M_xNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xInvNormVector
|
||||
DESCRIPTION : Return the inverse of the norm of a vector
|
||||
INPUT : VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : 1/||VectA|| : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xInvNormVector( VectA ) MTH3D_M_xInvNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xVectorGapSqr
|
||||
DESCRIPTION : Return the square Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : Sqr(||VectA-VectB||) : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xVectorGapSqr(VectA, VectB) MTH3D_M_xVectorGapSqr(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xVectorGap
|
||||
DESCRIPTION : Return the Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : ||VectA-VectB|| : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xVectorGap(VectA, VectB) MTH3D_M_xVectorGap(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vFillVector
|
||||
DESCRIPTION : Fill each vector element with a value
|
||||
INPUT : VectA: address of sl_3D_tdstVector, a: SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vFillVector( VectDest, a) MTH3D_M_vFillVector( VectDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vNormalizeVector
|
||||
DESCRIPTION : Normalize a vector : VectDest= VectA/||VectA||
|
||||
INPUT : VectDest, VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vNormalizeVector(VectDest, VectA) MTH3D_M_vNormalizeVector(VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetVectorElements
|
||||
DESCRIPTION : Get x, y, z values of a vector
|
||||
INPUT : x, y, z : address of SCA_td_sl, VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetVectorElements( Vx, Vy, Vz, VectA) MTH3D_M_vGetVectorElements( Vx, Vy, Vz, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetVectorElements
|
||||
DESCRIPTION : Set a vector with x, y, z values
|
||||
INPUT : VectDest : address of sl_3D_tdstVector, x, y, z : address of SCA_td_sl,
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz) MTH3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xGetXofVector
|
||||
DESCRIPTION : Return x element of a vector
|
||||
INPUT : VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : x : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xGetXofVector( VectA ) MTH3D_M_xGetXofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetXofVector
|
||||
DESCRIPTION : Set x element of a vector
|
||||
INPUT : VectDest : address of sl_3D_tdstVector, Vx : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetXofVector( VectDest, Vx) MTH3D_M_vSetXofVector( VectDest, Vx)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xGetYofVector
|
||||
DESCRIPTION : Return y element of a vector
|
||||
INPUT : VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : y : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xGetYofVector( VectA ) MTH3D_M_xGetYofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetYofVector
|
||||
DESCRIPTION : Set y element of a vector
|
||||
INPUT : VectDest : address of sl_3D_tdstVector, Vy : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetYofVector( VectDest, Vy) MTH3D_M_vSetYofVector( VectDest, Vy)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xGetZofVector
|
||||
DESCRIPTION : Return z element of a vector
|
||||
INPUT : VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : z : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xGetZofVector( VectA ) MTH3D_M_xGetZofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetZofVector
|
||||
DESCRIPTION : Set z element of a vector
|
||||
INPUT : VectDest : address of sl_3D_tdstVector, Vz : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetZofVector( VectDest, Vz) MTH3D_M_vSetZofVector( VectDest, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vCopyVector
|
||||
DESCRIPTION : Copy a vector : VectDest=VectA
|
||||
INPUT : VectDest, VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vCopyVector( VectDest, VectA) MTH3D_M_vCopyVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vNullVector
|
||||
DESCRIPTION : Set all elements of a vector to zero
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vNullVector( VectDest) MTH3D_M_vNullVector( VectDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vScaleVector
|
||||
DESCRIPTION : Set each element of VectDest with the multiplication of element of VectA by element of VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vScaleVector( VectDest, VectA, VectB ) MTH3D_M_vScaleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMiddleVector
|
||||
DESCRIPTION : Calculate the middle of two vectors : VectDest= (VectA+VectB)/2
|
||||
INPUT : VectDest, VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMiddleVector( VectDest, VectA, VectB ) MTH3D_M_vMiddleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vLinearInterpolVector
|
||||
DESCRIPTION : Calculate the lineat interpolation of two vectors : VectDest= VectA + t.(VectB-VectA)
|
||||
INPUT : VectDest, VectA, VectB: address of sl_3D_tdstVector, t: SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t) MTH3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMaxVector
|
||||
DESCRIPTION : Make a vector with max elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMaxVector( VectDest, VectA, VectB) MTH3D_M_vMaxVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMinVector
|
||||
DESCRIPTION : Make a vector with min elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMinVector( VectDest, VectA, VectB) MTH3D_M_vMinVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xDetxYVector
|
||||
DESCRIPTION : Return the 2D determinant between X and Y elements
|
||||
INPUT : VectA, VectB: address of sl_3D_tdstVector
|
||||
OUTPUT : DetxY |VectA, VectB| : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xDetxYVector( VectA, VectB ) MTH3D_M_xDetxYVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xDetYZVector
|
||||
DESCRIPTION : Return the 2D determinant between Y and Z elements
|
||||
INPUT : VectA, VectB: address of sl_3D_tdstVector
|
||||
OUTPUT : DetYZ |VectA, VectB| : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xDetYZVector( VectA, VectB ) MTH3D_M_xDetYZVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xDetZXVector
|
||||
DESCRIPTION : Return the 2D determinant between Z and X elements
|
||||
INPUT : VectA, VectB: address of sl_3D_tdstVector
|
||||
OUTPUT : DetZX |VectA, VectB| : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xDetZXVector( VectA, VectB ) MTH3D_M_xDetZXVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_bIsNullVector
|
||||
DESCRIPTION : Test if a vector is null
|
||||
INPUT : VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : VectA==Null vector : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_bIsNullVector( VectA ) MTH3D_M_bIsNullVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulAddVector
|
||||
DESCRIPTION : Multiply a scalar to a vector, and add it to a other vector: VectDest = x.VectA + VectB
|
||||
INPUT : VectDest: address of sl_3D_tdstVector,
|
||||
x: SCA_td_sl, VectA, VectB : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulAddVector( VectDest, x, VectA, VectB) MTH3D_M_vMulAddVector( VectDest, x, VectA, VectB)
|
||||
|
||||
/* sl_3D_M_vMullAddVector( VectDest, x, VectA, VectB) : VectDest = x.VectA + VectB */
|
||||
#define sl_3D_M_vMullAddVector sl_3D_M_vMulAddVector
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetBaseIVector
|
||||
DESCRIPTION : Set a vector to Ox base vector : VectDest = ( 1, 0, 0 )
|
||||
INPUT : VectDest: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetBaseIVector( VectDest ) MTH3D_M_vSetBaseIVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetBaseJVector
|
||||
DESCRIPTION : Set a vector to Oy base vector : VectDest = ( 0, 1, 0 )
|
||||
INPUT : VectDest: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetBaseJVector( VectDest ) MTH3D_M_vSetBaseJVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetBaseKVector
|
||||
DESCRIPTION : Set a vector to Oz base vector : VectDest = ( 0, 0, 1 )
|
||||
INPUT : VectDest: address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetBaseKVector( VectDest ) MTH3D_M_vSetBaseKVector( VectDest )
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vCopyMatrix( MatDest, MatA) MTH3D_M_vCopyMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vAddMatrix( MatDest, MatA, MatB) MTH3D_M_vAddMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSubMatrix( MatDest, MatA, MatB) MTH3D_M_vSubMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vNegMatrix( MatDest, MatA) MTH3D_M_vNegMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulTranspMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulTranspMatrixMatrix
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
INPUT : MatDest, MatA, MatB: address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
a: SCA_td_sl, MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
MTH3D_M_vMulScalarMatrix(MatDest, a, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix, a: SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
MTH3D_M_vDivScalarMatrix(MatDest, MatA, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSqrMatrix(MatDest, MatA) MTH3D_M_vSqrMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA)
|
||||
|
||||
|
||||
/* sl_3D_M_vTranpMatrixWithoutBuffer(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sl_3D_M_vTranpMatrixWithoutBuffer sl_3D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vTranspMatrix(Mat_Dest, Mat_A) MTH3D_M_vTranspMatrix(Mat_Dest, Mat_A)
|
||||
|
||||
/* sl_3D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sl_3D_M_vTranpMatrix sl_3D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : trace MatA : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xTraceMatrix(MatA) MTH3D_M_xTraceMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetIdentityMatrix(MatDest) MTH3D_M_vSetIdentityMatrix(MatDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of sl_3D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_bEqualMatrix(MatA, MatB) MTH3D_M_bEqualMatrix(MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of sl_3D_tdstMatrix
|
||||
eps : SCA_td_sl
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_bMatchMatrix(MatA, MatB, eps) MTH3D_M_bMatchMatrix(MatA, MatB, eps)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
a : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vFillMatrix(MatDest, a) MTH3D_M_vFillMatrix(MatDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : det MatA : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xDetMatrix(MatA) MTH3D_M_xDetMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vComMatrixWithoutBuffer
|
||||
DESCRIPTION : Calculate the Cofactor Matrix of a matrix : MatDest= Cofactor Matrix of MatA
|
||||
INPUT : Matdest, MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vInverMatrix(MatDest, MatA) MTH3D_M_vInverMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y, z column col values in MatA
|
||||
INPUT : x, y, z : SCA_td_sl
|
||||
col : int
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA) \
|
||||
MTH3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y, z values in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
x, y, z : SCA_td_sl
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col) \
|
||||
MTH3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : SCA_td_sl
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_xGetMatrixElement( lin, col, MatA) MTH3D_M_xGetMatrixElement( lin, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
a : SCA_td_sl
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixElement( MatDest, a, lin, col) MTH3D_M_vSetMatrixElement( MatDest, a, lin, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixCol0Elements
|
||||
DESCRIPTION : Set x, y, z values of column 0 in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixCol1Elements
|
||||
DESCRIPTION : Set x, y, z values of column 1 in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixCol2Elements
|
||||
DESCRIPTION : Set x, y, z values of column 2 in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixLineXElements
|
||||
DESCRIPTION : Set x elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixLineYElements
|
||||
DESCRIPTION : Set y elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetMatrixLineZElements
|
||||
DESCRIPTION : Set z elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixCol0Elements
|
||||
DESCRIPTION : Get x, y, z values of column 0 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixCol1Elements
|
||||
DESCRIPTION : Get x, y, z values of column 1 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixCol2Elements
|
||||
DESCRIPTION : Get x, y, z values of column 2 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixLineXElements
|
||||
DESCRIPTION : Get x elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixLineYElements
|
||||
DESCRIPTION : Get y elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetMatrixLineZElements
|
||||
DESCRIPTION : Get z elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sl
|
||||
INPUT : MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA)
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVector( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
MTH3D_M_vGetColumnInMatrix( VectDest, MatA, col )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
MTH3D_M_vSetColumnInMatrix( MatDest, VectA, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
MTH3D_M_vGetLineInMatrix( VectDest, MatA, lin )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
MTH3D_M_vSetLineInMatrix( MatDest, VectA, lin)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
MTH3D_M_vGetDiagInMatrix( VectDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
MTH3D_M_vSetDiagInMatrix( MatDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest, VcDest: address of sl_3D_tdstVector
|
||||
MatA : address of sl_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA) \
|
||||
MTH3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of sl_3D_tdstMatrix
|
||||
VectA, VectB, VectC : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sl_3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC) \
|
||||
MTH3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sl_3D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sl_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf_sl(td_sl _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
|
||||
__inline void sl_3D_fn_vPrintfVector( char * Name, sl_3D_tdstVector * VectA)
|
||||
{
|
||||
MTH3D_M_vPrintfVector( Name, VectA );
|
||||
}
|
||||
|
||||
#define sl_3D_M_vPrintfVector( Name, VectA) sl_3D_fn_vPrintfVector( Name, VectA)
|
||||
|
||||
|
||||
#endif /* sl_3D_H */
|
909
Rayman_X/cpa/public/MTH/Specif/VEC/sw12_3D.h
Normal file
909
Rayman_X/cpa/public/MTH/Specif/VEC/sw12_3D.h
Normal file
@@ -0,0 +1,909 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : sw12_3D.h
|
||||
MODULE : sw12 (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vectorial implementation
|
||||
|
||||
VERSION : sw12 V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------15/04/98 18:36-------------------
|
||||
* Conversion : OK
|
||||
* --------------------------------------------------*/
|
||||
#ifndef _SCA_sw12_3D_H_
|
||||
#define _SCA_sw12_3D_H_
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sw12.h"
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* 3D Vector : */
|
||||
/*
|
||||
#if 0
|
||||
|
||||
typedef VECTOR sw12_3D_tdstVector;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct sw12_3D_tdstVector_
|
||||
{
|
||||
SCA_td_sw12 xX;
|
||||
SCA_td_sw12 xY;
|
||||
SCA_td_sw12 xZ;
|
||||
SCA_td_sw12 pad;
|
||||
} sw12_3D_tdstVector;
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define sw12_3D_tdstVector MTH3D_tdstVector
|
||||
|
||||
|
||||
|
||||
/* 3D Matrix */
|
||||
/*
|
||||
typedef struct sw12_3D_tdstMatrix_
|
||||
{
|
||||
sw12_3D_tdstVector stCol_0;
|
||||
sw12_3D_tdstVector stCol_1;
|
||||
sw12_3D_tdstVector stCol_2;
|
||||
|
||||
} sw12_3D_tdstMatrix;
|
||||
*/
|
||||
|
||||
#define sw12_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Vector Operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vAddVector
|
||||
DESCRIPTION : Add two vectors : VectDest= VectA + VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vAddVector( VectDest, VectA, VectB) MTH3D_M_vAddVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSubVector
|
||||
DESCRIPTION : Sub two vectors : VectDest= VectA - VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSubVector( VectDest, VectA, VectB) MTH3D_M_vSubVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vNegVector
|
||||
DESCRIPTION : Negation of a vector : VectDest= - VectA
|
||||
INPUT : VectDest, VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vNegVector( VectDest, VectA) MTH3D_M_vNegVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_bEqualVector
|
||||
DESCRIPTION : Test if two vectors are equal
|
||||
INPUT : VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : VectA==VectB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_bEqualVector( VectA, VectB) MTH3D_M_bEqualVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vAddScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= a.Id + VectA
|
||||
INPUT : VectDest: address of sw12_3D_tdstVector,
|
||||
a: SCA_td_sw12, VectA: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vAddScalarVector( VectDest, a, VectA) MTH3D_M_vAddScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSubScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= VectA - a.Id
|
||||
INPUT : VectDest: address of sw12_3D_tdstVector,
|
||||
a: SCA_td_sw12, VectA: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSubScalarVector( VectDest, a, VectA) MTH3D_M_vSubScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulScalarVector
|
||||
DESCRIPTION : Multiplicate a scalare with a vector : VectDest= a*VectA
|
||||
INPUT : VectDest: address of sw12_3D_tdstVector,
|
||||
a: SCA_td_sw12, VectA: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulScalarVector( VectDest, a, VectA) MTH3D_M_vMulScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vDivScalarVector
|
||||
DESCRIPTION : Divide a vector by a scalare : VectDest= VectA/a
|
||||
INPUT : VectDest, VectA: address of sw12_3D_tdstVector, a: SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vDivScalarVector( VectDest, VectA, a) MTH3D_M_vDivScalarVector( VectDest, VectA, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xDotProductVector
|
||||
DESCRIPTION : Return the Dot Product of two vectors
|
||||
INPUT : VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : VectA.VectB : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xDotProductVector( VectA, VectB) MTH3D_M_xDotProductVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vCrossProductVectorWithoutBuffer
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB,
|
||||
VectDest must be a other vector
|
||||
INPUT : VectDest, VectA, VectA: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_fn_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB) \
|
||||
MTH3D_M_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB)
|
||||
|
||||
#define sw12_3D_M_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB) \
|
||||
sw12_3D_fn_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB)
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vCrossProductVector
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB
|
||||
INPUT : VectDest, VectA, VectA: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vCrossProductVector(VectDest,VectA,VectB) MTH3D_M_vCrossProductVector(VectDest,VectA,VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xSqrVector
|
||||
DESCRIPTION : Return the square of a vector
|
||||
INPUT : VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : VectA.VectA : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xSqrVector( VectA) MTH3D_M_xSqrVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xNormVector
|
||||
DESCRIPTION : Return the norm of a vector
|
||||
INPUT : VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : ||VectA|| : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xNormVector( VectA ) MTH3D_M_xNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xInvNormVector
|
||||
DESCRIPTION : Return the inverse of the norm of a vector
|
||||
INPUT : VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : 1/||VectA|| : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xInvNormVector( VectA ) MTH3D_M_xInvNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xVectorGapSqr
|
||||
DESCRIPTION : Return the square Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : Sqr(||VectA-VectB||) : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xVectorGapSqr(VectA, VectB) MTH3D_M_xVectorGapSqr(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xVectorGap
|
||||
DESCRIPTION : Return the Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : ||VectA-VectB|| : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xVectorGap(VectA, VectB) MTH3D_M_xVectorGap(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vFillVector
|
||||
DESCRIPTION : Fill each vector element with a value
|
||||
INPUT : VectA: address of sw12_3D_tdstVector, a: SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vFillVector( VectDest, a) MTH3D_M_vFillVector( VectDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vNormalizeVector
|
||||
DESCRIPTION : Normalize a vector : VectDest= VectA/||VectA||
|
||||
INPUT : VectDest, VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vNormalizeVector(VectDest, VectA) MTH3D_M_vNormalizeVector(VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetVectorElements
|
||||
DESCRIPTION : Get x, y, z values of a vector
|
||||
INPUT : x, y, z : address of SCA_td_sw12, VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetVectorElements( Vx, Vy, Vz, VectA) MTH3D_M_vGetVectorElements( Vx, Vy, Vz, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetVectorElements
|
||||
DESCRIPTION : Set a vector with x, y, z values
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector, x, y, z : address of SCA_td_sw12,
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz) MTH3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xGetXofVector
|
||||
DESCRIPTION : Return x element of a vector
|
||||
INPUT : VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : x : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xGetXofVector( VectA ) MTH3D_M_xGetXofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetXofVector
|
||||
DESCRIPTION : Set x element of a vector
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector, Vx : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetXofVector( VectDest, Vx) MTH3D_M_vSetXofVector( VectDest, Vx)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xGetYofVector
|
||||
DESCRIPTION : Return y element of a vector
|
||||
INPUT : VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : y : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xGetYofVector( VectA ) MTH3D_M_xGetYofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetYofVector
|
||||
DESCRIPTION : Set y element of a vector
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector, Vy : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetYofVector( VectDest, Vy) MTH3D_M_vSetYofVector( VectDest, Vy)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xGetZofVector
|
||||
DESCRIPTION : Return z element of a vector
|
||||
INPUT : VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : z : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xGetZofVector( VectA ) MTH3D_M_xGetZofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetZofVector
|
||||
DESCRIPTION : Set z element of a vector
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector, Vz : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetZofVector( VectDest, Vz) MTH3D_M_vSetZofVector( VectDest, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vCopyVector
|
||||
DESCRIPTION : Copy a vector : VectDest=VectA
|
||||
INPUT : VectDest, VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vCopyVector( VectDest, VectA) MTH3D_M_vCopyVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vNullVector
|
||||
DESCRIPTION : Set all elements of a vector to zero
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vNullVector( VectDest) MTH3D_M_vNullVector( VectDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vScaleVector
|
||||
DESCRIPTION : Set each element of VectDest with the multiplication of element of VectA by element of VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vScaleVector( VectDest, VectA, VectB ) MTH3D_M_vScaleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMiddleVector
|
||||
DESCRIPTION : Calculate the middle of two vectors : VectDest= (VectA+VectB)/2
|
||||
INPUT : VectDest, VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMiddleVector( VectDest, VectA, VectB ) MTH3D_M_vMiddleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vLinearInterpolVector
|
||||
DESCRIPTION : Calculate the lineat interpolation of two vectors : VectDest= VectA + t.(VectB-VectA)
|
||||
INPUT : VectDest, VectA, VectB: address of sw12_3D_tdstVector, t: SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t) MTH3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMaxVector
|
||||
DESCRIPTION : Make a vector with max elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMaxVector( VectDest, VectA, VectB) MTH3D_M_vMaxVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMinVector
|
||||
DESCRIPTION : Make a vector with min elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMinVector( VectDest, VectA, VectB) MTH3D_M_vMinVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xDetxYVector
|
||||
DESCRIPTION : Return the 2D determinant between X and Y elements
|
||||
INPUT : VectA, VectB: address of sw12_3D_tdstVector
|
||||
OUTPUT : DetxY |VectA, VectB| : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xDetxYVector( VectA, VectB ) MTH3D_M_xDetxYVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xDetYZVector
|
||||
DESCRIPTION : Return the 2D determinant between Y and Z elements
|
||||
INPUT : VectA, VectB: address of sw12_3D_tdstVector
|
||||
OUTPUT : DetYZ |VectA, VectB| : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xDetYZVector( VectA, VectB ) MTH3D_M_xDetYZVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xDetZXVector
|
||||
DESCRIPTION : Return the 2D determinant between Z and X elements
|
||||
INPUT : VectA, VectB: address of sw12_3D_tdstVector
|
||||
OUTPUT : DetZX |VectA, VectB| : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xDetZXVector( VectA, VectB ) MTH3D_M_xDetZXVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_bIsNullVector
|
||||
DESCRIPTION : Test if a vector is null
|
||||
INPUT : VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : VectA==Null vector : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_bIsNullVector( VectA ) MTH3D_M_bIsNullVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulAddVector
|
||||
DESCRIPTION : Multiply a scalar to a vector, and add it to a other vector: VectDest = x.VectA + VectB
|
||||
INPUT : VectDest: address of sw12_3D_tdstVector,
|
||||
x: SCA_td_sw12, VectA, VectB : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulAddVector( VectDest, x, VectA, VectB) MTH3D_M_vMulAddVector( VectDest, x, VectA, VectB)
|
||||
|
||||
/* sw12_3D_M_vMullAddVector( VectDest, x, VectA, VectB) : VectDest = x.VectA + VectB */
|
||||
#define sw12_3D_M_vMullAddVector sw12_3D_M_vMulAddVector
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetBaseIVector
|
||||
DESCRIPTION : Set a vector to Ox base vector : VectDest = ( 1, 0, 0 )
|
||||
INPUT : VectDest: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetBaseIVector( VectDest ) MTH3D_M_vSetBaseIVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetBaseJVector
|
||||
DESCRIPTION : Set a vector to Oy base vector : VectDest = ( 0, 1, 0 )
|
||||
INPUT : VectDest: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetBaseJVector( VectDest ) MTH3D_M_vSetBaseJVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetBaseKVector
|
||||
DESCRIPTION : Set a vector to Oz base vector : VectDest = ( 0, 0, 1 )
|
||||
INPUT : VectDest: address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetBaseKVector( VectDest ) MTH3D_M_vSetBaseKVector( VectDest )
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vCopyMatrix( MatDest, MatA) MTH3D_M_vCopyMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vAddMatrix( MatDest, MatA, MatB) MTH3D_M_vAddMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSubMatrix( MatDest, MatA, MatB) MTH3D_M_vSubMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vNegMatrix( MatDest, MatA) MTH3D_M_vNegMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulTranspMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulTranspMatrixMatrix
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
INPUT : MatDest, MatA, MatB: address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
a: SCA_td_sw12, MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
MTH3D_M_vMulScalarMatrix(MatDest, a, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix, a: SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
MTH3D_M_vDivScalarMatrix(MatDest, MatA, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSqrMatrix(MatDest, MatA) MTH3D_M_vSqrMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA)
|
||||
|
||||
|
||||
/* sw12_3D_M_vTranpMatrixWithoutBuffer(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw12_3D_M_vTranpMatrixWithoutBuffer sw12_3D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vTranspMatrix(Mat_Dest, Mat_A) MTH3D_M_vTranspMatrix(Mat_Dest, Mat_A)
|
||||
|
||||
/* sw12_3D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw12_3D_M_vTranpMatrix sw12_3D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : trace MatA : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xTraceMatrix(MatA) MTH3D_M_xTraceMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetIdentityMatrix(MatDest) MTH3D_M_vSetIdentityMatrix(MatDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_bEqualMatrix(MatA, MatB) MTH3D_M_bEqualMatrix(MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of sw12_3D_tdstMatrix
|
||||
eps : SCA_td_sw12
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_bMatchMatrix(MatA, MatB, eps) MTH3D_M_bMatchMatrix(MatA, MatB, eps)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
a : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vFillMatrix(MatDest, a) MTH3D_M_vFillMatrix(MatDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : det MatA : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xDetMatrix(MatA) MTH3D_M_xDetMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vComMatrixWithoutBuffer
|
||||
DESCRIPTION : Calculate the Cofactor Matrix of a matrix : MatDest= Cofactor Matrix of MatA
|
||||
INPUT : Matdest, MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vInverMatrix(MatDest, MatA) MTH3D_M_vInverMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y, z column col values in MatA
|
||||
INPUT : x, y, z : SCA_td_sw12
|
||||
col : int
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA) \
|
||||
MTH3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y, z values in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
x, y, z : SCA_td_sw12
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col) \
|
||||
MTH3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : SCA_td_sw12
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_xGetMatrixElement( lin, col, MatA) MTH3D_M_xGetMatrixElement( lin, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
a : SCA_td_sw12
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixElement( MatDest, a, lin, col) MTH3D_M_vSetMatrixElement( MatDest, a, lin, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixCol0Elements
|
||||
DESCRIPTION : Set x, y, z values of column 0 in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixCol1Elements
|
||||
DESCRIPTION : Set x, y, z values of column 1 in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixCol2Elements
|
||||
DESCRIPTION : Set x, y, z values of column 2 in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixLineXElements
|
||||
DESCRIPTION : Set x elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixLineYElements
|
||||
DESCRIPTION : Set y elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetMatrixLineZElements
|
||||
DESCRIPTION : Set z elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixCol0Elements
|
||||
DESCRIPTION : Get x, y, z values of column 0 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixCol1Elements
|
||||
DESCRIPTION : Get x, y, z values of column 1 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixCol2Elements
|
||||
DESCRIPTION : Get x, y, z values of column 2 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixLineXElements
|
||||
DESCRIPTION : Get x elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixLineYElements
|
||||
DESCRIPTION : Get y elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetMatrixLineZElements
|
||||
DESCRIPTION : Get z elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw12
|
||||
INPUT : MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA)
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVector( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
MTH3D_M_vGetColumnInMatrix( VectDest, MatA, col )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
MTH3D_M_vSetColumnInMatrix( MatDest, VectA, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
MTH3D_M_vGetLineInMatrix( VectDest, MatA, lin )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
MTH3D_M_vSetLineInMatrix( MatDest, VectA, lin)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
MTH3D_M_vGetDiagInMatrix( VectDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
MTH3D_M_vSetDiagInMatrix( MatDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest, VcDest: address of sw12_3D_tdstVector
|
||||
MatA : address of sw12_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA) \
|
||||
MTH3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of sw12_3D_tdstMatrix
|
||||
VectA, VectB, VectC : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw12_3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC) \
|
||||
MTH3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw12_3D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sw12_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf_sw12(td_sw12 _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
|
||||
__inline void sw12_3D_fn_vPrintfVector( char * Name, sw12_3D_tdstVector * VectA)
|
||||
{
|
||||
MTH3D_M_vPrintfVector( Name, VectA );
|
||||
}
|
||||
|
||||
#define sw12_3D_M_vPrintfVector( Name, VectA) sw12_3D_fn_vPrintfVector( Name, VectA)
|
||||
|
||||
|
||||
#endif /* sw12_3D_H */
|
910
Rayman_X/cpa/public/MTH/Specif/VEC/sw_3D.h
Normal file
910
Rayman_X/cpa/public/MTH/Specif/VEC/sw_3D.h
Normal file
@@ -0,0 +1,910 @@
|
||||
/* ##H_FILE#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
FILE : sw_3D.h
|
||||
MODULE : sw (Common Mathematic Library)
|
||||
|
||||
DESCRIPTION : 3D Vectorial implementation
|
||||
|
||||
VERSION : sw V5.0.13 / Alexandre LANGER [ALX] Ubi R&D / Add Comments
|
||||
|
||||
VERSION PC
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
/* -----------------15/04/98 18:36-------------------
|
||||
* Conversion : OK
|
||||
* --------------------------------------------------*/
|
||||
#ifndef _SCA_sw_3D_H_
|
||||
#define _SCA_sw_3D_H_
|
||||
|
||||
#include "MTH\Specif\SCA\SCA_sw.h"
|
||||
|
||||
/* ##TYPEDEF#----------------------------------------------------------------------------
|
||||
Types definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/* 3D Vector : */
|
||||
/*
|
||||
#if 0
|
||||
|
||||
typedef VECTOR sw_3D_tdstVector;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct sw_3D_tdstVector_
|
||||
{
|
||||
SCA_td_sw xX;
|
||||
SCA_td_sw xY;
|
||||
SCA_td_sw xZ;
|
||||
SCA_td_sw pad;
|
||||
} sw_3D_tdstVector;
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define sw_3D_tdstVector MTH3D_tdstVector
|
||||
|
||||
|
||||
|
||||
/* 3D Matrix */
|
||||
/*
|
||||
typedef struct sw_3D_tdstMatrix_
|
||||
{
|
||||
sw_3D_tdstVector stCol_0;
|
||||
sw_3D_tdstVector stCol_1;
|
||||
sw_3D_tdstVector stCol_2;
|
||||
|
||||
} sw_3D_tdstMatrix;
|
||||
*/
|
||||
|
||||
#define sw_3D_tdstMatrix MTH3D_tdstMatrix
|
||||
|
||||
/* ##MACRO#----------------------------------------------------------------------------
|
||||
MACRO definition
|
||||
---------------------------------------------------------------------------------------*/
|
||||
|
||||
/*+ ##-######################################
|
||||
## MACRO AND FUNCTION FOR 3D MATHEMATICS
|
||||
######################################### */
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Vector Operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vAddVector
|
||||
DESCRIPTION : Add two vectors : VectDest= VectA + VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vAddVector( VectDest, VectA, VectB) MTH3D_M_vAddVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSubVector
|
||||
DESCRIPTION : Sub two vectors : VectDest= VectA - VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSubVector( VectDest, VectA, VectB) MTH3D_M_vSubVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vNegVector
|
||||
DESCRIPTION : Negation of a vector : VectDest= - VectA
|
||||
INPUT : VectDest, VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vNegVector( VectDest, VectA) MTH3D_M_vNegVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_bEqualVector
|
||||
DESCRIPTION : Test if two vectors are equal
|
||||
INPUT : VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : VectA==VectB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_bEqualVector( VectA, VectB) MTH3D_M_bEqualVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vAddScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= a.Id + VectA
|
||||
INPUT : VectDest: address of sw_3D_tdstVector,
|
||||
a: SCA_td_sw, VectA: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vAddScalarVector( VectDest, a, VectA) MTH3D_M_vAddScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSubScalarVector
|
||||
DESCRIPTION : Add a scalare with a vector : VectDest= VectA - a.Id
|
||||
INPUT : VectDest: address of sw_3D_tdstVector,
|
||||
a: SCA_td_sw, VectA: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSubScalarVector( VectDest, a, VectA) MTH3D_M_vSubScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulScalarVector
|
||||
DESCRIPTION : Multiplicate a scalare with a vector : VectDest= a*VectA
|
||||
INPUT : VectDest: address of sw_3D_tdstVector,
|
||||
a: SCA_td_sw, VectA: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulScalarVector( VectDest, a, VectA) MTH3D_M_vMulScalarVector( VectDest, a, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vDivScalarVector
|
||||
DESCRIPTION : Divide a vector by a scalare : VectDest= VectA/a
|
||||
INPUT : VectDest, VectA: address of sw_3D_tdstVector, a: SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vDivScalarVector( VectDest, VectA, a) MTH3D_M_vDivScalarVector( VectDest, VectA, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xDotProductVector
|
||||
DESCRIPTION : Return the Dot Product of two vectors
|
||||
INPUT : VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : VectA.VectB : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xDotProductVector( VectA, VectB) MTH3D_M_xDotProductVector( VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vCrossProductVectorWithoutBuffer
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB,
|
||||
VectDest must be a other vector
|
||||
INPUT : VectDest, VectA, VectA: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_fn_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB) \
|
||||
MTH3D_M_vCrossProductVectorWithoutBuffer(_p_stVectDest, _p_stVectA, _p_stVectB)
|
||||
|
||||
#define sw_3D_M_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB) \
|
||||
sw_3D_fn_vCrossProductVectorWithoutBuffer(VectDest, VectA, VectB)
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vCrossProductVector
|
||||
DESCRIPTION : Calculate the cross product of two vectors : VectDest= VectA^VectB
|
||||
INPUT : VectDest, VectA, VectA: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vCrossProductVector(VectDest,VectA,VectB) MTH3D_M_vCrossProductVector(VectDest,VectA,VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xSqrVector
|
||||
DESCRIPTION : Return the square of a vector
|
||||
INPUT : VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : VectA.VectA : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xSqrVector( VectA) MTH3D_M_xSqrVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xNormVector
|
||||
DESCRIPTION : Return the norm of a vector
|
||||
INPUT : VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : ||VectA|| : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xNormVector( VectA ) MTH3D_M_xNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xInvNormVector
|
||||
DESCRIPTION : Return the inverse of the norm of a vector
|
||||
INPUT : VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : 1/||VectA|| : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xInvNormVector( VectA ) MTH3D_M_xInvNormVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xVectorGapSqr
|
||||
DESCRIPTION : Return the square Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : Sqr(||VectA-VectB||) : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xVectorGapSqr(VectA, VectB) MTH3D_M_xVectorGapSqr(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xVectorGap
|
||||
DESCRIPTION : Return the Gap between two vectors
|
||||
INPUT : VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : ||VectA-VectB|| : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xVectorGap(VectA, VectB) MTH3D_M_xVectorGap(VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vFillVector
|
||||
DESCRIPTION : Fill each vector element with a value
|
||||
INPUT : VectA: address of sw_3D_tdstVector, a: SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vFillVector( VectDest, a) MTH3D_M_vFillVector( VectDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vNormalizeVector
|
||||
DESCRIPTION : Normalize a vector : VectDest= VectA/||VectA||
|
||||
INPUT : VectDest, VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vNormalizeVector(VectDest, VectA) MTH3D_M_vNormalizeVector(VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetVectorElements
|
||||
DESCRIPTION : Get x, y, z values of a vector
|
||||
INPUT : x, y, z : address of SCA_td_sw, VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetVectorElements( Vx, Vy, Vz, VectA) MTH3D_M_vGetVectorElements( Vx, Vy, Vz, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetVectorElements
|
||||
DESCRIPTION : Set a vector with x, y, z values
|
||||
INPUT : VectDest : address of sw_3D_tdstVector, x, y, z : address of SCA_td_sw,
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz) MTH3D_M_vSetVectorElements( VectDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xGetXofVector
|
||||
DESCRIPTION : Return x element of a vector
|
||||
INPUT : VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : x : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xGetXofVector( VectA ) MTH3D_M_xGetXofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetXofVector
|
||||
DESCRIPTION : Set x element of a vector
|
||||
INPUT : VectDest : address of sw_3D_tdstVector, Vx : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetXofVector( VectDest, Vx) MTH3D_M_vSetXofVector( VectDest, Vx)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xGetYofVector
|
||||
DESCRIPTION : Return y element of a vector
|
||||
INPUT : VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : y : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xGetYofVector( VectA ) MTH3D_M_xGetYofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetYofVector
|
||||
DESCRIPTION : Set y element of a vector
|
||||
INPUT : VectDest : address of sw_3D_tdstVector, Vy : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetYofVector( VectDest, Vy) MTH3D_M_vSetYofVector( VectDest, Vy)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xGetZofVector
|
||||
DESCRIPTION : Return z element of a vector
|
||||
INPUT : VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : z : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xGetZofVector( VectA ) MTH3D_M_xGetZofVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetZofVector
|
||||
DESCRIPTION : Set z element of a vector
|
||||
INPUT : VectDest : address of sw_3D_tdstVector, Vz : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetZofVector( VectDest, Vz) MTH3D_M_vSetZofVector( VectDest, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vCopyVector
|
||||
DESCRIPTION : Copy a vector : VectDest=VectA
|
||||
INPUT : VectDest, VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vCopyVector( VectDest, VectA) MTH3D_M_vCopyVector( VectDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vNullVector
|
||||
DESCRIPTION : Set all elements of a vector to zero
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vNullVector( VectDest) MTH3D_M_vNullVector( VectDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vScaleVector
|
||||
DESCRIPTION : Set each element of VectDest with the multiplication of element of VectA by element of VectB
|
||||
INPUT : VectDest, VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vScaleVector( VectDest, VectA, VectB ) MTH3D_M_vScaleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMiddleVector
|
||||
DESCRIPTION : Calculate the middle of two vectors : VectDest= (VectA+VectB)/2
|
||||
INPUT : VectDest, VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMiddleVector( VectDest, VectA, VectB ) MTH3D_M_vMiddleVector( VectDest, VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vLinearInterpolVector
|
||||
DESCRIPTION : Calculate the lineat interpolation of two vectors : VectDest= VectA + t.(VectB-VectA)
|
||||
INPUT : VectDest, VectA, VectB: address of sw_3D_tdstVector, t: SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t) MTH3D_M_vLinearInterpolVector( VectDest, VectA, VectB, t)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMaxVector
|
||||
DESCRIPTION : Make a vector with max elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMaxVector( VectDest, VectA, VectB) MTH3D_M_vMaxVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMinVector
|
||||
DESCRIPTION : Make a vector with min elements of two other vectors
|
||||
INPUT : VectDest, VectA, VectB: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMinVector( VectDest, VectA, VectB) MTH3D_M_vMinVector( VectDest, VectA, VectB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xDetxYVector
|
||||
DESCRIPTION : Return the 2D determinant between X and Y elements
|
||||
INPUT : VectA, VectB: address of sw_3D_tdstVector
|
||||
OUTPUT : DetxY |VectA, VectB| : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xDetxYVector( VectA, VectB ) MTH3D_M_xDetxYVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xDetYZVector
|
||||
DESCRIPTION : Return the 2D determinant between Y and Z elements
|
||||
INPUT : VectA, VectB: address of sw_3D_tdstVector
|
||||
OUTPUT : DetYZ |VectA, VectB| : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xDetYZVector( VectA, VectB ) MTH3D_M_xDetYZVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xDetZXVector
|
||||
DESCRIPTION : Return the 2D determinant between Z and X elements
|
||||
INPUT : VectA, VectB: address of sw_3D_tdstVector
|
||||
OUTPUT : DetZX |VectA, VectB| : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xDetZXVector( VectA, VectB ) MTH3D_M_xDetZXVector( VectA, VectB )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_bIsNullVector
|
||||
DESCRIPTION : Test if a vector is null
|
||||
INPUT : VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : VectA==Null vector : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_bIsNullVector( VectA ) MTH3D_M_bIsNullVector( VectA )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulAddVector
|
||||
DESCRIPTION : Multiply a scalar to a vector, and add it to a other vector: VectDest = x.VectA + VectB
|
||||
INPUT : VectDest: address of sw_3D_tdstVector,
|
||||
x: SCA_td_sw, VectA, VectB : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulAddVector( VectDest, x, VectA, VectB) MTH3D_M_vMulAddVector( VectDest, x, VectA, VectB)
|
||||
|
||||
/* sw_3D_M_vMullAddVector( VectDest, x, VectA, VectB) : VectDest = x.VectA + VectB */
|
||||
#define sw_3D_M_vMullAddVector sw_3D_M_vMulAddVector
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetBaseIVector
|
||||
DESCRIPTION : Set a vector to Ox base vector : VectDest = ( 1, 0, 0 )
|
||||
INPUT : VectDest: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetBaseIVector( VectDest ) MTH3D_M_vSetBaseIVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetBaseJVector
|
||||
DESCRIPTION : Set a vector to Oy base vector : VectDest = ( 0, 1, 0 )
|
||||
INPUT : VectDest: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetBaseJVector( VectDest ) MTH3D_M_vSetBaseJVector( VectDest )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetBaseKVector
|
||||
DESCRIPTION : Set a vector to Oz base vector : VectDest = ( 0, 0, 1 )
|
||||
INPUT : VectDest: address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetBaseKVector( VectDest ) MTH3D_M_vSetBaseKVector( VectDest )
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vCopyMatrix
|
||||
DESCRIPTION : Copy MatA in MatDest
|
||||
INPUT : MatDest, MatA: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vCopyMatrix( MatDest, MatA) MTH3D_M_vCopyMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vAddMatrix
|
||||
DESCRIPTION : Add two matrix : MatDest= MatA + MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vAddMatrix( MatDest, MatA, MatB) MTH3D_M_vAddMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSubMatrix
|
||||
DESCRIPTION : Sub two matrix : MatDest= MatA - MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSubMatrix( MatDest, MatA, MatB) MTH3D_M_vSubMatrix( MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vNegMatrix
|
||||
DESCRIPTION : Make the Nagation of a matrix : MatDest= -MatA
|
||||
INPUT : MatDest, MatA: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vNegMatrix( MatDest, MatA) MTH3D_M_vNegMatrix( MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB, MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixMatrix
|
||||
DESCRIPTION : Multiply two matrix : MatDest= MatA*MatB
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulTranspMatrixMatrixWithoutBuffer
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
MatDest must be a other matrix
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB) \
|
||||
MTH3D_M_vMulTranspMatrixMatrixWithoutBuffer(MatDest, MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulTranspMatrixMatrix
|
||||
DESCRIPTION : Multiply the transposed matrix to a other: MatDest= (transp MatA)*MatB,
|
||||
INPUT : MatDest, MatA, MatB: address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B) \
|
||||
MTH3D_M_vMulTranspMatrixMatrix(Mat_Dest, Mat_A, Mat_B)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulScalarMatrix
|
||||
DESCRIPTION : Multiply a scalar with a matrix : MatDest= a*MatA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
a: SCA_td_sw, MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulScalarMatrix(MatDest, a, MatA) \
|
||||
MTH3D_M_vMulScalarMatrix(MatDest, a, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vDivScalarMatrix
|
||||
DESCRIPTION : Divide a matrix by a scalar : MatDest= MatA/a
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix, a: SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vDivScalarMatrix(MatDest, MatA, a) \
|
||||
MTH3D_M_vDivScalarMatrix(MatDest, MatA, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSqrMatrix
|
||||
DESCRIPTION : Square a matrix : MatDest= MatA*MatA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSqrMatrix(MatDest, MatA) MTH3D_M_vSqrMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vTranspMatrixWithoutBuffer
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA, Matdest must be a other matrix
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vTranspMatrixWithoutBuffer(MatDest, MatA)
|
||||
|
||||
|
||||
/* sw_3D_M_vTranpMatrixWithoutBuffer(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw_3D_M_vTranpMatrixWithoutBuffer sw_3D_M_vTranspMatrixWithoutBuffer
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vTranspMatrix
|
||||
DESCRIPTION : Transpose a matrix : MatDest= transp MatA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vTranspMatrix(Mat_Dest, Mat_A) MTH3D_M_vTranspMatrix(Mat_Dest, Mat_A)
|
||||
|
||||
/* sw_3D_M_vTranpMatrix(MatDest, MatA) : MatDest= transp MatA */
|
||||
#define sw_3D_M_vTranpMatrix sw_3D_M_vTranspMatrix
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xTraceMatrix
|
||||
DESCRIPTION : Return the trace of a matrix
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : trace MatA : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xTraceMatrix(MatA) MTH3D_M_xTraceMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetIdentityMatrix
|
||||
DESCRIPTION : Set a matrix to the Identity matrix : MatDest= Id
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetIdentityMatrix(MatDest) MTH3D_M_vSetIdentityMatrix(MatDest)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_bEqualMatrix
|
||||
DESCRIPTION : Test if two matrix are equal
|
||||
INPUT : MatA, MatB : address of sw_3D_tdstMatrix
|
||||
OUTPUT : MatA==MatB : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_bEqualMatrix(MatA, MatB) MTH3D_M_bEqualMatrix(MatA, MatB)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_bMatchMatrix
|
||||
DESCRIPTION : Test if two matrix are neary equal
|
||||
INPUT : MatA, MatB : address of sw_3D_tdstMatrix
|
||||
eps : SCA_td_sw
|
||||
OUTPUT : (MatA match MatB to within about eps) : Boolean
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_bMatchMatrix(MatA, MatB, eps) MTH3D_M_bMatchMatrix(MatA, MatB, eps)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vFillMatrix
|
||||
DESCRIPTION : Fill each matrix element with "a" value
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
a : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vFillMatrix(MatDest, a) MTH3D_M_vFillMatrix(MatDest, a)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xDetMatrix
|
||||
DESCRIPTION : Return the determinant of a matrix
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : det MatA : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xDetMatrix(MatA) MTH3D_M_xDetMatrix(MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vComMatrixWithoutBuffer
|
||||
DESCRIPTION : Calculate the Cofactor Matrix of a matrix : MatDest= Cofactor Matrix of MatA
|
||||
INPUT : Matdest, MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
MTH3D_M_vComMatrixWithoutBuffer(MatDest, MatA) \
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vInverMatrix
|
||||
DESCRIPTION : Invert a matrix : MatDest= Inv MatA
|
||||
INPUT : Matdest, MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vInverMatrix(MatDest, MatA) MTH3D_M_vInverMatrix(MatDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixColumnElements
|
||||
DESCRIPTION : Get x, y, z column col values in MatA
|
||||
INPUT : x, y, z : SCA_td_sw
|
||||
col : int
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA) \
|
||||
MTH3D_M_vGetMatrixColumnElements( Vx, Vy, Vz, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixColumnElements
|
||||
DESCRIPTION : Set column col x, y, z values in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
x, y, z : SCA_td_sw
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col) \
|
||||
MTH3D_M_vSetMatrixColumnElements( MatDest, Vx, Vy, Vz, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_xGetMatrixElement
|
||||
DESCRIPTION : Return element at (lin, col) in MatASet
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
lin, col : int
|
||||
OUTPUT : a : SCA_td_sw
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_xGetMatrixElement( lin, col, MatA) MTH3D_M_xGetMatrixElement( lin, col, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixElement
|
||||
DESCRIPTION : Set a element in MatDest at (lin, col)
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
a : SCA_td_sw
|
||||
lin, col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixElement( MatDest, a, lin, col) MTH3D_M_vSetMatrixElement( MatDest, a, lin, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixCol0Elements
|
||||
DESCRIPTION : Set x, y, z values of column 0 in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol0Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixCol1Elements
|
||||
DESCRIPTION : Set x, y, z values of column 1 in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol1Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixCol2Elements
|
||||
DESCRIPTION : Set x, y, z values of column 2 in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz) \
|
||||
MTH3D_M_vSetMatrixCol2Elements( MatDest, Vx, Vy, Vz)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixLineXElements
|
||||
DESCRIPTION : Set x elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineXElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixLineYElements
|
||||
DESCRIPTION : Set y elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineYElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetMatrixLineZElements
|
||||
DESCRIPTION : Set z elements of all columns in MatDest
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2) \
|
||||
MTH3D_M_vSetMatrixLineZElements( MatDest, V0, V1, V2)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixCol0Elements
|
||||
DESCRIPTION : Get x, y, z values of column 0 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol0Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixCol1Elements
|
||||
DESCRIPTION : Get x, y, z values of column 1 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol1Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixCol2Elements
|
||||
DESCRIPTION : Get x, y, z values of column 2 in MatA
|
||||
Vx, Vy, Vz : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA) \
|
||||
MTH3D_M_vGetMatrixCol2Elements( Vx, Vy, Vz, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixLineXElements
|
||||
DESCRIPTION : Get x elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineXElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixLineYElements
|
||||
DESCRIPTION : Get y elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineYElements( V0, V1, V2, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetMatrixLineZElements
|
||||
DESCRIPTION : Get z elements of all columns in MatA
|
||||
V0, V0, V0 : SCA_td_sw
|
||||
INPUT : MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA) \
|
||||
MTH3D_M_vGetMatrixLineZElements( V0, V1, V2, MatA)
|
||||
|
||||
|
||||
|
||||
/* ##-###########################
|
||||
## Matrix-Vector operations
|
||||
############################## */
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixVectorWithoutBuffer
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA, VectDest must be
|
||||
a other vector
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVectorWithoutBuffer( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vMulMatrixVector
|
||||
DESCRIPTION : Multiply a Matrix to a Vector : VectDest= MatA*VectA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vMulMatrixVector( VectDest, MatA, VectA) \
|
||||
MTH3D_M_vMulMatrixVector( VectDest, MatA, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetColumnInMatrix
|
||||
DESCRIPTION : Get a Vector column of a Matrix to a Vector : VectDest= columm col of MatA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetColumnInMatrix( VectDest, MatA, col ) \
|
||||
MTH3D_M_vGetColumnInMatrix( VectDest, MatA, col )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetColumnInMatrix
|
||||
DESCRIPTION : Put a Vector to a column of a Matrix : Set columm col of MatDest with VectA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
col : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetColumnInMatrix( MatDest, VectA, col) \
|
||||
MTH3D_M_vSetColumnInMatrix( MatDest, VectA, col)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetLineInMatrix
|
||||
DESCRIPTION : Get a Vector line of a Matrix to a Vector : VectDest= line lin of MatA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetLineInMatrix( VectDest, MatA, lin ) \
|
||||
MTH3D_M_vGetLineInMatrix( VectDest, MatA, lin )
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetLineInMatrix
|
||||
DESCRIPTION : Put a Vector to a line of a Matrix : Set line lin of MatDest with VectA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
lin : int
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetLineInMatrix( MatDest, VectA, lin) \
|
||||
MTH3D_M_vSetLineInMatrix( MatDest, VectA, lin)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetDiagInMatrix
|
||||
DESCRIPTION : Get a Vector diagonal of a Matrix to a Vector : VectDest= diagonal of MatA
|
||||
INPUT : VectDest : address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetDiagInMatrix( VectDest, MatA) \
|
||||
MTH3D_M_vGetDiagInMatrix( VectDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetDiagInMatrix
|
||||
DESCRIPTION : Put a Vector to a diagonal of a Matrix : Set diagonal of MatDest with VectA
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetDiagInMatrix( MatDest, VectA) \
|
||||
MTH3D_M_vSetDiagInMatrix( MatDest, VectA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vGetVectorsInMatrix
|
||||
DESCRIPTION : Get all column Matrix to two Vectors
|
||||
INPUT : VaDest, VbDest, VcDest: address of sw_3D_tdstVector
|
||||
MatA : address of sw_3D_tdstMatrix
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA) \
|
||||
MTH3D_M_vGetVectorsInMatrix( VaDest, VbDest, VcDest, MatA)
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vSetVectorsInMatrix
|
||||
DESCRIPTION : Set all column Matrix with two Vectors
|
||||
INPUT : MatDest : address of sw_3D_tdstMatrix
|
||||
VectA, VectB, VectC : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
#define sw_3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC) \
|
||||
MTH3D_M_vSetVectorsInMatrix( MatDest, VectA, VectB, VectC)
|
||||
|
||||
|
||||
/* ##M==================================================================================
|
||||
NAME : sw_3D_M_vPrintfVector
|
||||
DESCRIPTION : Print a Vector : Name + its values
|
||||
INPUT : Name : string
|
||||
VectA : address of sw_3D_tdstVector
|
||||
OUTPUT : void
|
||||
=======================================================================================*/
|
||||
__inline void Pf_sw(td_sw _xValue)
|
||||
{
|
||||
printf( " %e",_xValue );
|
||||
}
|
||||
|
||||
|
||||
__inline void sw_3D_fn_vPrintfVector( char * Name, sw_3D_tdstVector * VectA)
|
||||
{
|
||||
MTH3D_M_vPrintfVector( Name, VectA );
|
||||
}
|
||||
|
||||
#define sw_3D_M_vPrintfVector( Name, VectA) sw_3D_fn_vPrintfVector( Name, VectA)
|
||||
|
||||
|
||||
|
||||
#endif /* sw_3D_H */
|
BIN
Rayman_X/cpa/public/MTH/TOC046.doc.lnk
Normal file
BIN
Rayman_X/cpa/public/MTH/TOC046.doc.lnk
Normal file
Binary file not shown.
Reference in New Issue
Block a user