00001 #ifndef POINT_3D_HPP
00002 #define POINT_3D_HPP
00003
00004 #include "jmath/jblas.hpp"
00005 #include <iostream>
00006
00007 namespace jafar {
00009 namespace model3d {
00010
00016 class Point3D
00017 {
00018 public:
00019 enum STATE {BAD_POINT=0, GOOD_POINT=1};
00020
00021
00022 Point3D();
00023 virtual ~Point3D(){};
00025 Point3D(const Point3D&);
00027 Point3D(double x, double y, double z, double w=1);
00029 Point3D& operator=(const Point3D&);
00030
00034 inline bool isGoodPoint(){ return state==GOOD_POINT;}
00035
00036 inline double x() const {return coord[0];}
00037 inline double y() const {return coord[1];}
00038 inline double z() const {return coord[2];}
00039 inline double w() const {return coord[3];}
00040
00041
00042
00047 inline double& operator() (int index)
00048 {return coord(index);}
00053 inline double& operator[] (int index)
00054 {return coord(index);}
00055
00057 void setCoord(double x, double y, double z, double w=1);
00058
00060 jblas::vec4& getCoord()
00061 {return coord;}
00062
00064 virtual void clear();
00065
00067 friend std::ostream& operator<< (std::ostream& os, const Point3D& pt);
00069 friend std::istream& operator>> (std::istream& is, Point3D& pt);
00070
00072 enum COORD_INDEX {X=0, Y=1, Z=2, W=3};
00073
00074
00077 jblas::vec4 coord;
00078
00082 Point3D::STATE state;
00083 };
00084
00085 }
00086 }
00087
00088 #endif //POINT_3D_HPP