00001
00002
00003 #ifndef LOCALIZER_POINT_2D_3D_HPP
00004 #define LOCALIZER_POINT_2D_3D_HPP
00005
00006 #include "kernel/jafarException.hpp"
00007 #include "jmath/jblas.hpp"
00008
00009 namespace jafar {
00010
00011 namespace localizer {
00016 class Point2d3d {
00017
00018 private:
00022 jblas::vec2 m_2dCoordinates;
00023 jblas::vec3 m_3dCoordinates;
00024 public:
00026 Point2d3d(const jblas::vec2& _2dCoordinates = jblas::zero_vec(2),
00027 const jblas::vec3& _3dCoordinates = jblas::zero_vec(3));
00028 Point2d3d(const double &u, const double &v,
00029 const double &x, const double &y, const double &z)
00030 {
00031 m_2dCoordinates[0] = u;
00032 m_2dCoordinates[1] = v;
00033 m_3dCoordinates[0] = x;
00034 m_3dCoordinates[1] = y;
00035 m_3dCoordinates[2] = z;
00036 }
00038 Point2d3d(const Point2d3d& p);
00040 ~Point2d3d();
00041
00042
00043 const jblas::vec2& get2dCoordinates() const;
00044 const jblas::vec3& get3dCoordinates() const;
00045 double getU() const;
00046 double getV() const;
00047 double getX() const;
00048 double getY() const;
00049 double getZ() const;
00050
00051
00052 void set2dCoordinates(const jblas::vec2& _2dCoordinates);
00053 void set3dCoordinates(const jblas::vec3& _3dCoordinates);
00054 void setU(const double& value);
00055 void setV(const double& value);
00056 void setX(const double& value);
00057 void setY(const double& value);
00058 void setZ(const double& value);
00062 static Point2d3d toJafar(const Point2d3d& src);
00066 static Point2d3d toCalife(const Point2d3d& src);
00068 friend std::ostream& operator<<(std::ostream&, const Point2d3d&);
00069 };
00070
00072 typedef std::vector<localizer::Point2d3d> Points2d3d;
00074 typedef Points2d3d::iterator Points2d3dIter;
00076 typedef Points2d3d::const_iterator Points2d3dIter_const;
00077 std::ostream& operator<<(std::ostream& s, const localizer::Point2d3d& p);
00078
00083 static void fromCalifeToJafar(const Points2d3d& src, Points2d3d& dst) {
00084 if(src.size() != dst.size())
00085 dst.resize(src.size());
00086 Points2d3dIter_const iter;
00087 for(iter = src.begin();
00088 iter != src.end();
00089 iter++) {
00090 Point2d3d jafarean = Point2d3d::toJafar(*iter);
00091 dst.push_back(jafarean);
00092 }
00093 }
00094
00099 static void fromJafarToCalife(const Points2d3d& src, Points2d3d& dst) {
00100 if(src.size() != dst.size())
00101 dst.resize(src.size());
00102 Points2d3dIter_const iter;
00103 for(iter = src.begin();
00104 iter != src.end();
00105 iter++) {
00106 Point2d3d califean = Point2d3d::toCalife(*iter);
00107 dst.push_back(califean);
00108 }
00109 }
00110
00111 }
00112
00113 }
00114 #endif