00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __POINT_H
00027 #define __POINT_H
00028
00029 #include <cmath>
00030
00035 class Point{
00036 public:
00037
00040 Point();
00041 virtual ~Point();
00042
00043 Point(double newx, double newy, double newz);
00044 Point(int newx, int newy, int newz);
00045 Point(unsigned int newx, unsigned int newy, unsigned int newz);
00046 Point(const Point &newpoint);
00048
00051 double& x() {return _x; };
00052 double& y() {return _y; };
00053 double& z() {return _z; };
00054
00055 int xint() const {return static_cast<int>(_x); };
00056 int yint() const {return static_cast<int>(_y); };
00057 int zint() const {return static_cast<int>(_z); };
00059
00062 Point operator-() const;
00063
00064 void operator += (const Point &other);
00065 void operator /= (const int divisor);
00066 void operator /= (const double divisor);
00067 void operator *= (const int factor);
00068 void operator *= (const double factor);
00069
00070 Point& operator=(const Point &other);
00071 Point operator+(const Point &other);
00072 Point operator-(const Point &other);
00073 Point operator-(const Point &other) const;
00074
00075 Point operator/(const double divisor);
00076 Point operator*(const double factor);
00077
00078 inline bool operator != (const Point &other) { return ( (xint() != other.xint() ) || (yint() != other.yint()) || (zint() != other.zint())); };
00079
00080 inline bool operator == (const Point &other) { return ( ( xint() == other.xint() ) && ( yint() == other.yint()) && ( zint() == other.zint())); };
00082
00083 inline double dot(Point Other) {
00084 return (_x*Other._x+_y*Other._y+_z*Other._z);
00085 };
00086
00087 inline Point cross(Point Other){
00088 return Point(_y*Other._z-Other._y*_z, _z*Other._x-_x*Other._z,
00089 _x*Other._y-_y*Other._x);
00090 };
00091
00092 inline double abs(){
00093 return sqrt(_x*_x+_y*_y+_z*_z);
00094 };
00095
00096 void normalize();
00097
00098 static Point TransMatMultiply( double* transMat, Point inPoint);
00099 protected:
00100 double _x;
00101 double _y;
00102 double _z;
00103 };
00104
00105 #endif // POINT_H