MRPT
1.9.9
|
A 3D rectangular grid of dynamic size which stores any kind of data at each voxel.
T | The type of each voxel in the grid. |
Definition at line 26 of file CDynamicGrid3D.h.
#include <mrpt/containers/CDynamicGrid3D.h>
Public Types | |
using | grid_data_t = std::vector< T > |
using | iterator = typename grid_data_t::iterator |
using | const_iterator = typename grid_data_t::const_iterator |
Public Member Functions | |
CDynamicGrid3D (coord_t x_min=-1.0, coord_t x_max=1.0, coord_t y_min=-1.0, coord_t y_max=+1.0, coord_t z_min=-1.0, coord_t z_max=1.0, coord_t resolution_xy=0.5, coord_t resolution_z=0.5) | |
Constructor. More... | |
virtual void | resize (coord_t new_x_min, coord_t new_x_max, coord_t new_y_min, coord_t new_y_max, coord_t new_z_min, coord_t new_z_max, const T &defaultValueNewCells, coord_t additionalMarginMeters=2) |
Changes the size of the grid, maintaining previous contents. More... | |
virtual void | setSize (const coord_t x_min, const coord_t x_max, const coord_t y_min, const coord_t y_max, const coord_t z_min, const coord_t z_max, const coord_t resolution_xy, const coord_t resolution_z_=-1.0, const T *fill_value=nullptr) |
Changes the size of the grid, ERASING all previous contents. More... | |
virtual void | clear () |
Erase the contents of all the cells, setting them to their default values (default ctor). More... | |
void | fill (const T &value) |
Fills all the cells with the same value. More... | |
bool | isOutOfBounds (const int cx, const int cy, const int cz) const |
size_t | cellAbsIndexFromCXCYCZ (const int cx, const int cy, const int cz) const |
Gets the absolute index of a voxel in the linear container m_map[] from its cx,cy,cz indices, or -1 if out of map bounds (in any dimension). More... | |
T * | cellByPos (coord_t x, coord_t y, coord_t z) |
Returns a pointer to the contents of a voxel given by its coordinates, or nullptr if it is out of the map extensions. More... | |
const T * | cellByPos (coord_t x, coord_t y, coord_t z) const |
T & | cellRefByPos (coord_t x, coord_t y, coord_t z) |
Like cellByPos() but returns a reference. More... | |
const T & | cellRefByPos (coord_t x, coord_t y, coord_t z) const |
T * | cellByIndex (unsigned int cx, unsigned int cy, unsigned int cz) |
Returns a pointer to the contents of a voxel given by its voxel indexes, or nullptr if it is out of the map extensions. More... | |
const T * | cellByIndex (unsigned int cx, unsigned int cy, unsigned int cz) const |
const T * | cellByIndex (size_t cidx) const |
Returns a pointer to the contents of a voxel given by its absolute voxel index, or nullptr if it is out of range. More... | |
T * | cellByIndex (size_t cidx) |
size_t | getSizeX () const |
size_t | getSizeY () const |
size_t | getSizeZ () const |
size_t | getVoxelCount () const |
coord_t | getXMin () const |
coord_t | getXMax () const |
coord_t | getYMin () const |
coord_t | getYMax () const |
coord_t | getZMin () const |
coord_t | getZMax () const |
coord_t | getResolutionXY () const |
coord_t | getResolutionZ () const |
int | x2idx (coord_t x) const |
Transform a coordinate values into voxel indexes. More... | |
int | y2idx (coord_t y) const |
int | z2idx (coord_t z) const |
coord_t | idx2x (int cx) const |
Transform a voxel index into a coordinate value of the voxel central point. More... | |
coord_t | idx2y (int cy) const |
coord_t | idx2z (int cz) const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
template<class ARCHIVE > | |
void | dyngridcommon_writeToStream (ARCHIVE &out) const |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class) More... | |
template<class ARCHIVE > | |
void | dyngridcommon_readFromStream (ARCHIVE &in) |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class) More... | |
Static Public Attributes | |
static const size_t | INVALID_VOXEL_IDX = size_t(-1) |
Protected Member Functions | |
std::vector< T > & | m_map_castaway_const () const |
Used only from logically const method that really need to modify the object. More... | |
Protected Attributes | |
grid_data_t | m_map |
The cells. More... | |
coord_t | m_x_min |
coord_t | m_x_max |
coord_t | m_y_min |
coord_t | m_y_max |
coord_t | m_z_min |
coord_t | m_z_max |
coord_t | m_resolution_xy |
coord_t | m_resolution_z |
size_t | m_size_x |
size_t | m_size_y |
size_t | m_size_z |
size_t | m_size_x_times_y |
using mrpt::containers::CDynamicGrid3D< T, coord_t >::const_iterator = typename grid_data_t::const_iterator |
Definition at line 31 of file CDynamicGrid3D.h.
using mrpt::containers::CDynamicGrid3D< T, coord_t >::grid_data_t = std::vector<T> |
Definition at line 29 of file CDynamicGrid3D.h.
using mrpt::containers::CDynamicGrid3D< T, coord_t >::iterator = typename grid_data_t::iterator |
Definition at line 30 of file CDynamicGrid3D.h.
|
inline |
Constructor.
Definition at line 34 of file CDynamicGrid3D.h.
|
inline |
Definition at line 352 of file CDynamicGrid3D.h.
|
inline |
Definition at line 354 of file CDynamicGrid3D.h.
|
inline |
Gets the absolute index of a voxel in the linear container m_map[] from its cx,cy,cz indices, or -1 if out of map bounds (in any dimension).
Definition at line 240 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellByIndex(), and mrpt::containers::CDynamicGrid3D< TCELL >::cellByPos().
|
inline |
Returns a pointer to the contents of a voxel given by its voxel indexes, or nullptr if it is out of the map extensions.
Definition at line 285 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getCellFreeness(), mrpt::maps::COccupancyGridMap3D::serializeFrom(), mrpt::maps::COccupancyGridMap3D::serializeTo(), mrpt::maps::COccupancyGridMap3D::setCellFreeness(), mrpt::maps::COccupancyGridMap3D::updateCell(), mrpt::maps::CLogOddsGridMap3D< OccGridCellTraits::cellType >::updateCell_fast_free(), and mrpt::maps::CLogOddsGridMap3D< OccGridCellTraits::cellType >::updateCell_fast_occupied().
|
inline |
Definition at line 291 of file CDynamicGrid3D.h.
|
inline |
Returns a pointer to the contents of a voxel given by its absolute voxel index, or nullptr if it is out of range.
Definition at line 302 of file CDynamicGrid3D.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 308 of file CDynamicGrid3D.h.
|
inline |
Returns a pointer to the contents of a voxel given by its coordinates, or nullptr if it is out of the map extensions.
Definition at line 250 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellRefByPos(), and TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 258 of file CDynamicGrid3D.h.
|
inline |
Like cellByPos() but returns a reference.
std::out_of_range | if out of grid limits. |
Definition at line 268 of file CDynamicGrid3D.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 275 of file CDynamicGrid3D.h.
|
inlinevirtual |
Erase the contents of all the cells, setting them to their default values (default ctor).
Reimplemented in mrpt::maps::CRandomFieldGridMap3D.
Definition at line 215 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::CRandomFieldGridMap3D::clear().
|
inline |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class)
Definition at line 382 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::serializeFrom().
|
inline |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class)
Definition at line 371 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::serializeTo().
|
inline |
Definition at line 353 of file CDynamicGrid3D.h.
|
inline |
Definition at line 355 of file CDynamicGrid3D.h.
|
inline |
Fills all the cells with the same value.
Definition at line 223 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::fill().
|
inline |
Definition at line 324 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels(), and mrpt::maps::COccupancyGridMap3D::internal_clear().
|
inline |
Definition at line 325 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 314 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels(), mrpt::maps::COccupancyGridMap3D::serializeFrom(), and mrpt::maps::COccupancyGridMap3D::serializeTo().
|
inline |
Definition at line 315 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels(), mrpt::maps::COccupancyGridMap3D::serializeFrom(), and mrpt::maps::COccupancyGridMap3D::serializeTo().
|
inline |
Definition at line 316 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels(), mrpt::maps::COccupancyGridMap3D::serializeFrom(), and mrpt::maps::COccupancyGridMap3D::serializeTo().
|
inline |
Definition at line 317 of file CDynamicGrid3D.h.
|
inline |
Definition at line 319 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 318 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 321 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 320 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 323 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 322 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Transform a voxel index into a coordinate value of the voxel central point.
Definition at line 342 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 346 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 350 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::getAsOctoMapVoxels().
|
inline |
Definition at line 230 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellAbsIndexFromCXCYCZ(), mrpt::maps::COccupancyGridMap3D::insertRay(), and mrpt::maps::COccupancyGridMap3D::updateCell().
|
inlineprotected |
Used only from logically const method that really need to modify the object.
Definition at line 362 of file CDynamicGrid3D.h.
|
inlinevirtual |
Changes the size of the grid, maintaining previous contents.
Definition at line 48 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::COccupancyGridMap3D::resizeGrid().
|
inlinevirtual |
Changes the size of the grid, ERASING all previous contents.
If fill_value is left as nullptr, the contents of cells may be undefined (some will remain with their old values, the new ones will have the default voxel value, but the location of old values may change wrt their old places). If fill_value is not nullptr, it is assured that all cells will have a copy of that value after resizing. If resolution_z
<0, the same resolution will be used for all dimensions x,y,z as given in resolution_xy
Definition at line 175 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::CDynamicGrid3D(), and mrpt::maps::COccupancyGridMap3D::setSize().
|
inline |
Transform a coordinate values into voxel indexes.
Definition at line 327 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellByPos(), mrpt::maps::COccupancyGridMap3D::getFreenessByPos(), mrpt::maps::COccupancyGridMap3D::insertRay(), and mrpt::maps::COccupancyGridMap3D::setFreenessByPos().
|
inline |
Definition at line 331 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellByPos(), mrpt::maps::COccupancyGridMap3D::getFreenessByPos(), mrpt::maps::COccupancyGridMap3D::insertRay(), and mrpt::maps::COccupancyGridMap3D::setFreenessByPos().
|
inline |
Definition at line 335 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellByPos(), mrpt::maps::COccupancyGridMap3D::getFreenessByPos(), mrpt::maps::COccupancyGridMap3D::insertRay(), and mrpt::maps::COccupancyGridMap3D::setFreenessByPos().
|
static |
Definition at line 228 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TCELL >::cellByIndex(), and mrpt::containers::CDynamicGrid3D< TCELL >::cellByPos().
|
mutableprotected |
The cells.
Definition at line 359 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::begin(), mrpt::containers::CDynamicGrid3D< TCELL >::cellByIndex(), mrpt::containers::CDynamicGrid3D< TCELL >::cellByPos(), mrpt::containers::CDynamicGrid3D< TCELL >::clear(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::end(), mrpt::containers::CDynamicGrid3D< TCELL >::fill(), mrpt::containers::CDynamicGrid3D< TCELL >::m_map_castaway_const(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getResolutionXY(), mrpt::containers::CDynamicGrid3D< TCELL >::idx2x(), mrpt::containers::CDynamicGrid3D< TCELL >::idx2y(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), mrpt::containers::CDynamicGrid3D< TCELL >::setSize(), mrpt::containers::CDynamicGrid3D< TCELL >::x2idx(), and mrpt::containers::CDynamicGrid3D< TCELL >::y2idx().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getResolutionZ(), mrpt::containers::CDynamicGrid3D< TCELL >::idx2z(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), mrpt::containers::CDynamicGrid3D< TCELL >::setSize(), and mrpt::containers::CDynamicGrid3D< TCELL >::z2idx().
|
protected |
Definition at line 365 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TCELL >::clear(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getSizeX(), mrpt::containers::CDynamicGrid3D< TCELL >::isOutOfBounds(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 365 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TCELL >::getVoxelCount(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 365 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::clear(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getSizeY(), mrpt::containers::CDynamicGrid3D< TCELL >::isOutOfBounds(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 365 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::clear(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getSizeZ(), mrpt::containers::CDynamicGrid3D< TCELL >::getVoxelCount(), mrpt::containers::CDynamicGrid3D< TCELL >::isOutOfBounds(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getXMax(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getXMin(), mrpt::containers::CDynamicGrid3D< TCELL >::idx2x(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), mrpt::containers::CDynamicGrid3D< TCELL >::setSize(), and mrpt::containers::CDynamicGrid3D< TCELL >::x2idx().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getYMax(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getYMin(), mrpt::containers::CDynamicGrid3D< TCELL >::idx2y(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), mrpt::containers::CDynamicGrid3D< TCELL >::setSize(), and mrpt::containers::CDynamicGrid3D< TCELL >::y2idx().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getZMax(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), and mrpt::containers::CDynamicGrid3D< TCELL >::setSize().
|
protected |
Definition at line 363 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TCELL >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TCELL >::getZMin(), mrpt::containers::CDynamicGrid3D< TCELL >::idx2z(), mrpt::containers::CDynamicGrid3D< TCELL >::resize(), mrpt::containers::CDynamicGrid3D< TCELL >::setSize(), and mrpt::containers::CDynamicGrid3D< TCELL >::z2idx().
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020 |