00001 #ifndef GEOMETRY_ 00002 #define GEOMETRY_ 00003 00004 #include <math.h> 00005 00006 #define MY_PI 3.141592f 00007 00013 typedef struct AABoundingBox 00014 { 00015 float xmin; 00016 float xmax; 00017 float ymin; 00018 float ymax; 00019 float zmin; 00020 float zmax; 00021 }BoundingBox; 00022 00028 typedef struct Point3D 00029 { 00030 float x; 00031 float y; 00032 float z; 00033 }Vector, Point; 00034 00040 typedef struct BoundingBoxCorners 00041 { 00042 Point p[8]; 00043 }BoxCorners; 00044 00050 typedef struct Plane3D 00051 { 00052 Vector n; 00053 float d; 00054 }Plane; 00055 00061 class Geometry 00062 { 00063 public: 00064 00072 static Point PlaneIntersection (const Plane& p1, const Plane& p2, const Plane& p3); 00073 00083 static void InvertHomogenousMatrix (double * src, double * dest); 00084 00094 static void InvertHomogenousMatrix (float * src, float * dest); 00095 00106 static void MatrixMultiply (double * m1, double * m2, double * dest); 00107 00117 static void VectorMultiply (float * m, const Vector & vect, Vector & res); 00118 00124 static void VectorNormalize (Vector & vect); 00125 00131 static float VectorLength (Vector & vect); 00132 00140 static float EnclosingAngle (Vector & v1, Vector & v2); 00141 00149 static Vector CrossProduct (const Vector& v1, const Vector& v2); 00150 00158 static float ScalarProduct (const Vector &v1, const Vector &v2); 00159 00160 private: 00164 Geometry (); 00165 }; 00166 00167 #endif