20 this->
resize(-1.0, 1.0, -1.0, 1.0, 0.5);
23 double xmin,
double xmax,
double ymin,
double ymax,
24 double resolution) noexcept
26 this->resize(xmin, xmax, ymin, ymax, resolution);
30 double xmin,
double xmax,
double ymin,
double ymax,
31 double resolution) noexcept
33 const double def = .0;
34 if (m_grid.getResolution() == resolution)
35 m_grid.resize(xmin, xmax, ymin, ymax, def, .0);
37 m_grid.setSize(xmin, xmax, ymin, ymax, resolution, &def);
39 const size_t nx = m_grid.getSizeX(),
ny = m_grid.getSizeY();
41 std::vector<double> idx2x(
nx), idx2y(
ny);
43 for (
size_t ix = 0; ix <
nx; ix++) idx2x[ix] = m_grid.idx2x(ix);
44 for (
size_t iy = 0; iy <
ny; iy++) idx2y[iy] = m_grid.idx2y(iy);
46 for (
size_t ix = 0; ix <
nx; ix++)
48 const double x = idx2x[ix];
49 for (
size_t iy = 0; iy <
ny; iy++)
51 const double y = idx2y[iy];
52 double* cp = m_grid.cellByIndex(ix, iy);
53 if (cp) *cp = ::atan2(
y,
x);
61 const double* cp = m_grid.cellByPos(
x,
y);
62 if (!cp)
return false;
69 const std::map<double, double>& lst_resolutions2extensions) noexcept
71 resize(lst_resolutions2extensions);
74 const std::map<double, double>& lst_resolutions2extensions) noexcept
78 for (
const auto& it : lst_resolutions2extensions)
80 const double res = it.first;
81 const double exten = it.second;
85 -exten, exten, -exten, exten,
res);
88 std::vector<double> idx2x(
nx), idx2y(
ny);
90 for (
size_t ix = 0; ix <
nx; ix++) idx2x[ix] = dg.
idx2x(ix);
91 for (
size_t iy = 0; iy <
ny; iy++) idx2y[iy] = dg.
idx2y(iy);
93 for (
size_t ix = 0; ix <
nx; ix++)
95 const double x = idx2x[ix];
96 for (
size_t iy = 0; iy <
ny; iy++)
98 const double y = idx2y[iy];
100 if (cp) *cp = ::atan2(
y,
x);
107 double y,
double x,
double& out_atan2)
const noexcept
109 for (
const auto& it : m_grids)
111 const double exten = it.first;
114 if (std::abs(
x) > exten || std::abs(
y) > exten)
continue;
CAtan2LookUpTableMultiRes() noexcept
size_t getSizeY() const
Returns the vertical size of grid map in cells count.
void resize(const std::map< double, double > &lst_resolutions2extensions) noexcept
See CAtan2LookUpTableMultiRes for a discussion of the parameters.
CAtan2LookUpTable() noexcept
T * cellByPos(double x, double y)
Returns a pointer to the contents of a cell given by its coordinates, or nullptr if it is out of the ...
double idx2y(int cy) const
This base provides a set of functions for maths stuff.
size_t getSizeX() const
Returns the horizontal size of grid map in cells count.
bool atan2(double y, double x, double &out_atan2) const noexcept
Returns the precomputed value for atan2(y,x).
T * cellByIndex(unsigned int cx, unsigned int cy)
Returns a pointer to the contents of a cell given by its cell indexes, or nullptr if it is out of the...
double idx2x(int cx) const
Transform a cell index into a coordinate value of the cell central point.
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
GLfloat GLfloat GLfloat GLfloat nx