Main MRPT website > C++ reference for MRPT 1.9.9
CSphere.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef opengl_CSphere_H
10 #define opengl_CSphere_H
11 
13 
14 namespace mrpt
15 {
16 namespace opengl
17 {
18 /** A solid or wire-frame sphere.
19  * \sa opengl::COpenGLScene
20  *
21  * <div align="center">
22  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
23  * border-style: solid;">
24  * <tr> <td> mrpt::opengl::CSphere </td> <td> \image html preview_CSphere.png
25  * </td> </tr>
26  * </table>
27  * </div>
28  *
29  * \ingroup mrpt_opengl_grp
30  */
32 {
34 
35  protected:
36  float m_radius;
39 
40  public:
41  void setRadius(float r)
42  {
43  m_radius = r;
45  }
46  float getRadius() const { return m_radius; }
48  {
49  m_nDivsLongitude = N;
51  }
53  {
54  m_nDivsLatitude = N;
56  }
58  {
61  }
62 
63  /** \sa CRenderizableDisplayList */
64  bool should_skip_display_list_cache() const override
65  {
67  }
68 
69  /** Class factory */
70  static CSphere::Ptr Create(
71  float radius, int nDivsLongitude = 20, int nDivsLatitude = 20);
72 
73  /** Render */
74  void render_dl() const override;
75 
76  /** Evaluates the bounding box of this object (including possible children)
77  * in the coordinate frame of the object parent. */
78  void getBoundingBox(
79  mrpt::math::TPoint3D& bb_min,
80  mrpt::math::TPoint3D& bb_max) const override;
81 
82  /** Ray tracing
83  */
84  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
85 
86  /** Constructor
87  */
89  float radius = 1.0f, int nDivsLongitude = 20, int nDivsLatitude = 20)
90  : m_radius(radius),
91  m_nDivsLongitude(nDivsLongitude),
92  m_nDivsLatitude(nDivsLatitude),
94  {
95  }
96 
97  /** Private, virtual destructor: only can be deleted from smart pointers */
98  virtual ~CSphere() {}
99 };
100 
101 } // end namespace
102 
103 } // End of namespace
104 
105 #endif
void setRadius(float r)
Definition: CSphere.h:41
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
Definition: CSphere.cpp:127
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
float getRadius() const
Definition: CSphere.h:46
bool should_skip_display_list_cache() const override
Definition: CSphere.h:64
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
void setNumberDivsLongitude(int N)
Definition: CSphere.h:47
virtual ~CSphere()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CSphere.h:98
void setNumberDivsLatitude(int N)
Definition: CSphere.h:52
bool m_keepRadiusIndependentEyeDistance
Definition: CSphere.h:38
const GLdouble * v
Definition: glext.h:3678
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
void enableRadiusIndependentOfEyeDistance(bool v=true)
Definition: CSphere.h:57
A solid or wire-frame sphere.
Definition: CSphere.h:31
static Ptr Create(Args &&... args)
Definition: CSphere.h:33
CSphere(float radius=1.0f, int nDivsLongitude=20, int nDivsLatitude=20)
Constructor.
Definition: CSphere.h:88
Lightweight 3D point.
void render_dl() const override
Render.
Definition: CSphere.cpp:34
std::shared_ptr< CSphere > Ptr
Definition: CSphere.h:33
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...
Definition: CSphere.cpp:157



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019