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);
59 const std::map<double, double>& lst_resolutions2extensions) noexcept
61 resize(lst_resolutions2extensions);
64 const std::map<double, double>& lst_resolutions2extensions) noexcept
68 for (
const auto& it : lst_resolutions2extensions)
70 const double res = it.first;
71 const double exten = it.second;
75 -exten, exten, -exten, exten, res);
78 std::vector<double> idx2x(nx), idx2y(ny);
80 for (
size_t ix = 0; ix < nx; ix++) idx2x[ix] = dg.
idx2x(ix);
81 for (
size_t iy = 0; iy < ny; iy++) idx2y[iy] = dg.
idx2y(iy);
83 for (
size_t ix = 0; ix < nx; ix++)
85 const double x = idx2x[ix];
86 for (
size_t iy = 0; iy < ny; iy++)
88 const double y = idx2y[iy];
90 if (cp) *cp = ::atan2(y, x);
97 double y,
double x,
double& out_atan2)
const noexcept
99 for (
const auto& it : m_grids)
101 const double exten = it.first;
104 if (std::abs(x) > exten || std::abs(y) > exten)
continue;
CAtan2LookUpTableMultiRes()=default
double idx2x(int cx) const
Transform a cell index into a coordinate value of the cell central point.
void resize(const std::map< double, double > &lst_resolutions2extensions) noexcept
See CAtan2LookUpTableMultiRes for a discussion of the parameters.
double idx2y(int cy) const
CAtan2LookUpTable() noexcept
This base provides a set of functions for maths stuff.
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 ...
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...
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).
void resize(double xmin, double xmax, double ymin, double ymax, double resolution) noexcept
size_t getSizeY() const
Returns the vertical size of grid map in cells count.