IMP logo

IMP::algebra::Grid3D< VT > Class Template Reference


Detailed Description

template<class VT>
class IMP::algebra::Grid3D< VT >

A voxel grid in 3D space.

The VT is stored in each grid cell.

Basic operations
Creating a grid with a given cell size and upper and lower bounds
   BoundinBox3D bb(VectorD<3>(10,10,10), VectorD<3>(100,100,100));
   typdef Grid3D<Ints> Grid;
   Grid grid(5, bb, 0.0);
Iterate over the set of voxels in incident on a bounding box:
   BoundingBoxD<3> bb(VectorD<3>(20.2,20.3,20.5), VectorD<3>(31.3,32.5,38.9));
   for (Grid::IndexIterator it= grid.voxels_begin(bb);
        it != grid.voxels_end(bb); ++it) {
        it->push_back(1);
   }

Note:
This class is not available in python.
Inheritance diagram for IMP::algebra::Grid3D< VT >:

Inheritance graph
[legend]

Public Types

typedef VT Voxel
 The type stored in each voxel.

Public Member Functions

BoundingBoxD< 3 > get_bounding_box () const
unsigned int get_number_of_voxels (unsigned int i) const
 Return the number of voxels in a certain direction.
VectorD< 3 > get_unit_cell () const
 Return the unit cell.
const Voxelget_voxel (const VectorD< 3 > &v) const
 Grid3D ()
 An empty grid.
 Grid3D (float side, const BoundingBoxD< 3 > &bb, Voxel def=Voxel())
 Initialize the grid.
 Grid3D (int xd, int yd, int zd, const BoundingBoxD< 3 > &bb, Voxel def=Voxel())
 Initialize the grid.
const Voxel operator[] (const VectorD< 3 > &v) const
 Get the data in a particular cell.
Voxeloperator[] (const VectorD< 3 > &v)
 Get the data in a particular cell.
void set_bounding_box (const BoundingBoxD< 3 > &bb3)
 Change the bounding box but not the grid or contents.
Voxel iterators
These iterators go through a range of voxels in the grid. These voxels include any that touch or are contained in the shape passed to the begin/end calls.

The value type is the contents of the voxel.

AllVoxelConstIterator voxels_begin () const
AllVoxelIterator voxels_begin ()
VoxelConstIterator voxels_begin (const BoundingBoxD< 3 > &bb) const
VoxelIterator voxels_begin (const BoundingBoxD< 3 > &bb)
AllVoxelConstIterator voxels_end () const
AllVoxelIterator voxels_end ()
VoxelConstIterator voxels_end (const BoundingBoxD< 3 > &bb) const
VoxelIterator voxels_end (const BoundingBoxD< 3 > &bb)

Constructor & Destructor Documentation

template<class VT>
IMP::algebra::Grid3D< VT >::Grid3D ( int  xd,
int  yd,
int  zd,
const BoundingBoxD< 3 > &  bb,
Voxel  def = Voxel() 
)

Initialize the grid.

Parameters:
[in] xd The number of voxels in the x direction
[in] yd The number of voxels in the y direction
[in] zd The number of voxels in the z direction
[in] bb The bounding box.
[in] def The default value for the voxels

template<class VT>
IMP::algebra::Grid3D< VT >::Grid3D ( float  side,
const BoundingBoxD< 3 > &  bb,
Voxel  def = Voxel() 
)

Initialize the grid.

Parameters:
[in] side The side length for the voxels
[in] bb The bounding box. Note that the final bounding box might be slightly different as the actual grid size must be divisible by the voxel side.
[in] def The default value for the voxels


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

Generated on Mon Mar 8 23:08:47 2010 for IMP by doxygen 1.5.8