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 CPOINT2D_H
00029 #define CPOINT2D_H
00030
00031 #include <mrpt/utils/CSerializable.h>
00032 #include <mrpt/poses/CPoint.h>
00033
00034 namespace mrpt
00035 {
00036 namespace poses
00037 {
00038 class CPose2D;
00039
00040 DEFINE_SERIALIZABLE_PRE( CPoint2D )
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class BASE_IMPEXP CPoint2D : public CPoint<CPoint2D>, public mrpt::utils::CSerializable
00054 {
00055
00056 DEFINE_SERIALIZABLE( CPoint2D )
00057
00058 public:
00059 mrpt::math::CArrayDouble<2> m_coords;
00060
00061 public:
00062
00063 inline CPoint2D(double x=0,double y=0) { m_coords[0]=x; m_coords[1]=y; }
00064
00065
00066 template <class OTHERCLASS>
00067 inline explicit CPoint2D(const CPoseOrPoint<OTHERCLASS> &b)
00068 {
00069 m_coords[0]=b.x();
00070 m_coords[1]=b.y();
00071 }
00072
00073
00074 inline CPoint2D(const mrpt::math::TPoint2D &o) { m_coords[0]=o.x; m_coords[1]=o.y; }
00075
00076
00077 inline explicit CPoint2D(const mrpt::math::TPoint3D &o) { m_coords[0]=o.x; m_coords[1]=o.y; m_coords[2]=0; }
00078
00079
00080
00081
00082 CPoint2D operator - (const CPose2D& b) const;
00083
00084 enum { is_3D_val = 0 };
00085 static inline bool is_3D() { return is_3D_val!=0; }
00086 enum { is_PDF_val = 0 };
00087 static inline bool is_PDF() { return is_PDF_val!=0; }
00088
00089
00090
00091 typedef double value_type;
00092 typedef double& reference;
00093 typedef const double& const_reference;
00094 typedef std::size_t size_type;
00095 typedef std::ptrdiff_t difference_type;
00096
00097
00098 enum { static_size = 2 };
00099 static inline size_type size() { return static_size; }
00100 static inline bool empty() { return false; }
00101 static inline size_type max_size() { return static_size; }
00102 static inline void resize(const size_t n) { if (n!=static_size) throw std::logic_error(format("Try to change the size of CPoint2D to %u.",static_cast<unsigned>(n))); }
00103
00104
00105 };
00106
00107
00108 }
00109 }
00110
00111 #endif