Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

HashGrid3< Item > Class Template Reference
[Three-dimensional Hash Grid]

Three-dimensional Hash Grid Class. More...

#include <hashGrid.h>

List of all members.

External Iterators

typedef HashGridBox3< Item > * BoxIteratorPosition
typedef ForwardIterator< HashGrid3<
Item >, HashGridBox3< Item >,
BoxIteratorPosition, BoxIteratorTraits > 
BoxIterator
typedef ConstForwardIterator<
HashGrid3< Item >, HashGridBox3<
Item >, BoxIteratorPosition,
BoxIteratorTraits > 
ConstBoxIterator
BoxIterator beginBox () throw ()
BoxIterator endBox () throw ()
ConstBoxIterator beginBox () const throw ()
ConstBoxIterator endBox () const throw ()
class BoxIteratorTraits

Internal Iterators

bool apply (UnaryProcessor< Item > &processor) throw ()
bool apply (UnaryProcessor< HashGridBox3< Item > > &processor) throw ()
const Item * getClosestItem (const Vector3 &point, Size distance) const throw ()
 Get the nearest item for a point.
float calculateMinSpacing (LongIndex memory, const Vector3 &size) throw ()
 Calculate the minimum required spacing to build a HashGrid3 with the given size and less than the given memory consumption.

Public Member Functions

Constructors and destructor
 HashGrid3 () throw ()
 Default constructor.
 HashGrid3 (const Vector3 &origin, Size dimension_x, Size dimension_y, Size dimension_z, float spacing_x, float spacing_y, float spacing_z) throw ()
 Constructor using origin, dimensions, and spacings of the grid.
 HashGrid3 (const Vector3 &origin, Size dimension_x, Size dimension_y, Size dimension_z, float spacing) throw ()
 Constructor using origin, dimensions, and a single spacing (only cubic grids).
 HashGrid3 (const Vector3 &origin, const Vector3 &size, float spacing) throw ()
 Constructor using two vectors and a single spacing.
 HashGrid3 (const HashGrid3 &grid, bool deep=true) throw ()
 Copy constructor.
virtual ~HashGrid3 () throw ()
 Destructor.
virtual void clear () throw ()
 Clears the whole grid.
void clear (Position x, Position y, Position z) throw ()
 Clears the HashGridBox3 at position (x, y, z).
void clear (const Vector3 &vector) throw ()
 Clears the HashGridBox3 at position vector.
void destroy () throw ()
 Destroys the grid (obsolete, only calls clear()).
void destroy (Position x, Position y, Position z) throw ()
 Destroys a box of the grid (obsolete, only calls clear()).
void destroy (const Vector3 &vector) throw ()
 Destroys a box of the grid (obsolete, only calls clear()).
Assignment
void set (const Vector3 &origin, const Vector3 &unit, Size dimension_x, Size dimension_y, Size dimension_z) throw ()
 assigns the content of a hash grid (obsolete)
void set (const Vector3 &origin, float unit, Size size) throw ()
 assigns the content of a hash grid (obsolete)
void set (const HashGrid3 &grid, bool deep=true) throw ()
 assigns the content of a hash grid (obsolete)
const HashGrid3operator= (const HashGrid3 &grid) throw ()
 Assignment operator.
void get (Vector3 &origin, Vector3 &unit, Size &dimension_x, Size &dimension_y, Size &dimension_z) const throw ()
void get (HashGrid3 &grid, bool deep=true) const throw ()
Accessors
Size countNonEmptyBoxes () const throw ()
 Counts the non-empty boxes of a grid.
Size getSize () const throw ()
 Returns the size of a grid, i. e. ?????
Vector3getOrigin () throw ()
 Returns the origin of the grid.
const Vector3getOrigin () const throw ()
 Returns a const reference of the grid origin.
Vector3getUnit () throw ()
 Returns the unit of the grid.
const Vector3getUnit () const throw ()
 Returns the unit of the grid (const version).
Size getSizeX () const throw ()
 Get the x dimension of the grid.
Size getSizeY () const throw ()
 Get the y dimension of the grid.
Size getSizeZ () const throw ()
 Get the z dimension of the grid.
HashGridBox3< Item > * getBox (Position x, Position y, Position z) throw ()
 Return the HashGridBox3 at position (x, y, z).
const HashGridBox3< Item > * getBox (Position x, Position y, Position z) const throw ()
 Return the HashGridBox3 at position (x, y, z) (const version).
HashGridBox3< Item > * getBox (const Vector3 &vector) throw ()
 Return the HashGridBox3 at position vector.
const HashGridBox3< Item > * getBox (const Vector3 &vector) const throw ()
 Return the HashGridBox3 at position vector (const version).
bool getIndices (const HashGridBox3< Item > &box, Position &x, Position &y, Position &z) const throw ()
 Get the position indices of a HashGridBox3.
void insert (Position x, Position y, Position z, const Item &item) throw ()
 Insert an item at position (x, y, z).
void insert (const Vector3 &vector, const Item &item) throw ()
 Insert an item at position vector.
bool remove (Position x, Position y, Position z, const Item &item) throw ()
 Remove an item from position (x, y ,z).
bool remove (const Vector3 &vector, const Item &item) throw ()
 Remove an item from position vector.
Miscellaneous
void host (Visitor< HashGrid3 > &visitor) throw ()
Predicates
bool operator== (const HashGrid3 &grid) const throw ()
 Equality operator.
bool operator!= (const HashGrid3 &grid) const throw ()
 Inequality operator.
bool isEmpty () const throw ()
 Tests, whether this is empty.
Debugging and Diagnostics
virtual bool isValid () const throw ()
 Validity check.
virtual void dump (std::ostream &s=std::cout, Size depth=0) const throw ()
 Dump the contents of a HashGrid3 to a stream.


Detailed Description

template<typename Item>
class HashGrid3< Item >

Three-dimensional Hash Grid Class.

?????


Constructor & Destructor Documentation

template<typename Item>
HashGrid3< Item >::HashGrid3 const Vector3 origin,
Size  dimension_x,
Size  dimension_y,
Size  dimension_z,
float  spacing_x,
float  spacing_y,
float  spacing_z
throw ()
 

Constructor using origin, dimensions, and spacings of the grid.

It creates a hashgrid at origin with axis-dependant spacings.

Parameters:
origin 
dimension_x 
dimension_y 
dimension_z 
spacing_x 
spacing_y 
spacing_z 

template<typename Item>
HashGrid3< Item >::HashGrid3 const Vector3 origin,
const Vector3 size,
float  spacing
throw ()
 

Constructor using two vectors and a single spacing.

This constructor creates a hash grid at origin with spacing spacing. The vector size has to be relative to origin and defines the opposite corner of the grid, thereby setting the size of the grid.

Parameters:
origin a vector defining the origin of our cubic hash grid
size a vector defining the opposite corner of the cubic grid
spacing this float will be used as spacing in all three dimensions


Member Function Documentation

template<typename Item>
float HashGrid3< Item >::calculateMinSpacing LongIndex  memory,
const Vector3 size
throw () [static]
 

Calculate the minimum required spacing to build a HashGrid3 with the given size and less than the given memory consumption.

Parameters:
memory the amount of memory in bytes
size the diagonal of the grid
Returns:
the minimal needed spacing

template<typename Item>
const Item * HashGrid3< Item >::getClosestItem const Vector3 point,
Size  distance
const throw ()
 

Get the nearest item for a point.

Parameters:
distance number of adjacted boxes in each direction to search in