Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

WP_Vector2D.h

Go to the documentation of this file.
00001 /* Copyright (C) 2001 W.P. van Paassen - peter@paassen.tmfweb.nl
00002 
00003    This program is free software; you can redistribute it and/or modify it under
00004    the terms of the GNU General Public License as published by the Free
00005    Software Foundation; either version 2 of the License, or (at your
00006    option) any later version.
00007 
00008    This program is distributed in the hope that it will be useful, but WITHOUT
00009    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00010    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00011    for more details.
00012 
00013    You should have received a copy of the GNU General Public License
00014    along with this program; see the file COPYING.  If not, write to the Free
00015    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
00016 
00017 #ifndef WP_Vector2D_H
00018 #define WP_Vector2D_H
00019 
00020 #include "WP_Def.h"
00021 
00022 namespace WPCG
00023 {
00024 //forward declarations
00025 class WP_Matrix2D;
00026 
00045 class WP_Vector2D
00046 {
00047 public:
00048   WP_Vector2D();
00049   
00054   WP_Vector2D(scalar x, scalar y);
00055 
00056   ~WP_Vector2D(){};
00057   
00063   WP_Vector2D& operator=(const WP_Vector2D& v);
00064   
00070   scalar operator*(const WP_Vector2D & v) const;
00071 
00077   WP_Vector2D operator*(scalar s) const; 
00078 
00084   WP_Vector2D operator/(scalar s) const;
00085 
00091   WP_Vector2D operator-(const WP_Vector2D& v) const;
00092 
00098   WP_Vector2D operator+(const WP_Vector2D& v) const;
00099   
00104   WP_Vector2D& operator-();
00105 
00111   WP_Vector2D& operator-=(const WP_Vector2D& v);
00112   
00118   WP_Vector2D& operator+=(const WP_Vector2D& v);
00119 
00125   WP_Vector2D& operator*=(scalar s);
00126 
00132   WP_Vector2D& operator/=(scalar s);
00133   
00139   WP_Vector2D& operator*=(const WP_Matrix2D& m);
00140 
00146   WP_Vector2D operator*(const WP_Matrix2D& m) const;
00147   
00152   scalar length() const;
00153 
00158   scalar normalize();
00159 
00163   void perp();
00164   
00170   scalar getDegreesBetween(const WP_Vector2D& v) const;
00171   
00177   scalar getRadsBetween(const WP_Vector2D& v) const;
00178 
00184   bool orthogonal(const WP_Vector2D& v) const;
00185 
00190   void richochet(WP_Vector2D v);
00191 
00197   void draw(scalar startx, scalar starty) const;
00198   
00202   scalar data[3];
00203 };
00204 }
00205 #endif
00206 

Generated on Tue Jan 28 20:26:35 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002