Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Composants | Déclarations

Vector2.h

Aller à la documentation de ce fichier.
00001 /*=========================================================================
00002 UberSim Source Code Release
00003 -------------------------------------------------------------------------
00004 Copyright (C) 2002 Manuela Veloso, Brett Browning, Mike Bowling,
00005                    James Bruce; {mmv, brettb, mhb, jbruce}@cs.cmu.edu
00006                    Erick Tryzelaar {erickt}@andrew.cmu.edu
00007 School of Computer Science, Carnegie Mellon University
00008 -------------------------------------------------------------------------
00009 This software is distributed under the GNU General Public License,
00010 version 2.  If you do not have a copy of this licence, visit
00011 www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
00012 Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
00013 in the hope that it will be useful, but WITHOUT ANY WARRANTY,
00014 including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00015 -------------------------------------------------------------------------*/
00016 
00017 #ifndef __SIM_VECTOR2_H__
00018 #define __SIM_VECTOR2_H__
00019 
00020 #include "Math.h"
00026 class Vector2
00027 {
00028     public:
00029         static const Vector2 ZERO;
00030         static const Vector2 UNIT_X;
00031         static const Vector2 UNIT_Y;
00032     
00033     public:
00034         Real x;
00035         Real y;
00036         
00037     public:
00038         Vector2  ();
00039         Vector2  (Real x, Real y);
00040         Vector2  (const Vector2& vector);
00041         ~Vector2 ();
00042 
00043     public:
00044         Real& operator [] (const unsigned int i) const;
00045         operator Real* ();
00046 
00047         void operator  = (const Vector2& vector);
00048         void operator += (const Real     scalar);
00049         void operator += (const Vector2& vector);
00050         void operator -= (const Real     scalar);
00051         void operator -= (const Vector2& vector);
00052         void operator *= (const Real     scalar);
00053 
00054         Vector2 operator + (const Real     scalar) const;
00055         Vector2 operator + (const Vector2& vector) const;
00056         Vector2 operator - (const Real     scalar) const;
00057         Vector2 operator - (const Vector2& vector) const;
00058         Vector2 operator * (const Real     scalar) const;
00059         Vector2 operator / (const Real     scalar) const;
00060     
00061         friend Vector2 operator + (const Real scalar, const Vector2& vector);
00062         friend Vector2 operator - (const Real scalar, const Vector2& vector);
00063         friend Vector2 operator * (const Real scalar, const Vector2& vector);
00064     
00065     public:
00066         Real    dot           (const Vector2& vector) const;
00067         Real    lengthSquared ();
00068         Real    length        ();
00069         Vector2 unit          ();
00070 };
00071 
00072 #endif

Généré le Mon Mar 1 01:29:41 2004 par doxygen 1.3.3