Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CPOINT3D_H
00029 #define CPOINT3D_H
00030
00031 #include <mrpt/poses/CPoint.h>
00032 #include <mrpt/poses/CPose3D.h>
00033
00034 namespace mrpt
00035 {
00036 namespace poses
00037 {
00038 DEFINE_SERIALIZABLE_PRE( CPoint3D )
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 class BASE_IMPEXP CPoint3D : public CPoint<CPoint3D>, public mrpt::utils::CSerializable
00052 {
00053
00054 DEFINE_SERIALIZABLE( CPoint3D )
00055
00056 public:
00057 mrpt::math::CArrayDouble<3> m_coords;
00058
00059 public:
00060
00061 inline CPoint3D(const double x=0,const double y=0,const double z=0) { m_coords[0]= x; m_coords[1]=y; m_coords[2]=z; }
00062
00063
00064 explicit inline CPoint3D(const mrpt::math::CArrayDouble<3> &xyz) : m_coords(xyz) { }
00065
00066
00067 CPoint3D( const CPoint2D &p);
00068
00069
00070 explicit inline CPoint3D( const CPose3D &p) { m_coords[0]=p.x(); m_coords[1]=p.y(); m_coords[2]=p.z(); }
00071
00072
00073 explicit CPoint3D( const CPose2D &p);
00074
00075
00076 inline CPoint3D(const mrpt::math::TPoint3D &p) { m_coords[0]=p.x; m_coords[1]=p.y; m_coords[2]=p.z; }
00077
00078
00079 CPoint3D operator - (const CPose3D& b) const;
00080
00081
00082 CPoint3D operator - (const CPoint3D& b) const;
00083
00084
00085 CPoint3D operator + (const CPoint3D& b) const;
00086
00087
00088 CPose3D operator + (const CPose3D& b) const;
00089
00090
00091 enum { is_3D_val = 1 };
00092 static inline bool is_3D() { return is_3D_val!=0; }
00093
00094 enum { is_PDF_val = 0 };
00095 static inline bool is_PDF() { return is_PDF_val!=0; }
00096
00097
00098
00099 typedef double value_type;
00100 typedef double& reference;
00101 typedef const double& const_reference;
00102 typedef std::size_t size_type;
00103 typedef std::ptrdiff_t difference_type;
00104
00105
00106
00107 enum { static_size = 3 };
00108 static inline size_type size() { return static_size; }
00109 static inline bool empty() { return false; }
00110 static inline size_type max_size() { return static_size; }
00111 static inline void resize(const size_t n) { if (n!=static_size) throw std::logic_error(format("Try to change the size of CPoint3D to %u.",static_cast<unsigned>(n))); }
00112
00113
00114 };
00115
00116
00117 }
00118 }
00119
00120 #endif