A 2D grid of dynamic size which stores any kind of data at each cell.
| T | The type of each cell in the 2D grid. |
Definition at line 44 of file CDynamicGrid.h.
#include <mrpt/utils/CDynamicGrid.h>

Public Member Functions | |
| CDynamicGrid (float x_min=-10.0f, float x_max=10.0f, float y_min=-10.0f, float y_max=10.0f, float resolution=0.10f) | |
| Constructor. | |
| virtual | ~CDynamicGrid () |
| Destructor. | |
| void | setSize (float x_min, float x_max, float y_min, float y_max, float resolution) |
| Changes the size of the grid, ERASING all previous contents. | |
| void | clear () |
| Erase the contents of all the cells. | |
| void | fill (const T &value) |
| Fills all the cells with the same value. | |
| virtual void | resize (float new_x_min, float new_x_max, float new_y_min, float new_y_max, const T &defaultValueNewCells, float additionalMarginMeters=2.0f) |
| Changes the size of the grid, maintaining previous contents. | |
| T * | cellByPos (float x, float y) |
| Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions. | |
| const T * | cellByPos (float x, float y) const |
| Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions. | |
| T * | cellByIndex (unsigned int cx, unsigned int cy) |
| Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions. | |
| const T * | cellByIndex (unsigned int cx, unsigned int cy) const |
| Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions. | |
| size_t | getSizeX () const |
| Returns the horizontal size of grid map in cells count. | |
| size_t | getSizeY () const |
| Returns the vertical size of grid map in cells count. | |
| float | getXMin () const |
| Returns the "x" coordinate of left side of grid map. | |
| float | getXMax () const |
| Returns the "x" coordinate of right side of grid map. | |
| float | getYMin () const |
| Returns the "y" coordinate of top side of grid map. | |
| float | getYMax () const |
| Returns the "y" coordinate of bottom side of grid map. | |
| float | getResolution () const |
| Returns the resolution of the grid map. | |
| virtual float | cell2float (const T &c) const |
| The user must implement this in order to provide "saveToTextFile" a way to convert each cell into a numeric value. | |
| void | saveToTextFile (const std::string &fileName) const |
| int | x2idx (float x) const |
| Transform a coordinate values into cell indexes. | |
| int | y2idx (float y) const |
| int | xy2idx (float x, float y) const |
| void | idx2cxcy (const int &idx, int &cx, int &cy) const |
| Transform a global (linear) cell index value into its corresponding (x,y) cell indexes. | |
| float | idx2x (int cx) const |
| Transform a cell index into a coordinate value. | |
| float | idx2y (int cy) const |
| int | x2idx (float x, float x_min) const |
| Transform a coordinate value into a cell index, using a diferent "x_min" value. | |
| int | y2idx (float y, float y_min) const |
| template<class MAT > | |
| void | getAsMatrix (MAT &m) const |
| Get the entire grid as a matrix. | |
Protected Member Functions | |
| std::vector< T > & | m_map_castaway_const () const |
| Used only from logically const method that really need to modify the object. | |
Protected Attributes | |
| std::vector< T > | m_map |
| The cells. | |
| float | m_x_min |
| float | m_x_max |
| float | m_y_min |
| float | m_y_max |
| float | m_resolution |
| size_t | m_size_x |
| size_t | m_size_y |
|
inline |
Constructor.
Definition at line 61 of file CDynamicGrid.h.
|
inlinevirtual |
Destructor.
Definition at line 76 of file CDynamicGrid.h.
|
inlinevirtual |
The user must implement this in order to provide "saveToTextFile" a way to convert each cell into a numeric value.
Reimplemented in mrpt::slam::CReflectivityGridMap2D.
Definition at line 281 of file CDynamicGrid.h.
|
inline |
Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions.
Definition at line 236 of file CDynamicGrid.h.
Referenced by mrpt::slam::COccupancyGridMap2D::getBasisCell(), mrpt::slam::COccupancyGridMap2D::getVoroniClearance(), mrpt::slam::COccupancyGridMap2D::setBasisCell(), and mrpt::slam::COccupancyGridMap2D::setVoroniClearance().
|
inline |
Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions.
Definition at line 245 of file CDynamicGrid.h.
|
inline |
Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions.
Definition at line 210 of file CDynamicGrid.h.
|
inline |
Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions.
Definition at line 223 of file CDynamicGrid.h.
|
inline |
Erase the contents of all the cells.
Definition at line 108 of file CDynamicGrid.h.
|
inline |
Fills all the cells with the same value.
Definition at line 116 of file CDynamicGrid.h.
|
inline |
Get the entire grid as a matrix.
| MAT | The type of the matrix, typically a CMatrixDouble. |
| [out] | m | The output matrix; will be set automatically to the correct size. Entry (cy,cx) in the matrix contains the grid cell with indices (cx,cy). |
Definition at line 329 of file CDynamicGrid.h.
|
inline |
Returns the resolution of the grid map.
Definition at line 278 of file CDynamicGrid.h.
|
inline |
Returns the horizontal size of grid map in cells count.
Definition at line 254 of file CDynamicGrid.h.
Referenced by mrpt::slam::COccupancyGridMap2D::getBasisCell(), mrpt::slam::COccupancyGridMap2D::getVoroniClearance(), mrpt::slam::COccupancyGridMap2D::setBasisCell(), and mrpt::slam::COccupancyGridMap2D::setVoroniClearance().
|
inline |
Returns the vertical size of grid map in cells count.
Definition at line 258 of file CDynamicGrid.h.
Referenced by mrpt::slam::COccupancyGridMap2D::getBasisCell(), mrpt::slam::COccupancyGridMap2D::getVoroniClearance(), mrpt::slam::COccupancyGridMap2D::setBasisCell(), and mrpt::slam::COccupancyGridMap2D::setVoroniClearance().
|
inline |
Returns the "x" coordinate of right side of grid map.
Definition at line 266 of file CDynamicGrid.h.
|
inline |
Returns the "x" coordinate of left side of grid map.
Definition at line 262 of file CDynamicGrid.h.
|
inline |
Returns the "y" coordinate of bottom side of grid map.
Definition at line 274 of file CDynamicGrid.h.
|
inline |
Returns the "y" coordinate of top side of grid map.
Definition at line 270 of file CDynamicGrid.h.
|
inline |
Transform a global (linear) cell index value into its corresponding (x,y) cell indexes.
Definition at line 306 of file CDynamicGrid.h.
|
inline |
Transform a cell index into a coordinate value.
Definition at line 314 of file CDynamicGrid.h.
|
inline |
Definition at line 315 of file CDynamicGrid.h.
|
inlineprotected |
Used only from logically const method that really need to modify the object.
Definition at line 52 of file CDynamicGrid.h.
|
inlinevirtual |
Changes the size of the grid, maintaining previous contents.
Definition at line 121 of file CDynamicGrid.h.
|
inline |
Definition at line 286 of file CDynamicGrid.h.
|
inline |
Changes the size of the grid, ERASING all previous contents.
Definition at line 83 of file CDynamicGrid.h.
|
inline |
Transform a coordinate values into cell indexes.
Definition at line 301 of file CDynamicGrid.h.
|
inline |
Transform a coordinate value into a cell index, using a diferent "x_min" value.
Definition at line 319 of file CDynamicGrid.h.
|
inline |
Definition at line 303 of file CDynamicGrid.h.
|
inline |
Definition at line 302 of file CDynamicGrid.h.
|
inline |
Definition at line 320 of file CDynamicGrid.h.
|
protected |
The cells.
Definition at line 49 of file CDynamicGrid.h.
|
protected |
Definition at line 55 of file CDynamicGrid.h.
|
protected |
Definition at line 56 of file CDynamicGrid.h.
|
protected |
Definition at line 56 of file CDynamicGrid.h.
|
protected |
Definition at line 54 of file CDynamicGrid.h.
|
protected |
Definition at line 54 of file CDynamicGrid.h.
|
protected |
Definition at line 54 of file CDynamicGrid.h.
|
protected |
Definition at line 54 of file CDynamicGrid.h.
| Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013 |