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-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
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
mrpt::opengl::CSphere::m_nDivsLongitude
int m_nDivsLongitude
Definition: CSphere.h:37
mrpt::opengl::CSphere::m_keepRadiusIndependentEyeDistance
bool m_keepRadiusIndependentEyeDistance
Definition: CSphere.h:38
mrpt::opengl::CSphere::m_nDivsLatitude
int m_nDivsLatitude
Definition: CSphere.h:37
mrpt::opengl::CSphere::Ptr
std::shared_ptr< CSphere > Ptr
Definition: CSphere.h:33
mrpt::opengl::CSphere::setRadius
void setRadius(float r)
Definition: CSphere.h:41
CRenderizableDisplayList.h
mrpt::opengl::CSphere
A solid or wire-frame sphere.
Definition: CSphere.h:31
mrpt::opengl::CRenderizableDisplayList
A renderizable object suitable for rendering with OpenGL's display lists.
Definition: CRenderizableDisplayList.h:39
mrpt::opengl::CRenderizableDisplayList::notifyChange
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
Definition: CRenderizableDisplayList.h:57
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::opengl::CSphere::getBoundingBox
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
v
const GLdouble * v
Definition: glext.h:3678
r
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
mrpt::opengl::CSphere::m_radius
float m_radius
Definition: CSphere.h:36
mrpt::opengl::CSphere::CSphere
CSphere(float radius=1.0f, int nDivsLongitude=20, int nDivsLatitude=20)
Constructor.
Definition: CSphere.h:88
mrpt::opengl::CSphere::getRadius
float getRadius() const
Definition: CSphere.h:46
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::opengl::CSphere::should_skip_display_list_cache
bool should_skip_display_list_cache() const override
Definition: CSphere.h:64
mrpt::opengl::CSphere::~CSphere
virtual ~CSphere()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CSphere.h:98
mrpt::opengl::CSphere::enableRadiusIndependentOfEyeDistance
void enableRadiusIndependentOfEyeDistance(bool v=true)
Definition: CSphere.h:57
mrpt::opengl::CSphere::setNumberDivsLongitude
void setNumberDivsLongitude(int N)
Definition: CSphere.h:47
mrpt::opengl::CSphere::traceRay
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
Definition: CSphere.cpp:115
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:378
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::opengl::CSphere::Create
static Ptr Create(Args &&... args)
Definition: CSphere.h:33
mrpt::opengl::CSphere::render_dl
void render_dl() const override
Render.
Definition: CSphere.cpp:34
mrpt::opengl::CSphere::setNumberDivsLatitude
void setNumberDivsLatitude(int N)
Definition: CSphere.h:52



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST