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-2018, 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::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  private:
45 };
46 
47 /** Like CAtan2LookUpTable but with a multiresolution grid for increasingly
48  * better accuracy in points nearer to the origin.
49  * Example of usage:
50  * \code
51  * mrpt::math::CAtan2LookUpTableMultiRes atan2lut;
52  * std::map<double,double> res2extension;
53  * res2extension[0.001] = 0.5; // 0.1 cm resolution up to 0.5 m
54  * res2extension[0.01] = 1.0; // 1 cm resolution up to 1 m
55  * res2extension[0.02] = 3.0; // 2 cm resolution up to 3 m
56  * res2extension[0.05] = 7.5; // 5 cm resolution up to 7.5 m
57  * res2extension[0.10] = 12.0; // 10 cm resolution up to 12 m
58  * atan2lut.resize(res2extension);
59  * \endcode
60  * \ingroup mrpt_math_grp
61  */
63 {
64  public:
65  CAtan2LookUpTableMultiRes() noexcept;
66  /** See CAtan2LookUpTableMultiRes for a discussion of the parameters */
68  const std::map<double, double>& lst_resolutions2extensions) noexcept;
69  /** See CAtan2LookUpTableMultiRes for a discussion of the parameters */
70  void resize(
71  const std::map<double, double>& lst_resolutions2extensions) noexcept;
72 
73  /** Returns the precomputed value for atan2(y,x). \return false if out of
74  * grid bounds. */
75  bool atan2(double y, double x, double& out_atan2) const noexcept;
76 
77  private:
78  /** Maps from maximum (X,Y) coordinates to LUT for [-L,L]x[-L,L] square
79  * area. */
80  std::map<double, mrpt::containers::CDynamicGrid<double>> m_grids;
81 };
82 
83 }
84 
double getYMax() const
Returns the "y" coordinate of bottom side of grid map.
Definition: CDynamicGrid.h:262
mrpt::containers::CDynamicGrid< double > m_grid
double getResolution() const
Returns the resolution of the grid map.
Definition: CDynamicGrid.h:264
double getYMin() const
Returns the "y" coordinate of top side of grid map.
Definition: CDynamicGrid.h:260
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:256
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:258
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020