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
void setRadius(float r)
Definition: CSphere.h:36
static Derived Identity()
Definition: MatrixBase.h:64
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
Definition: CSphere.cpp:59
void setNumberOfSegments(const uint32_t numSegments)
Set the number of segments of the surface/curve (higher means with greater resolution) ...
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
void regenerateBaseParams()
Definition: CSphere.h:75
float getRadius() const
Definition: CSphere.h:41
void setNumberDivsLongitude(int N)
Definition: CSphere.h:42
void setNumberDivsLatitude(int N)
Definition: CSphere.h:47
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.
Definition: CSphere.cpp:105
virtual ~CSphere() override=default
void setCovMatrix(const MATRIX &new_cov)
Like setCovMatrixAndMean(), for mean=zero.
A class that generalizes the concept of an ellipsoid to arbitrary parameterizations of uncertainty sh...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
A solid or wire-frame sphere.
Definition: CSphere.h:28
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
void setQuantiles(float q)
Changes the scale of the "sigmas" for drawing the ellipse/ellipsoid (default=3, ~97 or ~98% CI); the ...
const auto bb_max
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, a list of points defining an ellipsoid in parameter space into their corresponding points in 2D/3D space.
Definition: CSphere.h:82
void enableDrawSolid3D(bool v)
If set to "true", a whole ellipsoid surface will be drawn, or if set to "false" (default) it will be ...
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
const auto bb_min
CSphere(float radius=1.0f, int nDivsLongitude=20, int nDivsLatitude=20)
Constructor.
Definition: CSphere.h:59
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



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 7b5ddf9de Fri May 29 14:02:56 2020 +0200 at vie may 29 14:15:09 CEST 2020