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
00029 #ifndef CDetectableObject_H
00030 #define CDetectableObject_H
00031
00032 #include <mrpt/utils/CSerializable.h>
00033 #include <mrpt/slam/CObservation.h>
00034
00035 #include <mrpt/detectors/link_pragmas.h>
00036
00037 namespace mrpt
00038 {
00039 namespace detectors
00040 {
00041 using namespace mrpt::slam;
00042
00043 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDetectableObject, mrpt::utils::CSerializable, DETECTORS_IMPEXP )
00044
00045
00046
00047
00048
00049 class DETECTORS_IMPEXP CDetectableObject: public mrpt::utils::CSerializable
00050 {
00051 DEFINE_VIRTUAL_SERIALIZABLE( CDetectableObject )
00052
00053 public:
00054
00055 std::string m_id;
00056
00057 CObservationPtr obs;
00058
00059 inline void setObservation( CObservationPtr newObs ){ obs = newObs; };
00060
00061 };
00062
00063
00064 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDetectable2D, mrpt::detectors::CDetectableObject, DETECTORS_IMPEXP )
00065
00066 class DETECTORS_IMPEXP CDetectable2D: public CDetectableObject
00067 {
00068 DEFINE_SERIALIZABLE( CDetectable2D )
00069
00070 public:
00071
00072 float m_x, m_y;
00073 float m_height, m_width;
00074
00075
00076 CDetectable2D( const int &x = 0, const int &y = 0, const int &height = 0, const int &width = 0 )
00077 : m_x(x), m_y(y), m_height(height), m_width(width)
00078 {};
00079
00080
00081 CDetectable2D( const CDetectable2D *d )
00082 {
00083 *this = *d;
00084 };
00085
00086
00087
00088
00089 inline double distanceTo( const CDetectable2D &d2 )
00090 {
00091
00092 double c_x1 = ( m_x + m_width/2 );
00093 double c_x2 = ( d2.m_x + d2.m_width/2 );
00094 double c_y1 = ( m_y + m_height/2 ) ;
00095 double c_y2 = ( d2.m_y + d2.m_height/2 ) ;
00096
00097 return sqrt( pow( c_x1 - c_x2, 2 ) + pow( c_y1 - c_y2, 2 ) );
00098 };
00099
00100 };
00101
00102
00103 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDetectable3D, mrpt::detectors::CDetectable2D, DETECTORS_IMPEXP )
00104
00105 class DETECTORS_IMPEXP CDetectable3D: public CDetectable2D
00106 {
00107 DEFINE_SERIALIZABLE( CDetectable3D )
00108
00109 public:
00110
00111 CDetectable3D(){};
00112
00113 CDetectable3D( const CDetectable2DPtr &object2d )
00114 : CDetectable2D( object2d.pointer() ), m_z(0)
00115 { };
00116
00117
00118 CDetectable3D( const CDetectable3D *d )
00119 {
00120 *this = *d;
00121 };
00122
00123
00124 float m_z;
00125
00126 };
00127 }
00128
00129 }
00130
00131 #endif