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
00052 class OPENGL_IMPEXP CBox :public CRenderizableDisplayList {
00053 DEFINE_SERIALIZABLE(CBox)
00054
00055 protected:
00056 mrpt::math::TPoint3D m_corner_min,m_corner_max;
00057 bool m_wireframe;
00058 float m_lineWidth;
00059
00060 public:
00061
00062 static CBoxPtr Create(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2, bool is_wireframe = false, float lineWidth = 1.0 )
00063 {
00064 return CBoxPtr(new CBox(corner1,corner2,is_wireframe,lineWidth));
00065 }
00066
00067
00068
00069
00070 void render_dl() const;
00071
00072
00073
00074
00075
00076 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00077
00078 inline void setLineWidth(float width) { m_lineWidth = width; CRenderizableDisplayList::notifyChange(); }
00079 inline float getLineWidth() const { return m_lineWidth; }
00080
00081 inline void setWireframe(bool is_wireframe=true) { m_wireframe = is_wireframe; CRenderizableDisplayList::notifyChange(); }
00082 inline bool isWireframe() const { return m_wireframe; }
00083
00084
00085 void setBoxCorners(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2);
00086 void getBoxCorners(mrpt::math::TPoint3D &corner1, mrpt::math::TPoint3D &corner2) const { corner1= m_corner_min; corner2 = m_corner_max; }
00087
00088
00089 private:
00090
00091 CBox():m_corner_min(-1,-1,-1),m_corner_max(1,1,1),m_wireframe(false),m_lineWidth(1) { }
00092
00093
00094 CBox(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2, bool is_wireframe = false, float lineWidth = 1.0) :
00095 m_wireframe(is_wireframe) , m_lineWidth( lineWidth )
00096 {
00097 setBoxCorners(corner1,corner2);
00098 }
00099
00100
00101 virtual ~CBox() { }
00102
00103 };
00104 }
00105 }
00106 #endif