00001 #ifndef sw_mathH
00002 #define sw_mathH
00003
00004
00005 #include "glew.h"
00006 #include "sw_VertexList.h"
00007
00008
00010
00016 struct TPoint2
00017 {
00018 GLfloat x,y;
00019 };
00020
00022
00028 struct TPoint3
00029 {
00030 GLfloat x,y,z;
00031 };
00032
00034
00042 class CVector3
00043 {
00044 public:
00045 GLfloat x,y,z;
00046
00053 CVector3(GLfloat c_x=0.0,GLfloat c_y=0.0,GLfloat c_z=0.0);
00054
00060 CVector3(TVertex from,TVertex to);
00061 ~CVector3();
00062
00070 GLvoid Set(GLfloat p_x,GLfloat p_y,GLfloat p_z);
00071
00077 GLvoid Set(TVertex from,TVertex to);
00078
00084 GLvoid Normalize(GLfloat p_length=1.0);
00085
00090 GLfloat DotProd(CVector3 v);
00091
00097 GLfloat DotProd(TPoint3 p);
00098
00104 GLfloat DotProd(TVertex v);
00105
00114 GLvoid CrossProd(CVector3 v1,CVector3 v2,bool normalize=true);
00115 };
00116
00117
00118
00120
00128 struct TBoard
00129 {
00130 TPoint3 Position;
00131 GLfloat Length,
00132 Width,
00133 RotateX;
00134 CVector3 Direction;
00135 };
00136
00137
00139
00144 struct TPlane
00145 {
00146 CVector3 Normal;
00147 float d;
00148 };
00149
00150
00152
00158 class CMatrix
00159 {
00160 private:
00161 GLfloat Elements[16];
00162 public:
00167 CMatrix(bool c_SetIdentity=true);
00168 ~CMatrix();
00169
00175 GLfloat& operator[] (GLint index);
00176
00181 GLvoid SetIdentity();
00182
00189 GLvoid Set(GLfloat m0,GLfloat m1,GLfloat m2,GLfloat m3,
00190 GLfloat m4,GLfloat m5,GLfloat m6,GLfloat m7,
00191 GLfloat m8,GLfloat m9,GLfloat m10,GLfloat m11,
00192 GLfloat m12,GLfloat m13,GLfloat m14,GLfloat m15);
00193
00198 GLfloat *Get();
00199
00204 GLvoid CopyData(GLfloat *m);
00205 };
00206
00207
00208
00209 #endif