Main MRPT website > C++ reference for MRPT 1.9.9
CEllipsoidInverseDepth2D.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/math/matrix_serialization.h> // for << >> ops of matrices
14 #include <mrpt/utils/CStream.h>
15 
16 using namespace mrpt;
17 using namespace mrpt::opengl;
18 using namespace mrpt::utils;
19 using namespace mrpt::math;
20 using namespace std;
21 
24 
25 /*---------------------------------------------------------------
26  transformFromParameterSpace
27  ---------------------------------------------------------------*/
29  const std::vector<BASE::array_parameter_t>& in_pts,
30  std::vector<BASE::array_point_t>& out_pts) const
31 {
33 
34  // (inv_range,yaw) --> (x,y)
35  const size_t N = in_pts.size();
36  out_pts.resize(N);
37  for (size_t i = 0; i < N; i++)
38  {
39  const double inv_range = in_pts[i][0];
40  const double yaw = in_pts[i][1];
41  const double range = inv_range < 0
42  ? m_underflowMaxRange
43  : (inv_range != 0 ? 1. / inv_range : 0);
44  out_pts[i][0] = range * cos(yaw);
45  out_pts[i][1] = range * sin(yaw);
46  }
47 
48  MRPT_END
49 }
50 
51 /*---------------------------------------------------------------
52  Implements the writing to a CStream capability of
53  CSerializable objects
54  ---------------------------------------------------------------*/
56  mrpt::utils::CStream& out, int* version) const
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  mrpt::utils::CStream& in, int version)
75 {
76  switch (version)
77  {
78  case 0:
79  {
80  readFromStreamRender(in);
81  BASE::thisclass_readFromStream(in);
82 
83  in >> m_underflowMaxRange;
84  }
85  break;
86  default:
88  };
90 }
GLsizei range
Definition: glext.h:5907
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
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...
IMPLEMENTS_SERIALIZABLE(CEllipsoidInverseDepth2D, CRenderizableDisplayList, mrpt::opengl) void CEllipsoidInverseDepth2D
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
STL namespace.
An especial "ellipsoid" in 3D computed as the uncertainty iso-surfaces of a (inv_range,yaw) variable.
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 list of points defining an ellipsoid in parameter space into their corresponding points in 2D/3D space.
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
#define MRPT_END
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define MRPT_START
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
This file implements matrix/vector text and binary serialization.
GLuint in
Definition: glext.h:7274
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019