Main MRPT website > C++ reference for MRPT 1.5.7
CAtan2LookUpTable.h
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 #pragma once
10 
12 #include <mrpt/base/link_pragmas.h>
13 #include <map>
14 
15 namespace mrpt
16 {
17 namespace math
18 {
19  /** A look-up-table (LUT) of atan values for any (x,y) value in a square/rectangular grid of predefined resolution
20  *
21  * \sa mrpt::math::CAtan2LookUpTableMultiRes, mrpt::obs::CSinCosLookUpTableFor2DScans
22  * \ingroup mrpt_base_grp
23  */
25  {
26  public:
28  CAtan2LookUpTable(double xmin,double xmax,double ymin,double ymax, double resolution) MRPT_NO_THROWS;
29  void resize(double xmin,double xmax,double ymin,double ymax, double resolution) MRPT_NO_THROWS;
30 
31  /** Returns the precomputed value for atan2(y,x). \return false if out of grid bounds. */
32  bool atan2(double y,double x, double &out_atan2) const MRPT_NO_THROWS;
33 
34  double getXMin() const { return m_grid.getXMin(); }
35  double getXMax() const { return m_grid.getXMax(); }
36  double getYMin() const { return m_grid.getYMin(); }
37  double getYMax() const { return m_grid.getYMax(); }
38  double getResolution() const { return m_grid.getResolution(); }
39  private:
41  };
42 
43  /** Like CAtan2LookUpTable but with a multiresolution grid for increasingly better accuracy in points nearer to the origin.
44  * Example of usage:
45  * \code
46  * mrpt::math::CAtan2LookUpTableMultiRes atan2lut;
47  * std::map<double,double> res2extension;
48  * res2extension[0.001] = 0.5; // 0.1 cm resolution up to 0.5 m
49  * res2extension[0.01] = 1.0; // 1 cm resolution up to 1 m
50  * res2extension[0.02] = 3.0; // 2 cm resolution up to 3 m
51  * res2extension[0.05] = 7.5; // 5 cm resolution up to 7.5 m
52  * res2extension[0.10] = 12.0; // 10 cm resolution up to 12 m
53  * atan2lut.resize(res2extension);
54  * \endcode
55  * \ingroup mrpt_base_grp
56  */
58  {
59  public:
61  CAtan2LookUpTableMultiRes(const std::map<double,double> & lst_resolutions2extensions ) MRPT_NO_THROWS; //!< See CAtan2LookUpTableMultiRes for a discussion of the parameters
62  void resize(const std::map<double,double> & lst_resolutions2extensions) MRPT_NO_THROWS; //!< See CAtan2LookUpTableMultiRes for a discussion of the parameters
63 
64  /** Returns the precomputed value for atan2(y,x). \return false if out of grid bounds. */
65  bool atan2(double y,double x, double &out_atan2) const MRPT_NO_THROWS;
66  private:
67  std::map<double,mrpt::utils::CDynamicGrid<double> > m_grids; //!< Maps from maximum (X,Y) coordinates to LUT for [-L,L]x[-L,L] square area.
68  };
69 
70 } // end NS math
71 } // end NS mrpt
std::map< double, mrpt::utils::CDynamicGrid< double > > m_grids
Maps from maximum (X,Y) coordinates to LUT for [-L,L]x[-L,L] square area.
#define MRPT_NO_THROWS
C++11 noexcept: Used after member declarations.
mrpt::utils::CDynamicGrid< double > m_grid
A look-up-table (LUT) of atan values for any (x,y) value in a square/rectangular grid of predefined r...
Like CAtan2LookUpTable but with a multiresolution grid for increasingly better accuracy in points nea...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLenum GLint GLint y
Definition: glext.h:3516
GLenum GLint x
Definition: glext.h:3516



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019