/************************************************ * * Project Information: Classe Vecteur 3D * * Filename: CVector3.h * Version : 0.0.1-dev * Last Update: 23-01-2004 * * Author: Romain Gaucher -- nEUrOO * E-mail: neuroo@kouette.com * Date : 23-01-2004 * * Comment: Opération sur les vecteurs * ***********************************************/ #ifndef __M_CVECTOR3_H #define __M_CVECTOR3_H #include #define SQR(x) (x*x) #define NULL_VECTOR MakeVect3(0.0f,0.0f,0.0f) class CVector3 { public: float x,y,z; CVector3(): x(0.0f),y(0.0f),z(0.0f) {} CVector3(float u, float v, float w) { x = u, y = v, w = z; } ~CVector3() {} CVector3 operator+ (const CVector3& u) { CVector3 res; res.x = x+u.x; res.y = y+u.y; res.z = z+u.z; return res; } CVector3 operator- (const CVector3& u) { CVector3 res; res.x = x-u.x; res.y = y-u.y; res.z = z-u.z; return res; } CVector3 operator* (float r) { CVector3 res; res.x = x*r; res.y = y*r; res.z = z*r; return res; } float operator* (CVector3 u) //dot_prod { return x*u.x+y*u.y+z*u.z; } void GetValues(float &u, float &v, float &w) { u = x; v = y; w = z; } }; float GetNorm(CVector3 * v); CVector3 MakeVect3(float u, float v, float w); CVector3 Normalize(CVector3 v); CVector3 CrossProduct (CVector3 * u, CVector3 * v); #endif /************************************************ * * 23-01-2004: Creation du source (Romain) * Classe finie ! * ***********************************************/