MRPT  1.9.9
CSphere.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 
13 namespace mrpt::opengl
14 {
15 /** A solid or wire-frame sphere.
16  * \sa opengl::COpenGLScene
17  *
18  * <div align="center">
19  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
20  * border-style: solid;">
21  * <tr> <td> mrpt::opengl::CSphere </td> <td> \image html preview_CSphere.png
22  * </td> </tr>
23  * </table>
24  * </div>
25  *
26  * \ingroup mrpt_opengl_grp
27  */
29 {
31 
32  protected:
33  float m_radius;
36 
37  public:
38  void setRadius(float r)
39  {
40  m_radius = r;
42  }
43  float getRadius() const { return m_radius; }
45  {
46  m_nDivsLongitude = N;
48  }
50  {
51  m_nDivsLatitude = N;
53  }
55  {
58  }
59 
60  /** \sa CRenderizableDisplayList */
61  bool should_skip_display_list_cache() const override
62  {
64  }
65 
66  /** Render */
67  void render_dl() const override;
68 
69  /** Evaluates the bounding box of this object (including possible children)
70  * in the coordinate frame of the object parent. */
71  void getBoundingBox(
73  mrpt::math::TPoint3D& bb_max) const override;
74 
75  /** Ray tracing
76  */
77  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
78 
79  /** Constructor
80  */
82  float radius = 1.0f, int nDivsLongitude = 20, int nDivsLatitude = 20)
83  : m_radius(radius),
84  m_nDivsLongitude(nDivsLongitude),
85  m_nDivsLatitude(nDivsLatitude)
86 
87  {
88  }
89 
90  /** Private, virtual destructor: only can be deleted from smart pointers */
91  ~CSphere() override = default;
92 };
93 
94 } // namespace mrpt::opengl
void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
void setRadius(float r)
Definition: CSphere.h:38
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
Definition: CSphere.cpp:107
float getRadius() const
Definition: CSphere.h:43
bool should_skip_display_list_cache() const override
Definition: CSphere.h:61
~CSphere() override=default
Private, virtual destructor: only can be deleted from smart pointers.
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
void setNumberDivsLongitude(int N)
Definition: CSphere.h:44
void setNumberDivsLatitude(int N)
Definition: CSphere.h:49
bool m_keepRadiusIndependentEyeDistance
Definition: CSphere.h:35
const GLdouble * v
Definition: glext.h:3684
#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:3711
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:84
void enableRadiusIndependentOfEyeDistance(bool v=true)
Definition: CSphere.h:54
A solid or wire-frame sphere.
Definition: CSphere.h:28
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
const auto bb_max
const auto bb_min
CSphere(float radius=1.0f, int nDivsLongitude=20, int nDivsLatitude=20)
Constructor.
Definition: CSphere.h:81
Lightweight 3D point.
Definition: TPoint3D.h:90
void render_dl() const override
Render.
Definition: CSphere.cpp:26
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:137



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019