www.pudn.com > View3D.zip > GA_math.h
#ifndef GA_MATH_H
#define GA_MATH_H
#define ABS(x) ((x)<0 ? -(x) : (x))
#define SWAP(type, a, b) {type sw_ap; sw_ap = (a); (a)=(b); (b)=sw_ap; }
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#include
#include
#define PI 3.14159265358979323846
#define SQRT2 1.41421356237309504880
class GAMath
{
public:
static void Mat3Transp(float mat[][3]);
static void Mat4Transp(float mat[][4]);
//calculate inverse matrix
static int Mat4Invert(float inverse[][4], float mat[][4]);
static void Mat4MulMat4(float m1[][4], float m2[][4], float m3[][4]);
//calculate det(A)
static float Det2x2(float a,float b,float c,float d);
static float Det3x3(float a1, float a2, float a3,
float b1, float b2, float b3,
float c1, float c2, float c3 );
static float Det4x4(float m[][4]);
//vector operations
//normalise a vector
static float Normalise(float * n);
//calculate cross of two vector c = a cross b
static void Crossf(float *c, float *a, float *b);
//c = a - b;
static void Subtract(float *c, float * a, float *b);
};
#endif