Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef opengl_CMyEllipsoid_H
00029 #define opengl_CMyEllipsoid_H
00030
00031 #include <mrpt/opengl/CRenderizableDisplayList.h>
00032 #include <mrpt/math/CMatrixD.h>
00033 #include <mrpt/math/CMatrixFixedNumeric.h>
00034
00035 namespace mrpt
00036 {
00037 namespace opengl
00038 {
00039 class OPENGL_IMPEXP CMyEllipsoid;
00040
00041
00042 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CMyEllipsoid, CRenderizableDisplayList, OPENGL_IMPEXP )
00043
00044
00064 class OPENGL_IMPEXP CMyEllipsoid : public CRenderizableDisplayList
00065 {
00066 DEFINE_SERIALIZABLE( CMyEllipsoid )
00067
00068 protected:
00071 math::CMatrixD m_eigVal,m_eigVec,m_prevComputedCov;
00072
00073 math::CMatrixD m_cov;
00074 bool m_drawSolid3D;
00075 float m_quantiles;
00076 unsigned int m_2D_segments;
00077 unsigned int m_3D_segments;
00078 float m_lineWidth;
00079
00080 public:
00081 void setCovMatrix( const mrpt::math::CMatrixDouble &m, int resizeToSize = -1 );
00082 void setCovMatrix( const mrpt::math::CMatrixFloat &m, int resizeToSize = -1 );
00083
00086 template <typename T>
00087 void setCovMatrix( const mrpt::math::CMatrixFixedNumeric<T,3,3> &m, int resizeToSize = -1 ) {
00088 setCovMatrix(mrpt::math::CMatrixTemplateNumeric<T>(m),resizeToSize);
00089 }
00090
00093 template <typename T>
00094 void setCovMatrix( const mrpt::math::CMatrixFixedNumeric<T,2,2> &m ) {
00095 setCovMatrix(mrpt::math::CMatrixTemplateNumeric<T>(m));
00096 }
00097
00098 mrpt::math::CMatrixDouble getCovMatrix() const { return mrpt::math::CMatrixDouble(m_cov); }
00099
00100 void enableDrawSolid3D(bool v) { m_drawSolid3D = v; CRenderizableDisplayList::notifyChange(); }
00101 void setQuantiles(float q) { m_quantiles=q; CRenderizableDisplayList::notifyChange(); }
00102 float getQuantiles() const { return m_quantiles; }
00103
00104 void set2DsegmentsCount(unsigned int N) { m_2D_segments=N; CRenderizableDisplayList::notifyChange(); }
00105 void set3DsegmentsCount(unsigned int N) { m_3D_segments=N; CRenderizableDisplayList::notifyChange(); }
00106
00107 void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
00108 float getLineWidth() const { return m_lineWidth; }
00109
00110
00115 void render_dl() const;
00118 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00119 virtual void getBoundingBox(mrpt::math::TPoint3D&, mrpt::math::TPoint3D&) const{}
00120 CObject* duplicate(){return this;}
00121 private:
00124 CMyEllipsoid() : m_eigVal(),m_eigVec(),m_prevComputedCov(),
00125 m_cov(2,2),
00126 m_drawSolid3D(true),
00127 m_quantiles(3),
00128 m_2D_segments(20),
00129 m_3D_segments(20),
00130 m_lineWidth(1.0)
00131 {
00132 }
00134 virtual ~CMyEllipsoid() { }
00135 };
00136
00137 }
00138
00139 }
00140
00141
00142 #endif