00001
00007 #ifndef _VECTOR_H_
00008 #define _VECTOR_H_
00009
00010 #include "IsoBomb.h"
00011
00021 class Vector {
00022 public:
00023 Vector() : magx(0), magy(0), theta(0), mag(0) {}
00027 Vector(float magx2, float magy2) {initRect(magx2, magy2);}
00028
00032 void initRect(float magx2, float magy2);
00033
00037 void initPolar(float theta2, float mag2);
00038
00042 float getMagx() const {return magx;}
00043
00047 float getMagy() const {return magy;}
00048
00052 float getTheta() const {return theta;}
00053
00057 float getMag() const {return mag;}
00058
00062 void rotate(float rotation);
00063
00067 void add(const Vector& other);
00068
00072 void add(float scalar);
00073
00077 void clip(float max);
00078
00079
00080
00081
00085 void mult(float scalar);
00086
00091 void addTo(Point& other) const {
00092 other.x += magx;
00093 other.y += magy;
00094 }
00095
00100 void addTo(Rect& other) const {
00101 other.x += magx;
00102 other.y += magy;
00103 }
00104
00108 void setTheta( float rot );
00109
00110 private:
00111 float magx, magy;
00112 float theta, mag;
00113 };
00114
00115 #endif