Main MRPT website > C++ reference for MRPT 1.9.9
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 <map>
13 
14 namespace mrpt
15 {
16 namespace math
17 {
18 /** A look-up-table (LUT) of atan values for any (x,y) value in a
19  * square/rectangular grid of predefined resolution
20  *
21  * \sa mrpt::math::CAtan2LookUpTableMultiRes,
22  * mrpt::obs::CSinCosLookUpTableFor2DScans
23  * \ingroup mrpt_base_grp
24  */
26 {
27  public:
28  CAtan2LookUpTable() noexcept;
30  double xmin, double xmax, double ymin, double ymax,
31  double resolution) noexcept;
32  void resize(
33  double xmin, double xmax, double ymin, double ymax,
34  double resolution) noexcept;
35 
36  /** Returns the precomputed value for atan2(y,x). \return false if out of
37  * grid bounds. */
38  bool atan2(double y, double x, double& out_atan2) const noexcept;
39 
40  double getXMin() const { return m_grid.getXMin(); }
41  double getXMax() const { return m_grid.getXMax(); }
42  double getYMin() const { return m_grid.getYMin(); }
43  double getYMax() const { return m_grid.getYMax(); }
44  double getResolution() const { return m_grid.getResolution(); }
45  private:
47 };
48 
49 /** Like CAtan2LookUpTable but with a multiresolution grid for increasingly
50  * better accuracy in points nearer to the origin.
51  * Example of usage:
52  * \code
53  * mrpt::math::CAtan2LookUpTableMultiRes atan2lut;
54  * std::map<double,double> res2extension;
55  * res2extension[0.001] = 0.5; // 0.1 cm resolution up to 0.5 m
56  * res2extension[0.01] = 1.0; // 1 cm resolution up to 1 m
57  * res2extension[0.02] = 3.0; // 2 cm resolution up to 3 m
58  * res2extension[0.05] = 7.5; // 5 cm resolution up to 7.5 m
59  * res2extension[0.10] = 12.0; // 10 cm resolution up to 12 m
60  * atan2lut.resize(res2extension);
61  * \endcode
62  * \ingroup mrpt_base_grp
63  */
65 {
66  public:
67  CAtan2LookUpTableMultiRes() noexcept;
68  /** See CAtan2LookUpTableMultiRes for a discussion of the parameters */
70  const std::map<double, double>& lst_resolutions2extensions) noexcept;
71  /** See CAtan2LookUpTableMultiRes for a discussion of the parameters */
72  void resize(
73  const std::map<double, double>& lst_resolutions2extensions) noexcept;
74 
75  /** Returns the precomputed value for atan2(y,x). \return false if out of
76  * grid bounds. */
77  bool atan2(double y, double x, double& out_atan2) const noexcept;
78 
79  private:
80  /** Maps from maximum (X,Y) coordinates to LUT for [-L,L]x[-L,L] square
81  * area. */
82  std::map<double, mrpt::utils::CDynamicGrid<double>> m_grids;
83 };
84 
85 } // end NS math
86 } // end NS mrpt
double getXMax() const
Returns the "x" coordinate of right side of grid map.
Definition: CDynamicGrid.h:260
double getYMin() const
Returns the "y" coordinate of top side of grid map.
Definition: CDynamicGrid.h:262
double getXMin() const
Returns the "x" coordinate of left side of grid map.
Definition: CDynamicGrid.h:258
mrpt::utils::CDynamicGrid< double > m_grid
void resize(const std::map< double, double > &lst_resolutions2extensions) noexcept
See CAtan2LookUpTableMultiRes for a discussion of the parameters.
A look-up-table (LUT) of atan values for any (x,y) value in a square/rectangular grid of predefined r...
double getYMax() const
Returns the "y" coordinate of bottom side of grid map.
Definition: CDynamicGrid.h:264
Like CAtan2LookUpTable but with a multiresolution grid for increasingly better accuracy in points nea...
bool atan2(double y, double x, double &out_atan2) const noexcept
Returns the precomputed value for atan2(y,x).
bool atan2(double y, double x, double &out_atan2) const noexcept
Returns the precomputed value for atan2(y,x).
void resize(double xmin, double xmax, double ymin, double ymax, double resolution) noexcept
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.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double getResolution() const
Returns the resolution of the grid map.
Definition: CDynamicGrid.h:266
GLenum GLint GLint y
Definition: glext.h:3538
GLenum GLint x
Definition: glext.h:3538



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