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

Vector3.h

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

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