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_CBox_H
00029 #define opengl_CBox_H
00030
00031 #include <mrpt/opengl/CRenderizableDisplayList.h>
00032 #include <mrpt/math/lightweight_geom_data.h>
00033
00034 namespace mrpt {
00035 namespace opengl {
00036
00037
00038 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(CBox,CRenderizableDisplayList, OPENGL_IMPEXP)
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 class OPENGL_IMPEXP CBox :public CRenderizableDisplayList {
00052 DEFINE_SERIALIZABLE(CBox)
00053
00054 protected:
00055 mrpt::math::TPoint3D m_corner_min,m_corner_max;
00056 bool m_wireframe;
00057 float m_lineWidth;
00058
00059 public:
00060
00061 static CBoxPtr Create(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2, bool is_wireframe = false, float lineWidth = 1.0 )
00062 {
00063 return CBoxPtr(new CBox(corner1,corner2,is_wireframe,lineWidth));
00064 }
00065
00066
00067
00068
00069 void render_dl() const;
00070
00071
00072
00073
00074
00075 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00076
00077 inline void setLineWidth(float width) { m_lineWidth = width; CRenderizableDisplayList::notifyChange(); }
00078 inline float getLineWidth() const { return m_lineWidth; }
00079
00080 inline void setWireframe(bool is_wireframe=true) { m_wireframe = is_wireframe; CRenderizableDisplayList::notifyChange(); }
00081 inline bool isWireframe() const { return m_wireframe; }
00082
00083
00084 void setBoxCorners(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2);
00085 void getBoxCorners(mrpt::math::TPoint3D &corner1, mrpt::math::TPoint3D &corner2) const { corner1= m_corner_min; corner2 = m_corner_max; }
00086
00087
00088 private:
00089
00090 CBox():m_corner_min(-1,-1,-1),m_corner_max(1,1,1),m_wireframe(false),m_lineWidth(1) { }
00091
00092
00093 CBox(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2, bool is_wireframe = false, float lineWidth = 1.0) :
00094 m_wireframe(is_wireframe) , m_lineWidth( lineWidth )
00095 {
00096 setBoxCorners(corner1,corner2);
00097 }
00098
00099
00100 virtual ~CBox() { }
00101
00102 };
00103 }
00104 }
00105 #endif