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-2018, 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::opengl
15 {
16 /** A solid or wire-frame sphere.
17  * \sa opengl::COpenGLScene
18  *
19  * <div align="center">
20  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
21  * border-style: solid;">
22  * <tr> <td> mrpt::opengl::CSphere </td> <td> \image html preview_CSphere.png
23  * </td> </tr>
24  * </table>
25  * </div>
26  *
27  * \ingroup mrpt_opengl_grp
28  */
30 {
32 
33  protected:
34  float m_radius;
37 
38  public:
39  void setRadius(float r)
40  {
41  m_radius = r;
43  }
44  float getRadius() const { return m_radius; }
46  {
47  m_nDivsLongitude = N;
49  }
51  {
52  m_nDivsLatitude = N;
54  }
56  {
59  }
60 
61  /** \sa CRenderizableDisplayList */
62  bool should_skip_display_list_cache() const override
63  {
65  }
66 
67  /** Class factory */
68  static CSphere::Ptr Create(
69  float radius, int nDivsLongitude = 20, int nDivsLatitude = 20);
70 
71  /** Render */
72  void render_dl() const override;
73 
74  /** Evaluates the bounding box of this object (including possible children)
75  * in the coordinate frame of the object parent. */
76  void getBoundingBox(
77  mrpt::math::TPoint3D& bb_min,
78  mrpt::math::TPoint3D& bb_max) const override;
79 
80  /** Ray tracing
81  */
82  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
83 
84  /** Constructor
85  */
87  float radius = 1.0f, int nDivsLongitude = 20, int nDivsLatitude = 20)
88  : m_radius(radius),
89  m_nDivsLongitude(nDivsLongitude),
90  m_nDivsLatitude(nDivsLatitude),
92  {
93  }
94 
95  /** Private, virtual destructor: only can be deleted from smart pointers */
96  virtual ~CSphere() {}
97 };
98 
99 }
100 #endif
101 
102 
void setRadius(float r)
Definition: CSphere.h:39
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
Definition: CSphere.cpp:115
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:44
bool should_skip_display_list_cache() const override
Definition: CSphere.h:62
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
void setNumberDivsLongitude(int N)
Definition: CSphere.h:45
virtual ~CSphere()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CSphere.h:96
void setNumberDivsLatitude(int N)
Definition: CSphere.h:50
bool m_keepRadiusIndependentEyeDistance
Definition: CSphere.h:36
const GLdouble * v
Definition: glext.h:3678
#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:86
void enableRadiusIndependentOfEyeDistance(bool v=true)
Definition: CSphere.h:55
A solid or wire-frame sphere.
Definition: CSphere.h:29
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
static Ptr Create(Args &&... args)
Definition: CSphere.h:31
CSphere(float radius=1.0f, int nDivsLongitude=20, int nDivsLatitude=20)
Constructor.
Definition: CSphere.h:86
Lightweight 3D point.
void render_dl() const override
Render.
Definition: CSphere.cpp:34
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:145



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020