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



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020