00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CPointPDF_H 00029 #define CPointPDF_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/utils/CProbabilityDensityFunction.h> 00033 #include <mrpt/poses/CPoint3D.h> 00034 #include <mrpt/poses/CPosePDF.h> 00035 00036 namespace mrpt 00037 { 00038 namespace poses 00039 { 00040 using namespace mrpt::math; 00041 00042 00043 00044 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPointPDF, mrpt::utils::CSerializable ) 00045 00046 /** Declares a class that represents a Probability Distribution 00047 * function (PDF) of a 3D point (x,y,z). 00048 * This class is just the base class for unifying many diferent 00049 * ways this PDF can be implemented. 00050 * 00051 * For convenience, a pose composition is also defined for any 00052 * PDF derived class, changeCoordinatesReference, in the form of a method rather than an operator. 00053 * 00054 * For a similar class for 6D poses (a 3D point with attitude), see CPose3DPDF 00055 * 00056 * See also the tutorial on <a href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic spatial representations in the MRPT</a>. 00057 * 00058 * \sa CPoint3D 00059 * \ingroup poses_pdf_grp 00060 */ 00061 class BASE_IMPEXP CPointPDF : public mrpt::utils::CSerializable, public mrpt::utils::CProbabilityDensityFunction<CPoint3D,3> 00062 { 00063 DEFINE_VIRTUAL_SERIALIZABLE( CPointPDF ) 00064 00065 public: 00066 /** Copy operator, translating if necesary (for example, between particles and gaussian representations) 00067 */ 00068 virtual void copyFrom(const CPointPDF &o) = 0; 00069 00070 00071 /** Bayesian fusion of two point distributions (product of two distributions->new distribution), then save the result in this object (WARNING: See implementing classes to see classes that can and cannot be mixtured!) 00072 * \param p1 The first distribution to fuse 00073 * \param p2 The second distribution to fuse 00074 * \param minMahalanobisDistToDrop If set to different of 0, the result of very separate Gaussian modes (that will result in negligible components) in SOGs will be dropped to reduce the number of modes in the output. 00075 */ 00076 virtual void bayesianFusion( const CPointPDF &p1, const CPointPDF &p2, const double &minMahalanobisDistToDrop = 0) = 0 ; 00077 00078 enum { is_3D_val = 1 }; 00079 static inline bool is_3D() { return is_3D_val!=0; } 00080 enum { is_PDF_val = 1 }; 00081 static inline bool is_PDF() { return is_PDF_val!=0; } 00082 00083 /** Returns a 3D representation of this PDF. 00084 * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument. 00085 */ 00086 template <class OPENGL_SETOFOBJECTSPTR> 00087 inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR &out_obj) const { 00088 typedef typename OPENGL_SETOFOBJECTSPTR::value_type SETOFOBJECTS; 00089 *out_obj = *SETOFOBJECTS::posePDF2opengl(*this); 00090 } 00091 00092 /** Returns a 3D representation of this PDF. 00093 * \note Needs the mrpt-opengl library, and using mrpt::opengl::CSetOfObjectsPtr as template argument. 00094 */ 00095 template <class OPENGL_SETOFOBJECTSPTR,class OPENGL_SETOFOBJECTS> 00096 inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const { 00097 typedef typename OPENGL_SETOFOBJECTSPTR::value_type SETOFOBJECTS; 00098 return SETOFOBJECTS::posePDF2opengl(*this); 00099 } 00100 00101 }; // End of class def. 00102 00103 00104 } // End of namespace 00105 } // End of namespace 00106 00107 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |