MRPT  1.9.9
CAtan2LookUpTable.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 #include <map>
13 
14 namespace mrpt::math
15 {
16 /** A look-up-table (LUT) of atan values for any (x,y) value in a
17  * square/rectangular grid of predefined resolution
18  *
19  * \sa mrpt::math::CAtan2LookUpTableMultiRes,
20  * mrpt::obs::CSinCosLookUpTableFor2DScans
21  * \ingroup mrpt_math_grp
22  */
24 {
25  public:
26  CAtan2LookUpTable() noexcept;
28  double xmin, double xmax, double ymin, double ymax,
29  double resolution) noexcept;
30  void resize(
31  double xmin, double xmax, double ymin, double ymax,
32  double resolution) noexcept;
33 
34  /** Returns the precomputed value for atan2(y,x). \return false if out of
35  * grid bounds. */
36  bool atan2(double y, double x, double& out_atan2) const noexcept;
37 
38  double getXMin() const { return m_grid.getXMin(); }
39  double getXMax() const { return m_grid.getXMax(); }
40  double getYMin() const { return m_grid.getYMin(); }
41  double getYMax() const { return m_grid.getYMax(); }
42  double getResolution() const { return m_grid.getResolution(); }
43 
44  private:
46 };
47 
48 /** Like CAtan2LookUpTable but with a multiresolution grid for increasingly
49  * better accuracy in points nearer to the origin.
50  * Example of usage:
51  * \code
52  * mrpt::math::CAtan2LookUpTableMultiRes atan2lut;
53  * std::map<double,double> res2extension;
54  * res2extension[0.001] = 0.5; // 0.1 cm resolution up to 0.5 m
55  * res2extension[0.01] = 1.0; // 1 cm resolution up to 1 m
56  * res2extension[0.02] = 3.0; // 2 cm resolution up to 3 m
57  * res2extension[0.05] = 7.5; // 5 cm resolution up to 7.5 m
58  * res2extension[0.10] = 12.0; // 10 cm resolution up to 12 m
59  * atan2lut.resize(res2extension);
60  * \endcode
61  * \ingroup mrpt_math_grp
62  */
64 {
65  public:
66  CAtan2LookUpTableMultiRes() = default;
67  /** See CAtan2LookUpTableMultiRes for a discussion of the parameters */
69  const std::map<double, double>& lst_resolutions2extensions) noexcept;
70  /** See CAtan2LookUpTableMultiRes for a discussion of the parameters */
71  void resize(
72  const std::map<double, double>& lst_resolutions2extensions) noexcept;
73 
74  /** Returns the precomputed value for atan2(y,x). \return false if out of
75  * grid bounds. */
76  bool atan2(double y, double x, double& out_atan2) const noexcept;
77 
78  private:
79  /** Maps from maximum (X,Y) coordinates to LUT for [-L,L]x[-L,L] square
80  * area. */
81  std::map<double, mrpt::containers::CDynamicGrid<double>> m_grids;
82 };
83 
84 } // namespace mrpt::math
double getYMax() const
Returns the "y" coordinate of bottom side of grid map.
Definition: CDynamicGrid.h:252
mrpt::containers::CDynamicGrid< double > m_grid
double getResolution() const
Returns the resolution of the grid map.
Definition: CDynamicGrid.h:254
double getYMin() const
Returns the "y" coordinate of top side of grid map.
Definition: CDynamicGrid.h:250
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...
This base provides a set of functions for maths stuff.
double getXMin() const
Returns the "x" coordinate of left side of grid map.
Definition: CDynamicGrid.h:246
std::map< double, mrpt::containers::CDynamicGrid< double > > m_grids
Maps from maximum (X,Y) coordinates to LUT for [-L,L]x[-L,L] square area.
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
double getXMax() const
Returns the "x" coordinate of right side of grid map.
Definition: CDynamicGrid.h:248
GLenum GLint GLint y
Definition: glext.h:3542
GLenum GLint x
Definition: glext.h:3542



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019