Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/vector2d.h

00001 /***************************************************************************
00002  *            vector2d.h
00003  *
00004  *  Tue Sep  7 14:40:33 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024  
00025 #ifndef _VECTOR2D_H
00026 #define _VECTOR2D_H
00027 
00028 #ifdef WIN32
00029 #include <windows.h>
00030 #endif
00031 
00032 #include "build.h"
00033 
00034 
00035 
00036 namespace ngn
00037 {
00038         namespace core
00039         {
00040                 
00044                 class NGN_API Vector2df 
00045         {
00046         public:
00048                 Vector2df()
00049                         {
00050                                 x = y = 0.0f;
00051                         }
00052                         Vector2df( const Vector2df& other )
00053                         {
00054                                 x = other.x;
00055                                 y = other.y;
00056                         }
00057                 Vector2df(float X, float Y) 
00058                 { 
00059                         x = X; 
00060                                 y = Y;
00061                 }
00063                 Vector2df operator+(Vector2df V)
00064                 {
00065                         return Vector2df(V.x + x, V.y + y);
00066                 }
00067         
00068                 
00069                 Vector2df operator-(Vector2df vVector)
00070                 {
00071                         return Vector2df(x - vVector.x, y - vVector.y);
00072                 }
00073                 
00074                 Vector2df operator*(float num)
00075                 {
00076                         return Vector2df(x * num, y * num);
00077                 }
00078         
00079                 Vector2df operator/(float num)
00080                 {
00081                         return Vector2df(x / num, y / num);
00082                 }
00083 
00084         
00085                 float x, y;
00086         };
00087 
00088 
00089 
00090                 struct Vector2di
00091                 {
00092                         int x,y;
00093                 };
00094         
00095         
00096         
00097                 
00098                 
00099         }// core
00100 }//ngn
00101 
00102 #endif /* _VECTOR2D_H */
00103 

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1