/* ##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 */