MRPT  1.9.9
CPointPDF.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef CPointPDF_H
10 #define CPointPDF_H
11 
14 #include <mrpt/poses/CPoint3D.h>
15 #include <mrpt/poses/CPosePDF.h>
16 
17 namespace mrpt::poses
18 {
19 /** Declares a class that represents a Probability Distribution
20  * function (PDF) of a 3D point (x,y,z).
21  * This class is just the base class for unifying many diferent
22  * ways this PDF can be implemented.
23  *
24  * For convenience, a pose composition is also defined for any
25  * PDF derived class, changeCoordinatesReference, in the form of a method
26  * rather than an operator.
27  *
28  * For a similar class for 6D poses (a 3D point with attitude), see CPose3DPDF
29  *
30  * See also the tutorial on <a
31  * href="http://www.mrpt.org/Probability_Density_Distributions_Over_Spatial_Representations">probabilistic
32  * spatial representations in the MRPT</a>.
33  *
34  * \sa CPoint3D
35  * \ingroup poses_pdf_grp
36  */
38  public mrpt::math::CProbabilityDensityFunction<CPoint3D, 3>
39 {
41 
42  public:
43  /** Copy operator, translating if necesary (for example, between particles
44  * and gaussian representations)
45  */
46  virtual void copyFrom(const CPointPDF& o) = 0;
47 
48  /** Bayesian fusion of two point distributions (product of two
49  * distributions->new distribution), then save the result in this object
50  * (WARNING: See implementing classes to see classes that can and cannot be
51  * mixtured!)
52  * \param p1 The first distribution to fuse
53  * \param p2 The second distribution to fuse
54  * \param minMahalanobisDistToDrop If set to different of 0, the result of
55  * very separate Gaussian modes (that will result in negligible components)
56  * in SOGs will be dropped to reduce the number of modes in the output.
57  */
58  virtual void bayesianFusion(
59  const CPointPDF& p1, const CPointPDF& p2,
60  const double minMahalanobisDistToDrop = 0) = 0;
61 
62  virtual void changeCoordinatesReference(
63  const CPose3D& newReferenceBase) = 0;
64 
65  enum
66  {
68  };
69  static constexpr bool is_3D() { return is_3D_val != 0; }
70  enum
71  {
73  };
74  static constexpr bool is_PDF() { return is_PDF_val != 0; }
75  /** Returns a 3D representation of this PDF (it doesn't clear the current
76  * contents of out_obj, but append new OpenGL objects to that list)
77  * \note Needs the mrpt-opengl library, and using
78  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
79  * \note By default, ellipsoids for the confidence intervals of "q=3" are
80  * drawn; for more mathematical details, see
81  * CGeneralizedEllipsoidTemplate::setQuantiles()
82  */
83  template <class OPENGL_SETOFOBJECTSPTR>
84  inline void getAs3DObject(OPENGL_SETOFOBJECTSPTR& out_obj) const
85  {
86  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::element_type;
87  out_obj->insertCollection(*SETOFOBJECTS::posePDF2opengl(*this));
88  }
89 
90  /** Returns a 3D representation of this PDF.
91  * \note Needs the mrpt-opengl library, and using
92  * mrpt::opengl::CSetOfObjects::Ptr as template argument.
93  */
94  template <class OPENGL_SETOFOBJECTSPTR, class OPENGL_SETOFOBJECTS>
95  inline OPENGL_SETOFOBJECTSPTR getAs3DObject() const
96  {
97  using SETOFOBJECTS = typename OPENGL_SETOFOBJECTSPTR::value_type;
98  return SETOFOBJECTS::posePDF2opengl(*this);
99  }
100 
101 }; // End of class def.
102 }
103 #endif
104 
105 
static constexpr bool is_3D()
Definition: CPointPDF.h:69
virtual void bayesianFusion(const CPointPDF &p1, const CPointPDF &p2, const double minMahalanobisDistToDrop=0)=0
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!)
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
void getAs3DObject(OPENGL_SETOFOBJECTSPTR &out_obj) const
Returns a 3D representation of this PDF (it doesn&#39;t clear the current contents of out_obj...
Definition: CPointPDF.h:84
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
CSetOfObjects::Ptr posePDF2opengl(const POSE_PDF &o)
Returns a representation of a the PDF - this is just an auxiliary function, it&#39;s more natural to call...
Definition: pose_pdfs.h:22
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:86
static constexpr bool is_PDF()
Definition: CPointPDF.h:74
OPENGL_SETOFOBJECTSPTR getAs3DObject() const
Returns a 3D representation of this PDF.
Definition: CPointPDF.h:95
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:30
virtual void changeCoordinatesReference(const CPose3D &newReferenceBase)=0
virtual void copyFrom(const CPointPDF &o)=0
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x...
Definition: CPointPDF.h:37
A generic template for probability density distributions (PDFs).



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020