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_CEllipsoid_H
00029 #define opengl_CEllipsoid_H
00030
00031 #include <mrpt/opengl/CRenderizable.h>
00032 #include <mrpt/math/CMatrixD.h>
00033
00034 namespace mrpt
00035 {
00036 namespace opengl
00037 {
00038 class MRPTDLLIMPEXP CEllipsoid;
00039
00040
00041 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CEllipsoid, CRenderizable )
00042
00043
00050 class MRPTDLLIMPEXP CEllipsoid : public CRenderizable
00051 {
00052 DEFINE_SERIALIZABLE( CEllipsoid )
00053
00054 protected:
00057 math::CMatrixD m_eigVal,m_eigVec,m_prevComputedCov;
00058
00059 math::CMatrixD m_cov;
00060 bool m_drawSolid3D;
00061 float m_quantiles;
00062 unsigned int m_2D_segments;
00063 unsigned int m_3D_segments;
00064 float m_lineWidth;
00065
00066 public:
00067 void setCovMatrix( const mrpt::math::CMatrixDouble &m, int resizeToSize = -1 );
00068 void setCovMatrix( const mrpt::math::CMatrixFloat &m, int resizeToSize = -1 );
00069
00070 mrpt::math::CMatrixDouble getCovMatrix() const { return mrpt::math::CMatrixDouble(m_cov); }
00071
00072 void enableDrawSolid3D(bool v) { m_drawSolid3D = v; }
00073 void setQuantiles(float q) { m_quantiles=q; }
00074 float getQuantiles() const { return m_quantiles; }
00075
00076 void set2DsegmentsCount(unsigned int N) { m_2D_segments=N; }
00077 void set3DsegmentsCount(unsigned int N) { m_3D_segments=N; }
00078
00079 void setLineWidth(float w) { m_lineWidth=w; }
00080 float getLineWidth() const { return m_lineWidth; }
00081
00082
00084 static CEllipsoidPtr Create()
00085 {
00086 return CEllipsoidPtr( new CEllipsoid() );
00087 }
00088
00091 void render() const;
00094 virtual bool traceRay(const mrpt::poses::CPose3D &o,float &dist) const;
00095
00096 private:
00099 CEllipsoid() : m_eigVal(),m_eigVec(),m_prevComputedCov(),
00100 m_cov(2,2),
00101 m_drawSolid3D(true),
00102 m_quantiles(3),
00103 m_2D_segments(20),
00104 m_3D_segments(20),
00105 m_lineWidth(1.0)
00106 {
00107 }
00109 virtual ~CEllipsoid() { }
00110 };
00111
00112 }
00113
00114 }
00115
00116
00117 #endif