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

const T & getCell (int x, int y, int z) const
 Gets the value at a given integer location (const version).
T & getCell (int x, int y, int z)
 Gets the value at a given integer location.
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 (Dimension dim, int cell) const
 Checks validity of the given cell for a particular dimension.
bool isCellValid (int x, int y, int z) const
 Checks if the given cell is within the voxel grid.
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 49 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 93 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 
) [inline]

Constructor for the VoxelGrid.

Parameters:
size_x Size (x axis) of the container in meters
size_y Size (y axis) of the container in meters
size_z Size (z axis) of the container in meters
resolution,: resolution (size of a single cell) in meters
origin_x Origin (x axis) of the container
origin_y Origin (y axis) of the container
origin_z Origin (z axis) of the container
default_object The object to return for an out-of-bounds query

Definition at line 171 of file voxel_grid.h.

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

Definition at line 198 of file voxel_grid.h.


Member Function Documentation

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 266 of file voxel_grid.h.

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 260 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 278 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 284 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 243 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 237 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 231 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 225 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 297 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 213 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 204 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 249 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 219 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 291 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 272 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 306 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 131 of file voxel_grid.h.

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

Definition at line 133 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 132 of file voxel_grid.h.

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

Definition at line 137 of file voxel_grid.h.

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

Definition at line 138 of file voxel_grid.h.

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

Definition at line 136 of file voxel_grid.h.

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

Definition at line 135 of file voxel_grid.h.

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

Definition at line 134 of file voxel_grid.h.

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

Definition at line 139 of file voxel_grid.h.

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

Definition at line 140 of file voxel_grid.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator


distance_field
Author(s): Mrinal Kalakrishnan / mail@mrinal.net
autogenerated on Fri Jan 11 09:54:13 2013