00001 00007 #ifndef VECTOR3D_JIP695 00008 #define VECTOR3D_JIP695 00009 00010 #include "Point3D.h" 00011 00017 class Vector3D { 00018 public: 00019 Vector3D() : magx(0.0f), magy(0.0f), magz(0.0f) {} 00020 00024 Vector3D( float magx, float magy, float magz ) { 00025 initRect( magx, magy, magz ); 00026 } 00027 00031 ~Vector3D() {} 00032 00036 void initRect( float magx, float magy, float magz ); 00037 00047 void initSphere( float r, float theta, float phi ); 00048 00052 float getMagx() const {return magx;} 00053 00057 float getMagy() const {return magy;} 00058 00062 float getMagz() const {return magz;} 00063 00067 void mult( float scalar ); 00068 00072 void multX( float scalar ); 00073 00077 void multY( float scalar ); 00078 00082 void multZ( float scalar ); 00083 00087 void add(const Vector3D& other); 00088 00092 Vector3D& operator += ( const Vector3D& rhs ); 00093 00098 void addTo( Point3D& other ) const { 00099 other.x += magx; 00100 other.y += magy; 00101 other.z += magz; 00102 } 00103 00104 private: 00105 float magx, magy, magz; 00106 }; 00107 00108 #endif