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

Vector2.h

Go to the documentation of this file.
00001 #ifndef _VECTOR2_H_
00002 #define _VECTOR2_H_
00003 
00004 #include <iostream>
00005 using namespace std;
00006 
00007 class Vector2
00008 {
00009  public:
00010   Vector2();
00011   Vector2(double u, double v);
00012   Vector2(double *points);
00013   virtual ~Vector2();
00014 
00015   // overloaded operators
00016   Vector2 operator+(Vector2 v1);
00017   Vector2 operator-(Vector2 v1);
00018   Vector2 operator*(double num);
00019   Vector2 operator/(double num);
00020 
00021   // Overloaded print
00022   friend ostream &operator<<(ostream &out, Vector2 &a);
00023   
00024   // setter functions
00025   void set(double u, double v);
00026   void set(double *points);
00027   void setU(double u) { _points[0] = u; }
00028   void setV(double v) { _points[1] = v; }
00029 
00030   // getter functions
00031   double *getVector() { return _points; }
00032   double getU() { return _points[0]; }
00033   double getV() { return _points[1]; }
00034 
00035  protected:
00036   double _points[2];
00037 };
00038 
00039 #endif

Generated on Wed Apr 21 11:10:53 2004 for naturecalls by doxygen1.2.18