00001 /* 00002 * ExNihilo 3D Engine 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 * Please read AUTHORS file !!! 00019 * 00020 * $Id: ExCVec3D.h,v 1.8 2002/11/09 16:09:40 data Exp $ 00021 * 00022 */ 00023 00024 00025 #ifndef __EXCVEC3D_H__ 00026 #define __EXCVEC3D_H__ 00027 00028 #include "ExDefine.h" 00029 #include <math.h> 00030 #include <cmath> 00031 00032 class ExCVec3D 00033 { 00034 public: 00035 //-------------------------------- 00036 //Variable 00037 //-------------------------------- 00038 float m_Vector[3]; 00039 //-------------------------------- 00040 //Constructor // Destructor 00041 //-------------------------------- 00042 ExCVec3D(); 00043 ExCVec3D(float x,float y,float z); 00044 ExCVec3D(float x,float y); 00045 ExCVec3D(float x); 00046 ExCVec3D(const ExCVec3D &vec); 00047 ~ExCVec3D(); 00048 //-------------------------------- 00049 //Methode 00050 //-------------------------------- 00051 float GetVectorLenght(void); 00052 ExCVec3D GetVecNormale(void); 00053 void SetValue(float x,float y,float z); 00054 inline void SetX(float val){m_Vector[0]=val;} 00055 inline void SetY(float val){m_Vector[1]=val;} 00056 inline void SetZ(float val){m_Vector[2]=val;} 00057 inline float GetX(void){return m_Vector[0];} 00058 inline float GetY(void){return m_Vector[1];} 00059 inline float GetZ(void){return m_Vector[2];} 00060 00061 inline void IncX(void){m_Vector[0]++;} 00062 inline void IncX(float ValueToAdd){m_Vector[0]+=ValueToAdd;} 00063 inline void IncY(void){m_Vector[1]++;} 00064 inline void IncY(float ValueToAdd){m_Vector[1]+=ValueToAdd;} 00065 inline void IncZ(void){m_Vector[2]++;} 00066 inline void IncZ(float ValueToAdd){m_Vector[2]+=ValueToAdd;} 00067 00068 inline void DecX(void){m_Vector[0]--;} 00069 inline void DecX(float ValueToAdd){m_Vector[0]-=ValueToAdd;} 00070 inline void DecY(void){m_Vector[1]--;} 00071 inline void DecY(float ValueToAdd){m_Vector[1]-=ValueToAdd;} 00072 inline void DecZ(void){m_Vector[2]--;} 00073 inline void DecZ(float ValueToAdd){m_Vector[2]-=ValueToAdd;} 00074 //-------------------------------- 00075 // Operator 00076 //-------------------------------- 00077 ExCVec3D& operator=(const ExCVec3D& Vec); 00078 bool operator==(const ExCVec3D& Vec); 00079 ExCVec3D operator+(const ExCVec3D& Vec); 00080 ExCVec3D operator+(float scalar); 00081 //ExCVec3D operator+=(const ExCVec3D& Vec); 00082 ExCVec3D operator++(); 00083 ExCVec3D operator++(int); 00084 ExCVec3D operator-(const ExCVec3D& Vec); 00085 ExCVec3D operator-(float scalar); 00086 //ExCVec3D operator-=(const ExCVec3D& Vec); 00087 ExCVec3D operator--(); 00088 ExCVec3D operator--(int); 00089 ExCVec3D operator*(const ExCVec3D& Vec); 00090 //ExCVec3D operator*=(const ExCVec3D& Vec); 00091 ExCVec3D operator*(float scalar); 00092 //ExCVec3D operator*=(float scalar); 00093 ExCVec3D operator/(const ExCVec3D& Vec); 00094 //ExCVec3D operator/=(const ExCVec3D& Vec); 00095 ExCVec3D operator/(float scalar); 00096 //ExCVec3D operator/=(float scalar); 00097 //-------------------------------- 00098 // friends 00099 //-------------------------------- 00100 friend std::ostream& operator<<(std::ostream& s,const ExCVec3D &vec); 00101 friend std::ostrstream& operator<<(std::ostrstream& s,const ExCVec3D &vec); 00102 }; 00103 00104 #endif // __EXCVEC3D_H__ 00105