MRPT  2.0.4
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-2020, 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 {
32 
33  public:
34  void renderUpdateBuffers() const override;
35 
36  void setRadius(float r)
37  {
38  m_radius = r;
40  }
41  float getRadius() const { return m_radius; }
43  {
44  m_nDivsLongitude = N;
46  }
48  {
49  m_nDivsLatitude = N;
51  }
52 
53  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
54  virtual void getBoundingBox(
56  mrpt::math::TPoint3D& bb_max) const override;
57 
58  /** Constructor */
60  float radius = 1.0f, int nDivsLongitude = 20, int nDivsLatitude = 20)
61  : m_radius(radius),
62  m_nDivsLongitude(nDivsLongitude),
63  m_nDivsLatitude(nDivsLatitude)
64  {
66  BASE::enableDrawSolid3D(true); // default
67  }
68 
69  virtual ~CSphere() override = default;
70 
71  protected:
72  float m_radius;
74 
76  {
80  }
81 
83  const std::vector<BASE::array_parameter_t>& in_pts,
84  std::vector<BASE::array_point_t>& out_pts) const override
85  {
86  out_pts = in_pts;
87  }
88 };
89 
90 } // namespace mrpt::opengl
mrpt::opengl::CSphere::~CSphere
virtual ~CSphere() override=default
mrpt::opengl::CRenderizable::notifyChange
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
Definition: CRenderizable.h:315
mrpt::math::TPoint3D_< double >
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:152
mrpt::opengl::CSphere::m_nDivsLongitude
int m_nDivsLongitude
Definition: CSphere.h:73
mrpt::opengl::CSphere::m_nDivsLatitude
int m_nDivsLatitude
Definition: CSphere.h:73
mrpt::opengl::CGeneralizedEllipsoidTemplate< 3 >::setNumberOfSegments
void setNumberOfSegments(const uint32_t numSegments)
Set the number of segments of the surface/curve (higher means with greater resolution)
Definition: CGeneralizedEllipsoidTemplate.h:195
mrpt::opengl::CSphere::setRadius
void setRadius(float r)
Definition: CSphere.h:36
mrpt::opengl::CSphere
A solid or wire-frame sphere.
Definition: CSphere.h:28
mrpt::opengl::CGeneralizedEllipsoidTemplate< 3 >::setCovMatrix
void setCovMatrix(const MATRIX &new_cov)
Like setCovMatrixAndMean(), for mean=zero.
Definition: CGeneralizedEllipsoidTemplate.h:154
mrpt::opengl::CGeneralizedEllipsoidTemplate< 3 >::setQuantiles
void setQuantiles(float q)
Changes the scale of the "sigmas" for drawing the ellipse/ellipsoid (default=3, ~97 or ~98% CI); the ...
Definition: CGeneralizedEllipsoidTemplate.h:185
mrpt::opengl::CSphere::regenerateBaseParams
void regenerateBaseParams()
Definition: CSphere.h:75
mrpt::opengl::CSphere::getBoundingBox
virtual 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:89
mrpt::opengl::CGeneralizedEllipsoidTemplate< 3 >::enableDrawSolid3D
void enableDrawSolid3D(bool v)
If set to "true", a whole ellipsoid surface will be drawn, or if set to "false" (default) it will be ...
Definition: CGeneralizedEllipsoidTemplate.h:204
bb_max
const auto bb_max
Definition: CPose3DPDFGrid_unittest.cpp:25
bb_min
const auto bb_min
Definition: CPose3DPDFGrid_unittest.cpp:23
mrpt::opengl::CSphere::m_radius
float m_radius
Definition: CSphere.h:72
mrpt::math::MatrixBase< double, CMatrixFixed< double, ROWS, COLS > >::Identity
static CMatrixFixed< double, ROWS, COLS > Identity()
Definition: MatrixBase.h:64
mrpt::opengl::CSphere::CSphere
CSphere(float radius=1.0f, int nDivsLongitude=20, int nDivsLatitude=20)
Constructor.
Definition: CSphere.h:59
mrpt::opengl::CSphere::getRadius
float getRadius() const
Definition: CSphere.h:41
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
mrpt::opengl::CSphere::setNumberDivsLongitude
void setNumberDivsLongitude(int N)
Definition: CSphere.h:42
mrpt::opengl::CSphere::traceRay
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
Definition: CSphere.cpp:59
mrpt::opengl::CSphere::renderUpdateBuffers
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers,...
Definition: CSphere.cpp:105
mrpt::opengl::CGeneralizedEllipsoidTemplate
A class that generalizes the concept of an ellipsoid to arbitrary parameterizations of uncertainty sh...
Definition: CGeneralizedEllipsoidTemplate.h:35
CGeneralizedEllipsoidTemplate.h
mrpt::opengl::CSphere::transformFromParameterSpace
void transformFromParameterSpace(const std::vector< BASE::array_parameter_t > &in_pts, std::vector< BASE::array_point_t > &out_pts) const override
To be implemented by derived classes: maps, using some arbitrary space transformation,...
Definition: CSphere.h:82
mrpt::opengl
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
mrpt::opengl::CSphere::setNumberDivsLatitude
void setNumberDivsLatitude(int N)
Definition: CSphere.h:47



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sat Jun 27 14:00:59 UTC 2020