Main MRPT website > C++ reference for MRPT 1.5.6
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 
12 
14 #include <mrpt/math/matrix_serialization.h> // for << >> ops of matrices
15 #include <mrpt/utils/CStream.h>
16 
17 using namespace mrpt;
18 using namespace mrpt::opengl;
19 using namespace mrpt::utils;
20 using namespace mrpt::math;
21 using namespace std;
22 
24 
25 /*---------------------------------------------------------------
26  transformFromParameterSpace
27  ---------------------------------------------------------------*/
28  void CEllipsoidInverseDepth2D::transformFromParameterSpace(
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 ? m_underflowMaxRange : (inv_range!=0 ? 1./inv_range : 0);
42  out_pts[i][0] = range * cos(yaw);
43  out_pts[i][1] = range * sin(yaw);
44  }
45 
46  MRPT_END
47 }
48 
49 
50 /*---------------------------------------------------------------
51  Implements the writing to a CStream capability of
52  CSerializable objects
53  ---------------------------------------------------------------*/
55 {
56  if (version)
57  *version = 0;
58  else
59  {
60  writeToStreamRender(out);
61  BASE::thisclass_writeToStream(out);
62 
63  out << m_underflowMaxRange;
64  }
65 }
66 
67 /*---------------------------------------------------------------
68  Implements the reading from a CStream capability of
69  CSerializable objects
70  ---------------------------------------------------------------*/
72 {
73  switch(version)
74  {
75  case 0:
76  {
77  readFromStreamRender(in);
78  BASE::thisclass_readFromStream(in);
79 
80  in >> m_underflowMaxRange;
81  } break;
82  default:
84  };
86 }
GLenum GLenum range
Definition: glew.h:7127
GLvoid *typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1745
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
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...
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
An especial "ellipsoid" in 3D computed as the uncertainty iso-surfaces of a (inv_range,yaw) variable.
GLuint in
Definition: glew.h:7146
A renderizable object suitable for rendering with OpenGL's display lists.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
A numeric matrix of compile-time fixed size.
#define MRPT_END
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
int version
Definition: mrpt_jpeglib.h:898
#define MRPT_START
This file implements matrix/vector text and binary serialization.



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018