00001
00007 #ifndef POINT_H_KWER341
00008 #define POINT_H_KWER341
00009
00010 #include "IsoBomb.h"
00011
00018 class Point {
00019 public:
00020 float x;
00021 float y;
00022
00026 Point() : x(0.0f), y(0.0f) {}
00027
00031 Point(float x2, float y2) : x(x2), y(y2) {}
00032
00036 void init(float x2, float y2) {
00037 x = x2;
00038 y = y2;
00039 }
00040
00044 float distFromOrigin() const {
00045 return (float)(fabs(sqrt(x*x+y*y)));
00046 }
00047
00051 float distTo(const Point& other) const {
00052 return (float)(fabs(sqrt( sq(other.x-x) + sq(other.y-y) )));
00053 }
00054
00059 float thetaTo(const Point& other) const {
00060 return (float)(atan2(other.y-y, other.x-x));
00061 }
00062
00063 bool operator<( const Point& rhs ) const {
00064 if( x == rhs.x ) {
00065 return y < rhs.y;
00066 }
00067 else {
00068 return x < rhs.x;
00069 }
00070 }
00071
00072 protected:
00073 private:
00074 };
00075
00076 #endif