9 #ifndef opengl_CGeneralizedEllipsoidTemplate_H
10 #define opengl_CGeneralizedEllipsoidTemplate_H
89 template <
typename MATRIX,
typename VECTOR>
94 new_cov.getColCount() == new_cov.getRowCount() &&
95 new_cov.getColCount() == DIM)
167 const double d =
m_cov.det();
168 if (fabs(d) < 1e-20 || d != d)
172 m_U.setZero(DIM, DIM);
183 for (
int i = 0; i < DIM; i++)
184 if (
m_U.coeff(i, i) == 0) eig_ok =
false;
189 std::vector<array_parameter_t> params_pts;
191 detail::generalizedEllipsoidPoints<DIM>(
195 std::vector<array_point_t> render_pts;
200 std::numeric_limits<double>::max(),
201 std::numeric_limits<double>::max(), 0);
203 -std::numeric_limits<double>::max(),
204 -std::numeric_limits<double>::max(), 0);
205 for (
size_t i = 0; i < render_pts.size(); i++)
206 for (
int k = 0; k < DIM; k++)
216 mrpt::opengl::detail::renderGeneralizedEllipsoidTemplate<DIM>(
250 const std::vector<array_point_t>& params_pts,
251 std::vector<array_point_t>& out_pts)
const = 0;
A numeric matrix of compile-time fixed size.
A class that generalizes the concept of an ellipsoid to arbitrary parameterizations of uncertainty sh...
virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
uint32_t getNumberOfSegments()
const cov_matrix_t & getCovMatrix() const
Gets the current uncertainty covariance of parameter space.
CGeneralizedEllipsoidTemplate()
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 covar...
float getQuantiles() const
Refer to documentation of setQuantiles()
void render_dl() const override
Render If one of the eigen value of the covariance matrix of the ellipsoid is null,...
mrpt::math::CMatrixFixedNumeric< float, DIM, 1 > array_parameter_t
void thisclass_readFromStream(mrpt::utils::CStream &in)
float getLineWidth() const
mrpt::math::CMatrixFixedNumeric< float, DIM, 1 > array_point_t
mrpt::math::CMatrixFixedNumeric< double, DIM, 1 > mean_vector_t
The type of fixed-size vector for this representation.
void thisclass_writeToStream(mrpt::utils::CStream &out) const
void setNumberOfSegments(const uint32_t numSegments)
Set the number of segments of the surface/curve (higher means with greater resolution)
uint32_t m_numSegments
Number of segments in 2D/3D ellipsoids (default=10)
mrpt::math::TPoint3D m_bb_min
bool m_needToRecomputeEigenVals
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,...
cov_matrix_t m_U
Cholesky U triangular matrix cache.
virtual ~CGeneralizedEllipsoidTemplate()
virtual void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
void setLineWidth(float w)
The line width for 2D ellipses or 3D wireframe ellipsoids (default=1)
mrpt::math::TPoint3D m_bb_max
float m_quantiles
The number of "sigmas" for drawing the ellipse/ellipsoid (default=3)
float m_lineWidth
The line width for 2D ellipses or 3D wireframe ellipsoids (default=1)
mrpt::math::CMatrixFixedNumeric< double, DIM, DIM > cov_matrix_t
The type of fixed-size covariance matrices for this representation.
void setQuantiles(float q)
Changes the scale of the "sigmas" for drawing the ellipse/ellipsoid (default=3, ~97 or ~98% CI); the ...
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
mrpt::poses::CPose3D m_pose
6D pose wrt the parent coordinate reference.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=nullptr, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
GLubyte GLubyte GLubyte GLubyte w
GLdouble GLdouble GLdouble GLdouble q
This file implements matrix/vector text and binary serialization.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define THROW_EXCEPTION(msg)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
This base provides a set of functions for maths stuff.
void generalizedEllipsoidPoints< 2 >(const mrpt::math::CMatrixFixedNumeric< double, 2, 2 > &U, const mrpt::math::CMatrixFixedNumeric< double, 2, 1 > &mean, std::vector< mrpt::math::CMatrixFixedNumeric< float, 2, 1 >> &out_params_pts, const uint32_t slices, const uint32_t stacks)
void renderGeneralizedEllipsoidTemplate< 2 >(const std::vector< mrpt::math::CMatrixFixedNumeric< float, 2, 1 >> &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
void generalizedEllipsoidPoints< 3 >(const mrpt::math::CMatrixFixedNumeric< double, 3, 3 > &U, const mrpt::math::CMatrixFixedNumeric< double, 3, 1 > &mean, std::vector< mrpt::math::CMatrixFixedNumeric< float, 3, 1 >> &out_params_pts, const uint32_t slices, const uint32_t stacks)
void renderGeneralizedEllipsoidTemplate(const std::vector< mrpt::math::CMatrixFixedNumeric< float, DIM, 1 >> &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
void renderGeneralizedEllipsoidTemplate< 3 >(const std::vector< mrpt::math::CMatrixFixedNumeric< float, 3, 1 >> &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
void generalizedEllipsoidPoints(const mrpt::math::CMatrixFixedNumeric< double, DIM, DIM > &U, const mrpt::math::CMatrixFixedNumeric< double, DIM, 1 > &mean, std::vector< mrpt::math::CMatrixFixedNumeric< float, DIM, 1 >> &out_params_pts, const uint32_t slices, const uint32_t stacks)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value.
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t