Main MRPT website > C++ reference for MRPT 1.5.7
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 
22 
23 /*---------------------------------------------------------------
24  transformFromParameterSpace
25  ---------------------------------------------------------------*/
26  void CEllipsoidInverseDepth3D::transformFromParameterSpace(
27  const std::vector<BASE::array_parameter_t> &in_pts,
28  std::vector<BASE::array_point_t> & out_pts) const
29 {
31 
32  // (inv_range,yaw,pitch) --> (x,y,z)
33  const size_t N = in_pts.size();
34  out_pts.resize(N);
35  for (size_t i=0;i<N;i++)
36  {
37  const double inv_range = in_pts[i][0];
38  const double yaw = in_pts[i][1];
39  const double pitch = in_pts[i][2];
40 
41  const double range = inv_range<0 ? m_underflowMaxRange : (inv_range!=0 ? 1./inv_range : 0);
42 
43  out_pts[i][0] = range * cos(yaw)*cos(pitch);
44  out_pts[i][1] = range * sin(yaw)*cos(pitch);
45  out_pts[i][2] =-range * sin(pitch);
46  }
47 
48  MRPT_END
49 }
50 
51 
52 /*---------------------------------------------------------------
53  Implements the writing to a CStream capability of
54  CSerializable objects
55  ---------------------------------------------------------------*/
57 {
58  if (version)
59  *version = 0;
60  else
61  {
62  writeToStreamRender(out);
63  BASE::thisclass_writeToStream(out);
64 
65  out << m_underflowMaxRange;
66  }
67 }
68 
69 /*---------------------------------------------------------------
70  Implements the reading from a CStream capability of
71  CSerializable objects
72  ---------------------------------------------------------------*/
74 {
75  switch(version)
76  {
77  case 0:
78  {
79  readFromStreamRender(in);
80  BASE::thisclass_readFromStream(in);
81 
82  in >> m_underflowMaxRange;
83  } break;
84  default:
86  };
88 }
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
A numeric matrix of compile-time fixed size.
An especial "ellipsoid" in 3D computed as the uncertainty iso-surfaces of a (inv_range,...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
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:39
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLsizei range
Definition: glext.h:5281
GLuint in
Definition: glext.h:6301
int version
Definition: mrpt_jpeglib.h:898
#define MRPT_START
Definition: mrpt_macros.h:366
#define MRPT_END
Definition: mrpt_macros.h:370
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: mrpt_macros.h:217
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:20
The namespace for 3D scene representation and rendering.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
Definition: zip.h:16
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.1 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at mar 26 may 2026 13:12:03 CEST