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-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
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_math_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_math_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::containers::CDynamicGrid<double>> m_grids;
83 };
84 
85 } // end NS math
86 } // end NS mrpt
mrpt::math::CAtan2LookUpTable::getResolution
double getResolution() const
Definition: CAtan2LookUpTable.h:44
mrpt::containers::CDynamicGrid::getYMin
double getYMin() const
Returns the "y" coordinate of top side of grid map.
Definition: CDynamicGrid.h:260
mrpt::math::CAtan2LookUpTable::atan2
bool atan2(double y, double x, double &out_atan2) const noexcept
Returns the precomputed value for atan2(y,x).
Definition: CAtan2LookUpTable.cpp:58
mrpt::math::CAtan2LookUpTableMultiRes::CAtan2LookUpTableMultiRes
CAtan2LookUpTableMultiRes() noexcept
Definition: CAtan2LookUpTable.cpp:67
mrpt::math::CAtan2LookUpTable::getYMin
double getYMin() const
Definition: CAtan2LookUpTable.h:42
mrpt::containers::CDynamicGrid::getXMax
double getXMax() const
Returns the "x" coordinate of right side of grid map.
Definition: CDynamicGrid.h:258
mrpt::math::CAtan2LookUpTable::CAtan2LookUpTable
CAtan2LookUpTable() noexcept
Definition: CAtan2LookUpTable.cpp:18
mrpt::math::CAtan2LookUpTableMultiRes
Like CAtan2LookUpTable but with a multiresolution grid for increasingly better accuracy in points nea...
Definition: CAtan2LookUpTable.h:64
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::math::CAtan2LookUpTable::getYMax
double getYMax() const
Definition: CAtan2LookUpTable.h:43
mrpt::math::CAtan2LookUpTable::m_grid
mrpt::containers::CDynamicGrid< double > m_grid
Definition: CAtan2LookUpTable.h:46
mrpt::containers::CDynamicGrid::getXMin
double getXMin() const
Returns the "x" coordinate of left side of grid map.
Definition: CDynamicGrid.h:256
mrpt::math::CAtan2LookUpTable::getXMax
double getXMax() const
Definition: CAtan2LookUpTable.h:41
CDynamicGrid.h
mrpt::math::CAtan2LookUpTable
A look-up-table (LUT) of atan values for any (x,y) value in a square/rectangular grid of predefined r...
Definition: CAtan2LookUpTable.h:25
mrpt::containers::CDynamicGrid::getYMax
double getYMax() const
Returns the "y" coordinate of bottom side of grid map.
Definition: CDynamicGrid.h:262
mrpt::math::CAtan2LookUpTable::getXMin
double getXMin() const
Definition: CAtan2LookUpTable.h:40
mrpt::containers::CDynamicGrid::getResolution
double getResolution() const
Returns the resolution of the grid map.
Definition: CDynamicGrid.h:264
mrpt::containers::CDynamicGrid< double >
mrpt::math::CAtan2LookUpTableMultiRes::resize
void resize(const std::map< double, double > &lst_resolutions2extensions) noexcept
See CAtan2LookUpTableMultiRes for a discussion of the parameters.
Definition: CAtan2LookUpTable.cpp:73
mrpt::math::CAtan2LookUpTable::resize
void resize(double xmin, double xmax, double ymin, double ymax, double resolution) noexcept
Definition: CAtan2LookUpTable.cpp:29
mrpt::math::CAtan2LookUpTableMultiRes::atan2
bool atan2(double y, double x, double &out_atan2) const noexcept
Returns the precomputed value for atan2(y,x).
Definition: CAtan2LookUpTable.cpp:106
mrpt::math::CAtan2LookUpTableMultiRes::m_grids
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.
Definition: CAtan2LookUpTable.h:82
y
GLenum GLint GLint y
Definition: glext.h:3538
x
GLenum GLint x
Definition: glext.h:3538



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST