Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
distance_field::VoxelGrid< T > Class Template Reference

Generic container for a discretized 3D voxel grid for any class/structure. More...

#include <voxel_grid.h>

Inheritance diagram for distance_field::VoxelGrid< T >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Dimension { DIM_X = 0, DIM_Y = 1, DIM_Z = 2 }

Public Member Functions

T & getCell (int x, int y, int z)
 Gets the value at a given integer location.
const T & getCell (int x, int y, int z) const
 Gets the value at a given integer location (const version).
int getNumCells (Dimension dim) const
 Gets the number of cells of the given dimension.
double getOrigin (Dimension dim) const
 Gets the origin of the given dimension.
double getResolution (Dimension dim) const
 Gets the resolution of the given dimension.
double getSize (Dimension dim) const
 Gets the size of the given dimension.
bool gridToWorld (int x, int y, int z, double &world_x, double &world_y, double &world_z) const
 Converts grid coordinates to world coordinates.
const T & operator() (double x, double y, double z) const
 Gets the value at the given position (returns the value from the closest discretized location).
void reset (T initial)
 Reset the entire grid to the given initial value.
void setCell (int x, int y, int z, T &obj)
 Sets the value at an integer location.
 VoxelGrid (double size_x, double size_y, double size_z, double resolution, double origin_x, double origin_y, double origin_z, T default_object)
bool worldToGrid (double world_x, double world_y, double world_z, int &x, int &y, int &z) const
 Converts world coordinates to grid coordinates.
virtual ~VoxelGrid ()

Protected Member Functions

int getCellFromLocation (Dimension dim, double loc) const
 Gets the cell number from the location.
double getLocationFromCell (Dimension dim, int cell) const
 Gets the location from the cell number.
bool isCellValid (int x, int y, int z) const
 Checks if the given cell is within the voxel grid.
bool isCellValid (Dimension dim, int cell) const
 Checks validity of the given cell for a particular dimension.
int ref (int x, int y, int z) const
 Gets the reference in the data_ array for the given integer x,y,z location.

Protected Attributes

T * data_
T *** data_ptrs_
default_object_
int num_cells_ [3]
int num_cells_total_
double origin_ [3]
double resolution_ [3]
double size_ [3]
int stride1_
int stride2_

Detailed Description

template<typename T>
class distance_field::VoxelGrid< T >

Generic container for a discretized 3D voxel grid for any class/structure.

Definition at line 50 of file voxel_grid.h.


Member Enumeration Documentation

template<typename T>
enum distance_field::VoxelGrid::Dimension
Enumerator:
DIM_X 
DIM_Y 
DIM_Z 

Definition at line 94 of file voxel_grid.h.


Constructor & Destructor Documentation

template<typename T>
distance_field::VoxelGrid< T >::VoxelGrid ( double  size_x,
double  size_y,
double  size_z,
double  resolution,
double  origin_x,
double  origin_y,
double  origin_z,
default_object 
)

Constructor for the VoxelGrid.

Parameters:
size_xSize (x axis) of the container in meters
size_ySize (y axis) of the container in meters
size_zSize (z axis) of the container in meters
resolution,:resolution (size of a single cell) in meters
origin_xOrigin (x axis) of the container
origin_yOrigin (y axis) of the container
origin_zOrigin (z axis) of the container
default_objectThe object to return for an out-of-bounds query

Definition at line 172 of file voxel_grid.h.

template<typename T >
distance_field::VoxelGrid< T >::~VoxelGrid ( ) [virtual]

Definition at line 199 of file voxel_grid.h.


Member Function Documentation

template<typename T >
T & distance_field::VoxelGrid< T >::getCell ( int  x,
int  y,
int  z 
) [inline]

Gets the value at a given integer location.

Definition at line 261 of file voxel_grid.h.

template<typename T >
const T & distance_field::VoxelGrid< T >::getCell ( int  x,
int  y,
int  z 
) const [inline]

Gets the value at a given integer location (const version).

Definition at line 267 of file voxel_grid.h.

template<typename T >
int distance_field::VoxelGrid< T >::getCellFromLocation ( Dimension  dim,
double  loc 
) const [inline, protected]

Gets the cell number from the location.

Definition at line 279 of file voxel_grid.h.

template<typename T >
double distance_field::VoxelGrid< T >::getLocationFromCell ( Dimension  dim,
int  cell 
) const [inline, protected]

Gets the location from the cell number.

Definition at line 289 of file voxel_grid.h.

