Main MRPT website > C++ reference for MRPT 1.9.9
CEllipsoidInverseDepth3D.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, 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 
10 #include "opengl-precomp.h" // Precompiled header
11 
13 #include <mrpt/utils/CStream.h>
14 
15 using namespace mrpt;
16 using namespace mrpt::opengl;
17 using namespace mrpt::utils;
18 using namespace mrpt::math;
19 using namespace std;
20 
23 
24 /*---------------------------------------------------------------
25  transformFromParameterSpace
26  ---------------------------------------------------------------*/
28  const std::vector<BASE::array_parameter_t>& in_pts,
29  std::vector<BASE::array_point_t>& out_pts) const
30 {
32 
33  // (inv_range,yaw,pitch) --> (x,y,z)
34  const size_t N = in_pts.size();
35  out_pts.resize(N);
36  for (size_t i = 0; i < N; i++)
37  {
38  const double inv_range = in_pts[i][0];
39  const double yaw = in_pts[i][1];
40  const double pitch = in_pts[i][2];
41 
42  const double range = inv_range < 0
43  ? m_underflowMaxRange
44  : (inv_range != 0 ? 1. / inv_range : 0);
45 
46  out_pts[i][0] = range * cos(yaw) * cos(pitch);
47  out_pts[i][1] = range * sin(yaw) * cos(pitch);
48  out_pts[i][2] = -range * sin(pitch);
49  }
50 
51  MRPT_END
52 }
53 
54 /*---------------------------------------------------------------
55  Implements the writing to a CStream capability of
56  CSerializable objects
57  ---------------------------------------------------------------*/
59  mrpt::utils::CStream& out, int* version) const
60 {
61  if (version)
62  *version = 0;
63  else
64  {
65  writeToStreamRender(out);
66  BASE::thisclass_writeToStream(out);
67 
68  out << m_underflowMaxRange;
69  }
70 }
71 
72 /*---------------------------------------------------------------
73  Implements the reading from a CStream capability of
74  CSerializable objects
75  ---------------------------------------------------------------*/
77  mrpt::utils::CStream& in, int version)
78 {
79  switch (version)
80  {
81  case 0:
82  {
83  readFromStreamRender(in);
84  BASE::thisclass_readFromStream(in);
85 
86  in >> m_underflowMaxRange;
87  }
88  break;
89  default:
91  };
93 }
IMPLEMENTS_SERIALIZABLE(CEllipsoidInverseDepth3D, CRenderizableDisplayList, mrpt::opengl) void CEllipsoidInverseDepth3D
An especial "ellipsoid" in 3D computed as the uncertainty iso-surfaces of a (inv_range,...
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
virtual 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 renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:42
GLsizei range
Definition: glext.h:5907
GLuint in
Definition: glext.h:7274
#define MRPT_START
Definition: mrpt_macros.h:425
#define MRPT_END
Definition: mrpt_macros.h:429
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: mrpt_macros.h:181
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:20
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:16
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 63ea9d1f1 Thu Nov 23 00:06:53 2017 +0100 at mar 26 may 2026 12:19:29 CEST