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 00021 * 00022 */ 00023 00024 00025 #ifndef __EXCVEC2D_H__ 00026 #define __EXCVEC2D_H__ 00027 00028 #include "ExDefine.h" 00029 #include <math.h> 00030 #include <cmath> 00031 00032 class ExCVec2D 00033 { 00034 public: 00035 //-------------------------------- 00036 //Variable 00037 //-------------------------------- 00038 float m_Vector[2]; 00039 //-------------------------------- 00040 //Constructor // Destructor 00041 //-------------------------------- 00042 ExCVec2D(); 00043 ExCVec2D(float x,float y); 00044 ~ExCVec2D(); 00045 //-------------------------------- 00046 //Methode 00047 //-------------------------------- 00048 float GetVectorLenght(void); 00049 ExCVec2D GetVecNormale(void); 00050 void SetValue(float x,float y); 00051 inline void SetX(double val){m_Vector[0]=val;} 00052 inline void SetY(double val){m_Vector[1]=val;} 00053 inline double GetX(void){return m_Vector[0];} 00054 inline double GetY(void){return m_Vector[1];} 00055 //-------------------------------- 00056 // Operator 00057 //-------------------------------- 00058 ExCVec2D& operator=(const ExCVec2D& Vec); 00059 bool operator==(const ExCVec2D& Vec); 00060 ExCVec2D operator+(const ExCVec2D& Vec); 00061 ExCVec2D operator-(const ExCVec2D& Vec); 00062 ExCVec2D operator*(const ExCVec2D& Vec); 00063 ExCVec2D operator*(float scalar); 00064 ExCVec2D operator/(const ExCVec2D& Vec); 00065 ExCVec2D operator/(float scalar); 00066 //-------------------------------- 00067 // friends 00068 //-------------------------------- 00069 friend std::ostream& operator<<(std::ostream& s,const ExCVec2D &vec); 00070 00071 }; 00072 00073 #endif // __ExCVec2D_H__