template<typename T >
int distance_field::VoxelGrid< T >::getNumCells ( Dimension  dim) const [inline]

Gets the number of cells of the given dimension.

Definition at line 244 of file voxel_grid.h.

template<typename T >
double distance_field::VoxelGrid< T >::getOrigin ( Dimension  dim) const [inline]

Gets the origin of the given dimension.

Definition at line 238 of file voxel_grid.h.

template<typename T >
double distance_field::VoxelGrid< T >::getResolution ( Dimension  dim) const [inline]

Gets the resolution of the given dimension.

Definition at line 232 of file voxel_grid.h.

template<typename T >
double distance_field::VoxelGrid< T >::getSize ( Dimension  dim) const [inline]

Gets the size of the given dimension.

Definition at line 226 of file voxel_grid.h.

template<typename T >
bool distance_field::VoxelGrid< T >::gridToWorld ( int  x,
int  y,
int  z,
double &  world_x,
double &  world_y,
double &  world_z 
) const [inline]

Converts grid coordinates to world coordinates.

Definition at line 302 of file voxel_grid.h.

template<typename T >
bool distance_field::VoxelGrid< T >::isCellValid ( int  x,
int  y,
int  z 
) const [inline, protected]

Checks if the given cell is within the voxel grid.

Definition at line 205 of file voxel_grid.h.

template<typename T >
bool distance_field::VoxelGrid< T >::isCellValid ( Dimension  dim,
int  cell 
) const [inline, protected]

Checks validity of the given cell for a particular dimension.

Definition at line 214 of file voxel_grid.h.

template<typename T >
const T & distance_field::VoxelGrid< T >::operator() ( double  x,
double  y,
double  z 
) const [inline]

Gets the value at the given position (returns the value from the closest discretized location).

Definition at line 250 of file voxel_grid.h.

template<typename T >
int distance_field::VoxelGrid< T >::ref ( int  x,
int  y,
int  z 
) const [inline, protected]

Gets the reference in the data_ array for the given integer x,y,z location.

Definition at line 220 of file voxel_grid.h.

template<typename T>
void distance_field::VoxelGrid< T >::reset ( initial) [inline]

Reset the entire grid to the given initial value.

Definition at line 296 of file voxel_grid.h.

template<typename T>
void distance_field::VoxelGrid< T >::setCell ( int  x,
int  y,
int  z,
T &  obj 
) [inline]

Sets the value at an integer location.

Definition at line 273 of file voxel_grid.h.

template<typename T >
bool distance_field::VoxelGrid< T >::worldToGrid ( double  world_x,
double  world_y,
double  world_z,
int &  x,
int &  y,
int &  z 
) const [inline]

Converts world coordinates to grid coordinates.

Definition at line 311 of file voxel_grid.h.


Member Data Documentation

template<typename T>
T* distance_field::VoxelGrid< T >::data_ [protected]

Storage for data elements

Definition at line 132 of file voxel_grid.h.

template<typename T>
T*** distance_field::VoxelGrid< T >::data_ptrs_ [protected]

Definition at line 134 of file voxel_grid.h.

template<typename T>
T distance_field::VoxelGrid< T >::default_object_ [protected]

The default object to return in case of out-of-bounds query

Definition at line 133 of file voxel_grid.h.

template<typename T>
int distance_field::VoxelGrid< T >::num_cells_[3] [protected]

Definition at line 138 of file voxel_grid.h.

template<typename T>
int distance_field::VoxelGrid< T >::num_cells_total_ [protected]

Definition at line 139 of file voxel_grid.h.

template<typename T>
double distance_field::VoxelGrid< T >::origin_[3] [protected]

Definition at line 137 of file voxel_grid.h.

template<typename T>
double distance_field::VoxelGrid< T >::resolution_[3] [protected]

Definition at line 136 of file voxel_grid.h.

template<typename T>
double distance_field::VoxelGrid< T >::size_[3] [protected]

Definition at line 135 of file voxel_grid.h.

template<typename T>
int distance_field::VoxelGrid< T >::stride1_ [protected]

Definition at line 140 of file voxel_grid.h.

template<typename T>
int distance_field::VoxelGrid< T >::stride2_ [protected]

Definition at line 141 of file voxel_grid.h.


The documentation for this class was generated from the following file:


distance_field
Author(s): Mrinal Kalakrishnan / mail@mrinal.net
autogenerated on Thu Dec 12 2013 11:08:36