Template Class CGeneralizedEllipsoidTemplate
Defined in File CGeneralizedEllipsoidTemplate.h
Inheritance Relationships
Base Types
public mrpt::viz::CVisualObject(Class CVisualObject)public mrpt::viz::VisualObjectParams_Lines(Class VisualObjectParams_Lines)public mrpt::viz::VisualObjectParams_Triangles(Class VisualObjectParams_Triangles)
Class Documentation
-
template<int DIM>
class CGeneralizedEllipsoidTemplate : public virtual mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Lines, public mrpt::viz::VisualObjectParams_Triangles A class that generalizes the concept of an ellipsoid to arbitrary parameterizations of uncertainty shapes in either 2D or 3D. See derived classes for examples.
Please read the documentation of CGeneralizedEllipsoidTemplate::setQuantiles() for learning the mathematical details about setting the desired confidence interval.
The main method to set the modeled uncertainty is setCovMatrixAndMean()
By default, only the front faces are rendered. Use cullFaces() to change if needed.
- Template Parameters:
DIM – The dimensionality of the parameter space, which must coincide with that of the rendering space (2 or 3)
Public Types
-
using cov_matrix_t = mrpt::math::CMatrixFixed<double, DIM, DIM>
The type of fixed-size covariance matrices for this representation
Public Functions
-
template<typename MATRIX, typename VECTOR>
inline void setCovMatrixAndMean(const MATRIX &new_cov, const VECTOR &new_mean) Set the NxN covariance matrix that will determine the aspect of the ellipsoid - Notice that the covariance determines the uncertainty in the parameter space, which would be transformed by derived function
-
inline cov_matrix_t getCovMatrix() const
Gets the current uncertainty covariance of parameter space
-
template<typename MATRIX>
inline void setCovMatrix(const MATRIX &new_cov) Like setCovMatrixAndMean(), for mean=zero.
-
inline void setQuantiles(float q)
Changes the scale of the “sigmas” for drawing the ellipse/ellipsoid (default=3, ~97 or ~98% CI); the exact mathematical meaning is: This value of “quantiles” q should be set to the square root of the chi-squared inverse cdf corresponding to the desired confidence interval. Note that this value depends on the dimensionality. Refer to the MATLAB functions chi2inv() and chi2cdf().
Some common values follow here for the convenience of users:
Dimensionality=3 (3D ellipsoids):
19.8748% CI -> q=1
73.8536% CI -> q=2
97.0709% CI -> q=3
99.8866% CI -> q=4
Dimensionality=2 (2D ellipses):
39.347% CI -> q=1
86.466% CI -> q=2
98.8891% CI -> q=3
99.9664% CI -> q=4
Dimensionality=1 (Not aplicable to this class but provided for reference):
68.27% CI -> q=1
95.45% CI -> q=2
99.73% CI -> q=3
99.9937% CI -> q=4
-
inline float getQuantiles() const
Refer to documentation of setQuantiles()
-
inline void setNumberOfSegments(const uint32_t numSegments)
Set the number of segments of the surface/curve (higher means with greater resolution)
-
inline uint32_t getNumberOfSegments() const
-
inline void enableDrawSolid3D(bool v)
If set to “true”, a whole ellipsoid surface will be drawn, or if set to “false” (default) it will be drawn as a “wireframe”.
-
inline virtual bool traceRay([[maybe_unused]] const mrpt::poses::CPose3D &o, [[maybe_unused]] double &dist) const override
Ray tracing
-
inline virtual void updateBuffers() const override
Called by the rendering system to update internal geometry buffers.
Derived classes should override this to populate their data buffers (triangles, points, lines) when the object geometry changes.
This is called automatically when hasToUpdateBuffers() returns true, which happens after notifyChange() was called.
The base implementation does nothing; derived classes should override.
Note
Thread safety: implementations should lock the appropriate mutexes when writing to shared buffers.
-
inline virtual const mrpt::rtti::TRuntimeClassId *GetRuntimeClass() const override
Protected Functions
-
virtual void transformFromParameterSpace(const std::vector<array_point_t> ¶ms_pts, std::vector<array_point_t> &out_pts) const = 0
To be implemented by derived classes: maps, using some arbitrary space transformation, a list of points defining an ellipsoid in parameter space into their corresponding points in 2D/3D space.
-
inline void thisclass_writeToStream(mrpt::serialization::CArchive &out) const
-
inline void thisclass_readFromStream(mrpt::serialization::CArchive &in)
-
CGeneralizedEllipsoidTemplate() = default
-
virtual ~CGeneralizedEllipsoidTemplate() override = default
-
void generatePoints(const cov_matrix_t &U, std::vector<array_parameter_t> &out_params_pts) const
-
inline void recomputeRenderPoints() const
When called, if m_needToRecomputeEigenVals==true, the points in m_render_pts will be regenerated.
-
inline virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const override
Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates. This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.
See also
getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()
-
void implUpdate_Wireframe() const
-
void implUpdate_Triangles() const
Protected Attributes
-
mutable mrpt::containers::NonCopiableData<std::shared_mutex> m_ellipsoidDataMtx
-
mutable cov_matrix_t m_cov
-
mean_vector_t m_mean
-
mutable bool m_needToRecomputeEigenVals = {true}
-
float m_quantiles = {3.f}
The number of “sigmas” for drawing the ellipse/ellipsoid (default=3)
-
uint32_t m_numSegments = {20}
Number of segments in 2D/3D ellipsoids (default=20)
-
mutable mrpt::math::TPoint3D m_bb_min = {0, 0, 0}
bounding boxes, in object local coordinates
-
mrpt::math::TPoint3D m_bb_max = {0, 0, 0}
-
bool m_drawSolid3D = {false}
If set to “true”, a whole ellipsoid surface will be drawn, or if set to “false” (default)it will be drawn as a “wireframe”.
-
mutable cov_matrix_t m_U
Cholesky U triangular matrix cache.
-
mutable std::vector<array_point_t> m_render_pts