class mrpt::viz::CEllipsoid2D
Overview
A 2D ellipse on the XY plane, centered at the origin of this object pose.
The color is determined by the RGBA fields in the class “CRenderizable”. Note that a transparent ellipse can be drawn for “0<alpha<1” values. If any of the eigen value of the covariance matrix of the ellipsoid is zero, it will not be rendered.
Please read the documentation of CGeneralizedEllipsoidTemplate::setQuantiles() for learning the mathematical details about setting the desired confidence interval.
See also:
opengl::Scene
#include <mrpt/viz/CEllipsoid2D.h> class CEllipsoid2D: public mrpt::viz::CGeneralizedEllipsoidTemplate { public: // typedefs typedef std::shared_ptr<mrpt::viz ::CEllipsoid2D> Ptr; typedef std::shared_ptr<const mrpt::viz ::CEllipsoid2D> ConstPtr; typedef std::unique_ptr<mrpt::viz ::CEllipsoid2D> UniquePtr; typedef std::unique_ptr<const mrpt::viz ::CEllipsoid2D> ConstUniquePtr; typedef mrpt::math::CMatrixFixed<double, DIM, DIM> cov_matrix_t; typedef mrpt::math::CMatrixFixed<double, DIM, 1> mean_vector_t; // fields static constexpr const char* className = "mrpt::viz" "::" "CEllipsoid2D"; // construction CEllipsoid2D(); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; void set2DsegmentsCount(unsigned int N); virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const; void setCovMatrixAndMean(const MATRIX& new_cov, const VECTOR& new_mean); cov_matrix_t getCovMatrix() const; void setCovMatrix(const MATRIX& new_cov); void setQuantiles(float q); float getQuantiles() const; void setNumberOfSegments(const uint32_t numSegments); void enableDrawSolid3D(bool v); virtual bool traceRay(] const mrpt::poses::CPose3D& o, ] double& dist) const; virtual void updateBuffers() const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; typedef std::shared_ptr<CVisualObject> Ptr; typedef std::shared_ptr<const CVisualObject> ConstPtr; typedef std::unique_ptr<CObject> UniquePtr; typedef std::unique_ptr<const CObject> ConstUniquePtr; // structs struct PoseAndScale; struct State; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; const auto& shaderLinesVertexPointBuffer() const; const auto& shaderLinesVertexColorBuffer() const; auto& shaderLinesBufferMutex() const; void setLineWidth(float w); float getLineWidth() const; void enableAntiAliasing(bool enable = true); bool isAntiAliasingEnabled() const; const auto& shaderTrianglesBuffer() const; auto& shaderTrianglesBufferMutex() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); PoseAndScale getPoseAndScale() const; virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c); bool isLightEnabled() const; void enableLight(bool enable = true); TCullFace cullFaces() const; void notifyBBoxChange() const; auto getBoundingBoxLocalf() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
Typedefs
typedef std::shared_ptr<mrpt::viz ::CEllipsoid2D> Ptr
A type for the associated smart pointer.
typedef mrpt::math::CMatrixFixed<double, DIM, DIM> cov_matrix_t
The type of fixed-size covariance matrices for this representation.
typedef mrpt::math::CMatrixFixed<double, DIM, 1> mean_vector_t
The type of fixed-size vector for this representation.
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
void set2DsegmentsCount(unsigned int N)
The number of segments of a 2D ellipse (default=20)
virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const
Ray tracing.
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.
cov_matrix_t getCovMatrix() const
Gets the current uncertainty covariance of parameter space.
void setCovMatrix(const MATRIX& new_cov)
Like setCovMatrixAndMean(), for mean=zero.
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
float getQuantiles() const
Refer to documentation of setQuantiles()
void setNumberOfSegments(const uint32_t numSegments)
Set the number of segments of the surface/curve (higher means with greater resolution)
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”.
virtual bool traceRay(] const mrpt::poses::CPose3D& o, ] double& dist) const
Ray tracing
virtual void updateBuffers() const
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.
Thread safety: implementations should lock the appropriate mutexes when writing to shared buffers.