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 20 of file CDynamicGrid3D.h.
#include <mrpt/utils/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=NULL) |
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 (double x, double y, double z) |
Returns a pointer to the contents of a voxel given by its coordinates, or NULL if it is out of the map extensions. More... | |
const T * | cellByPos (double x, double y, double 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 NULL 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 NULL 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... | |
void | dyngridcommon_writeToStream (mrpt::utils::CStream &out) const |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class) More... | |
void | dyngridcommon_readFromStream (mrpt::utils::CStream &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 24 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 191 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos().
|
inline |
Returns a pointer to the contents of a voxel given by its voxel indexes, or NULL if it is out of the map extensions.
Definition at line 214 of file CDynamicGrid3D.h.
|
inline |
Returns a pointer to the contents of a voxel given by its voxel indexes, or NULL if it is out of the map extensions.
Definition at line 223 of file CDynamicGrid3D.h.
|
inline |
Returns a pointer to the contents of a voxel given by its coordinates, or NULL if it is out of the map extensions.
Definition at line 198 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 205 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 170 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 269 of file CDynamicGrid3D.h.
|
inlineprotected |
Serialization of all parameters, except the contents of each voxel (responsability of the derived class)
Definition at line 263 of file CDynamicGrid3D.h.
|
inline |
Fills all the cells with the same value.
Definition at line 177 of file CDynamicGrid3D.h.
|
inline |
Definition at line 242 of file CDynamicGrid3D.h.
|
inline |
Definition at line 243 of file CDynamicGrid3D.h.
|
inline |
Definition at line 230 of file CDynamicGrid3D.h.
|
inline |
Definition at line 231 of file CDynamicGrid3D.h.
|
inline |
Definition at line 232 of file CDynamicGrid3D.h.
|
inline |
Definition at line 233 of file CDynamicGrid3D.h.
|
inline |
Definition at line 236 of file CDynamicGrid3D.h.
|
inline |
Definition at line 235 of file CDynamicGrid3D.h.
|
inline |
Definition at line 238 of file CDynamicGrid3D.h.
|
inline |
Definition at line 237 of file CDynamicGrid3D.h.
|
inline |
Definition at line 240 of file CDynamicGrid3D.h.
|
inline |
Definition at line 239 of file CDynamicGrid3D.h.
|
inline |
Transform a voxel index into a coordinate value of the voxel central point.
Definition at line 251 of file CDynamicGrid3D.h.
|
inline |
Definition at line 252 of file CDynamicGrid3D.h.
|
inline |
Definition at line 253 of file CDynamicGrid3D.h.
|
inline |
Definition at line 184 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ().
|
inlineprotected |
Used only from logically const method that really need to modify the object.
Definition at line 258 of file CDynamicGrid3D.h.
|
inlinevirtual |
Changes the size of the grid, maintaining previous contents.
Definition at line 33 of file CDynamicGrid3D.h.
|
inlinevirtual |
Changes the size of the grid, ERASING all previous contents.
If fill_value is left as NULL, 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 NULL, 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 135 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::CDynamicGrid3D().
|
inline |
Transform a coordinate values into voxel indexes.
Definition at line 246 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos().
|
inline |
Definition at line 247 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos().
|
inline |
Definition at line 248 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos().
|
static |
|
mutableprotected |
The cells.
Definition at line 256 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::fill(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::m_map_castaway_const(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionXY(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2x(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2y(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::x2idx(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::y2idx().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionZ(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2z(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::z2idx().
|
protected |
Definition at line 261 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getSizeX(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::isOutOfBounds(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 261 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getVoxelCount(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 261 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getSizeY(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::isOutOfBounds(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 261 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::clear(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getSizeZ(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getVoxelCount(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::isOutOfBounds(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getXMax(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getXMin(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2x(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::x2idx().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getYMax(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getYMin(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2y(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::y2idx().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getZMax(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize().
|
protected |
Definition at line 260 of file CDynamicGrid3D.h.
Referenced by mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::getZMin(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::idx2z(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::resize(), mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::setSize(), and mrpt::utils::CDynamicGrid3D< TRandomFieldVoxel >::z2idx().
Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019 |