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 27 of file CDynamicGrid3D.h.
#include <mrpt/containers/CDynamicGrid3D.h>
Public Member Functions | |
CDynamicGrid3D (double x_min=-1.0, double x_max=1.0, double y_min=-1.0, double y_max=+1.0, double z_min=-1.0, double z_max=1.0, double resolution_xy=0.5, double resolution_z=0.5) | |
Constructor. More... | |
virtual void | resize (double new_x_min, double new_x_max, double new_y_min, double new_y_max, double new_z_min, double new_z_max, const T &defaultValueNewCells, double additionalMarginMeters=2.0) |
Changes the size of the grid, maintaining previous contents. More... | |
virtual void | setSize (const double x_min, const double x_max, const double y_min, const double y_max, const double z_min, const double z_max, const double resolution_xy, const double 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... | |
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 (double x, double y, double 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 (double x, double y, double z) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
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 |
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... | |
size_t | getSizeX () const |
size_t | getSizeY () const |
size_t | getSizeZ () const |
size_t | getVoxelCount () const |
double | getXMin () const |
double | getXMax () const |
double | getYMin () const |
double | getYMax () const |
double | getZMin () const |
double | getZMax () const |
double | getResolutionXY () const |
double | getResolutionZ () const |
int | x2idx (double x) const |
Transform a coordinate values into voxel indexes. More... | |
int | y2idx (double y) const |
int | z2idx (double z) const |
double | idx2x (int cx) const |
Transform a voxel index into a coordinate value of the voxel central point. More... | |
double | idx2y (int cy) const |
double | idx2z (int cz) const |
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... | |
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... | |
Protected Attributes | |
std::vector< T > | m_map |
The cells. More... | |
double | m_x_min |
double | m_x_max |
double | m_y_min |
double | m_y_max |
double | m_z_min |
double | m_z_max |
double | m_resolution_xy |
double | 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 |
|
inline |
Constructor.
Definition at line 31 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 232 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::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 266 of file CDynamicGrid3D.h.
|
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 276 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 247 of file CDynamicGrid3D.h.
Referenced by 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 255 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 212 of file CDynamicGrid3D.h.
Referenced by mrpt::maps::CRandomFieldGridMap3D::clear().
|
inlineprotected |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class)
Definition at line 338 of file CDynamicGrid3D.h.
|
inlineprotected |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class)
Definition at line 327 of file CDynamicGrid3D.h.
|
inline |
Fills all the cells with the same value.
Definition at line 220 of file CDynamicGrid3D.h.
|
inline |
Definition at line 294 of file CDynamicGrid3D.h.
|
inline |
Definition at line 295 of file CDynamicGrid3D.h.
|
inline |
Definition at line 284 of file CDynamicGrid3D.h.
|
inline |
Definition at line 285 of file CDynamicGrid3D.h.
|
inline |
Definition at line 286 of file CDynamicGrid3D.h.
|
inline |
Definition at line 287 of file CDynamicGrid3D.h.
|
inline |
Definition at line 289 of file CDynamicGrid3D.h.
|
inline |
Definition at line 288 of file CDynamicGrid3D.h.
|
inline |
Definition at line 291 of file CDynamicGrid3D.h.
|
inline |
Definition at line 290 of file CDynamicGrid3D.h.
|
inline |
Definition at line 293 of file CDynamicGrid3D.h.
|
inline |
Definition at line 292 of file CDynamicGrid3D.h.
|
inline |
Transform a voxel index into a coordinate value of the voxel central point.
Definition at line 312 of file CDynamicGrid3D.h.
|
inline |
Definition at line 313 of file CDynamicGrid3D.h.
|
inline |
Definition at line 314 of file CDynamicGrid3D.h.
|
inlineprotected |
Used only from logically const method that really need to modify the object.
Definition at line 320 of file CDynamicGrid3D.h.
|
inlinevirtual |
Changes the size of the grid, maintaining previous contents.
Definition at line 45 of file CDynamicGrid3D.h.
|
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 172 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::CDynamicGrid3D().
|
inline |
Transform a coordinate values into voxel indexes.
Definition at line 297 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos().
|
inline |
Definition at line 301 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos().
|
inline |
Definition at line 305 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos().
|
static |
|
mutableprotected |
The cells.
Definition at line 317 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::fill(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_map_castaway_const(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 322 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionXY(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2x(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2y(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::x2idx(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::y2idx().
|
protected |
Definition at line 322 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionZ(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2z(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::z2idx().
|
protected |
Definition at line 323 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getSizeX(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 323 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getVoxelCount(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 323 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getSizeY(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 323 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getSizeZ(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getVoxelCount(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 321 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getXMax(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 321 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getXMin(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2x(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::x2idx().
|
protected |
Definition at line 321 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getYMax(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 321 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getYMin(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2y(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::y2idx().
|
protected |
Definition at line 321 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getZMax(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 321 of file CDynamicGrid3D.h.
Referenced by mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getZMin(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2z(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::z2idx().
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 |