#include <BALL/DATATYPE/hashGrid.h>
Classes | |
class | BoxIteratorTraits |
Public Member Functions | |
Constructors and destructor | |
HashGrid3 () | |
Default constructor. | |
HashGrid3 (const Vector3 &origin, Size dimension_x, Size dimension_y, Size dimension_z, float spacing_x, float spacing_y, float spacing_z) | |
HashGrid3 (const Vector3 &origin, Size dimension_x, Size dimension_y, Size dimension_z, float spacing) | |
HashGrid3 (const Vector3 &origin, const Vector3 &size, float spacing) | |
HashGrid3 (const HashGrid3 &grid, bool deep=true) | |
Copy constructor. | |
virtual | ~HashGrid3 () |
Destructor. | |
virtual void | clear () |
Clears the whole grid. | |
void | clear (Position x, Position y, Position z) |
Clears the HashGridBox3 at position (x, y, z). | |
void | clear (const Vector3 &vector) |
Clears the HashGridBox3 at position | |
void | destroy () |
Destroys the grid (obsolete, only calls clear()). | |
void | destroy (Position x, Position y, Position z) |
Destroys a box of the grid (obsolete, only calls clear()). | |
void | destroy (const Vector3 &vector) |
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) |
assigns the content of a hash grid (obsolete) | |
void | set (const Vector3 &origin, float unit, Size size) |
assigns the content of a hash grid (obsolete) | |
void | set (const HashGrid3 &grid, bool deep=true) |
assigns the content of a hash grid (obsolete) | |
const HashGrid3 & | operator= (const HashGrid3 &grid) |
Assignment operator. | |
void | get (Vector3 &origin, Vector3 &unit, Size &dimension_x, Size &dimension_y, Size &dimension_z) const |
void | get (HashGrid3 &grid, bool deep=true) const |
Accessors | |
Size | countNonEmptyBoxes () const |
Counts the non-empty boxes of a grid. | |
Size | getSize () const |
Returns the size of a grid, i. e. ????? | |
Vector3 & | getOrigin () |
Returns the origin of the grid. | |
const Vector3 & | getOrigin () const |
Returns a const reference of the grid origin. | |
Vector3 & | getUnit () |
Returns the unit of the grid. | |
const Vector3 & | getUnit () const |
Returns the unit of the grid (const version). | |
Size | getSizeX () const |
Get the x dimension of the grid. | |
Size | getSizeY () const |
Get the y dimension of the grid. | |
Size | getSizeZ () const |
Get the z dimension of the grid. | |
HashGridBox3< Item > * | getBox (Position x, Position y, Position z) |
Return the HashGridBox3 at position (x, y, z). | |
const HashGridBox3< Item > * | getBox (Position x, Position y, Position z) const |
Return the HashGridBox3 at position (x, y, z) (const version). | |
HashGridBox3< Item > * | getBox (const Vector3 &vector) |
Return the HashGridBox3 at position vector. | |
const HashGridBox3< Item > * | getBox (const Vector3 &vector) const |
Return the HashGridBox3 at position vector (const version). | |
bool | getIndices (const HashGridBox3< Item > &box, Position &x, Position &y, Position &z) const |
Get the position indices of a HashGridBox3. | |
void | insert (Position x, Position y, Position z, const Item &item) |
Insert an item at position (x, y, z). | |
void | insert (const Vector3 &vector, const Item &item) |
Insert an item at position | |
bool | remove (Position x, Position y, Position z, const Item &item) |
Remove an item from position (x, y ,z). | |
bool | remove (const Vector3 &vector, const Item &item) |
Remove an item from position | |
Miscellaneous | |
void | host (Visitor< HashGrid3 > &visitor) |
Predicates | |
bool | operator== (const HashGrid3 &grid) const |
Equality operator. | |
bool | operator!= (const HashGrid3 &grid) const |
Inequality operator. | |
bool | isEmpty () const |
Tests, whether | |
Debugging and Diagnostics | |
virtual bool | isValid () const |
Validity check. | |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Dump the contents of a HashGrid3 to a stream. | |
Private Member Functions | |
Index | getIndex_ (const HashGridBox3< Item > &box) const |
void | setNeighbours_ () |
update the neighbour information in the individual boxes | |
Private Attributes | |
HashGridBox3< Item > * | box_ |
Vector3 | origin_ |
Vector3 | unit_ |
Size | dimension_x_ |
Size | dimension_y_ |
Size | dimension_z_ |
External Iterators | |
typedef Position | BoxIteratorPosition |
typedef ForwardIterator < HashGrid3< Item > , HashGridBox3< Item > , BoxIteratorPosition, BoxIteratorTraits > | BoxIterator |
typedef ConstForwardIterator < HashGrid3< Item > , HashGridBox3< Item > , BoxIteratorPosition, BoxIteratorTraits > | ConstBoxIterator |
class | BoxIteratorTraits |
BoxIterator | beginBox () |
BoxIterator | endBox () |
ConstBoxIterator | beginBox () const |
ConstBoxIterator | endBox () const |
Internal Iterators | |
bool | apply (UnaryProcessor< Item > &processor) |
bool | apply (UnaryProcessor< HashGridBox3< Item > > &processor) |
const Item * | getClosestItem (const Vector3 &point, Size distance) const |
static float | calculateMinSpacing (LongIndex memory, const Vector3 &size) |
Three-dimensional Hash Grid Class. ?????
typedef ForwardIterator<HashGrid3<Item>, HashGridBox3<Item>, BoxIteratorPosition, BoxIteratorTraits> BALL::HashGrid3< Item >::BoxIterator |
typedef Position BALL::HashGrid3< Item >::BoxIteratorPosition |
typedef ConstForwardIterator<HashGrid3<Item>, HashGridBox3<Item>, BoxIteratorPosition, BoxIteratorTraits> BALL::HashGrid3< Item >::ConstBoxIterator |
BALL::HashGrid3< Item >::HashGrid3 | ( | ) | [inline] |
Default constructor.
BALL::HashGrid3< Item >::HashGrid3 | ( | const Vector3 & | origin, | |
Size | dimension_x, | |||
Size | dimension_y, | |||
Size | dimension_z, | |||
float | spacing_x, | |||
float | spacing_y, | |||
float | spacing_z | |||
) | [inline] |
Constructor using origin, dimensions, and spacings of the grid. It creates a hashgrid at origin
with axis-dependant spacings.
origin | ||
dimension_x | ||
dimension_y | ||
dimension_z | ||
spacing_x | ||
spacing_y | ||
spacing_z |
BALL::HashGrid3< Item >::HashGrid3 | ( | const Vector3 & | origin, | |
Size | dimension_x, | |||
Size | dimension_y, | |||
Size | dimension_z, | |||
float | spacing | |||
) | [inline] |
Constructor using origin, dimensions, and a single spacing (only cubic grids)
BALL::HashGrid3< Item >::HashGrid3 | ( | const Vector3 & | origin, | |
const Vector3 & | size, | |||
float | spacing | |||
) | [inline] |
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.
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 |
References BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::dimension_x_, BALL::HashGrid3< Item >::dimension_y_, BALL::HashGrid3< Item >::dimension_z_, and BALL::HashGrid3< Item >::setNeighbours_().
BALL::HashGrid3< Item >::HashGrid3 | ( | const HashGrid3< Item > & | grid, | |
bool | deep = true | |||
) | [inline] |
Copy constructor.
BALL::HashGrid3< Item >::~HashGrid3 | ( | ) | [inline, virtual] |
Destructor.
References BALL::HashGrid3< Item >::box_, and BALL::HashGrid3< Item >::clear().
bool BALL::HashGrid3< Item >::apply | ( | UnaryProcessor< HashGridBox3< Item > > & | processor | ) | [inline] |
References BALL::HashGrid3< Item >::box_, and BALL::Processor::BREAK.
bool BALL::HashGrid3< Item >::apply | ( | UnaryProcessor< Item > & | processor | ) | [inline] |
ConstBoxIterator BALL::HashGrid3< Item >::beginBox | ( | ) | const [inline] |
BoxIterator BALL::HashGrid3< Item >::beginBox | ( | ) | [inline] |
BALL_INLINE float BALL::HashGrid3< Item >::calculateMinSpacing | ( | LongIndex | memory, | |
const Vector3 & | size | |||
) | [inline, static] |
Calculate the minimum required spacing to build a HashGrid3 with the given size and less than the given memory consumption.
memory | the amount of memory in bytes | |
size | the diagonal of the grid |
References BALL::Maths::floor(), BALL::TVector3< T >::x, BALL::TVector3< T >::y, and BALL::TVector3< T >::z.
BALL_INLINE void BALL::HashGrid3< Item >::clear | ( | const Vector3 & | vector | ) | [inline] |
Clears the HashGridBox3 at position vector
.
References BALL::HashGridBox3< Item >::clear(), and BALL::HashGrid3< Item >::getBox().
BALL_INLINE void BALL::HashGrid3< Item >::clear | ( | Position | x, | |
Position | y, | |||
Position | z | |||
) | [inline] |
Clears the HashGridBox3 at position (x, y, z).
References BALL::HashGridBox3< Item >::clear(), and BALL::HashGrid3< Item >::getBox().
void BALL::HashGrid3< Item >::clear | ( | ) | [inline, virtual] |
Clears the whole grid.
References BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::dimension_x_, BALL::HashGrid3< Item >::dimension_y_, and BALL::HashGrid3< Item >::dimension_z_.
Referenced by BALL::HashGrid3< Item >::destroy(), BALL::HashGrid3< Item >::set(), and BALL::HashGrid3< Item >::~HashGrid3().
Size BALL::HashGrid3< Item >::countNonEmptyBoxes | ( | ) | const [inline] |
Counts the non-empty boxes of a grid.
References BALL::HashGrid3< Item >::box_, and BALL::HashGrid3< Item >::isEmpty().
Referenced by BALL::HashGrid3< Item >::dump().
BALL_INLINE void BALL::HashGrid3< Item >::destroy | ( | const Vector3 & | vector | ) | [inline] |
Destroys a box of the grid (obsolete, only calls clear()).
References BALL::HashGrid3< Item >::clear().
BALL_INLINE void BALL::HashGrid3< Item >::destroy | ( | Position | x, | |
Position | y, | |||
Position | z | |||
) | [inline] |
Destroys a box of the grid (obsolete, only calls clear()).
References BALL::HashGrid3< Item >::clear().
BALL_INLINE void BALL::HashGrid3< Item >::destroy | ( | ) | [inline] |
Destroys the grid (obsolete, only calls clear()).
References BALL::HashGrid3< Item >::clear().
void BALL::HashGrid3< Item >::dump | ( | std::ostream & | s = std::cout , |
|
Size | depth = 0 | |||
) | const [inline, virtual] |
Dump the contents of a HashGrid3 to a stream.
References BALL_DUMP_DEPTH, BALL_DUMP_STREAM_PREFIX, BALL_DUMP_STREAM_SUFFIX, BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::countNonEmptyBoxes(), BALL::HashGrid3< Item >::dimension_x_, BALL::HashGrid3< Item >::dimension_y_, BALL::HashGrid3< Item >::dimension_z_, BALL::HashGrid3< Item >::getIndex_(), BALL::HashGrid3< Item >::getIndices(), BALL::HashGrid3< Item >::getSize(), BALL::HashGrid3< Item >::isEmpty(), BALL::HashGrid3< Item >::origin_, BALL::HashGrid3< Item >::unit_, and BALL::TVector3< T >::z.
ConstBoxIterator BALL::HashGrid3< Item >::endBox | ( | ) | const [inline] |
BoxIterator BALL::HashGrid3< Item >::endBox | ( | ) | [inline] |
BALL_INLINE void BALL::HashGrid3< Item >::get | ( | HashGrid3< Item > & | grid, | |
bool | deep = true | |||
) | const [inline] |
References BALL::HashGrid3< Item >::set().
BALL_INLINE const HashGridBox3< Item > * BALL::HashGrid3< Item >::getBox | ( | const Vector3 & | vector | ) | const [inline] |
Return the HashGridBox3 at position vector (const version).
BALL_INLINE HashGridBox3< Item > * BALL::HashGrid3< Item >::getBox | ( | const Vector3 & | vector | ) | [inline] |
Return the HashGridBox3 at position vector.
References BALL::Maths::floor(), BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::origin_, BALL::HashGrid3< Item >::unit_, BALL::TVector3< T >::x, BALL::TVector3< T >::y, and BALL::TVector3< T >::z.
BALL_INLINE const HashGridBox3< Item > * BALL::HashGrid3< Item >::getBox | ( | Position | x, | |
Position | y, | |||
Position | z | |||
) | const [inline] |
Return the HashGridBox3 at position (x, y, z) (const version).
BALL_INLINE HashGridBox3< Item > * BALL::HashGrid3< Item >::getBox | ( | Position | x, | |
Position | y, | |||
Position | z | |||
) | [inline] |
Return the HashGridBox3 at position (x, y, z).
References BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::dimension_x_, BALL::HashGrid3< Item >::dimension_y_, and BALL::HashGrid3< Item >::dimension_z_.
Referenced by BALL::HashGrid3< Item >::clear(), BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::getClosestItem(), BALL::HashGrid3< Item >::insert(), BALL::HashGrid3< Item >::remove(), and BALL::HashGrid3< Item >::setNeighbours_().
const Item * BALL::HashGrid3< Item >::getClosestItem | ( | const Vector3 & | point, | |
Size | distance | |||
) | const [inline] |
Get the nearest item for a point
distance | number of adjacted boxes in each direction to search in |
References BALL::HashGridBox3< Item >::beginData(), BALL::HashGridBox3< Item >::endData(), BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::getIndices(), and BALL::HashGridBox3< Item >::isEmpty().
BALL_INLINE Index BALL::HashGrid3< Item >::getIndex_ | ( | const HashGridBox3< Item > & | box | ) | const [inline, private] |
References BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::getSize(), and BALL::INVALID_INDEX.
Referenced by BALL::HashGrid3< Item >::dump().
BALL_INLINE bool BALL::HashGrid3< Item >::getIndices | ( | const HashGridBox3< Item > & | box, | |
Position & | x, | |||
Position & | y, | |||
Position & | z | |||
) | const [inline] |
Get the position indices of a HashGridBox3.
References BALL::INVALID_INDEX, and BALL::INVALID_POSITION.
Referenced by BALL::HashGrid3< Item >::dump(), BALL::HashGrid3< Item >::getClosestItem(), and BALL::HashGrid3< Item >::setNeighbours_().
BALL_INLINE const Vector3 & BALL::HashGrid3< Item >::getOrigin | ( | ) | const [inline] |
Returns a const reference of the grid origin.
References BALL::HashGrid3< Item >::origin_.
BALL_INLINE Vector3 & BALL::HashGrid3< Item >::getOrigin | ( | ) | [inline] |
Returns the origin of the grid.
References BALL::HashGrid3< Item >::origin_.
BALL_INLINE Size BALL::HashGrid3< Item >::getSize | ( | ) | const [inline] |
Returns the size of a grid, i. e. ?????
References BALL::HashGrid3< Item >::dimension_x_, BALL::HashGrid3< Item >::dimension_y_, and BALL::HashGrid3< Item >::dimension_z_.
Referenced by BALL::HashGrid3< Item >::dump(), BALL::HashGrid3< Item >::getIndex_(), BALL::HashGrid3< Item >::isEmpty(), BALL::HashGrid3< Item >::isValid(), BALL::HashGrid3< Item >::BoxIteratorTraits::isValid(), BALL::HashGrid3< Item >::operator==(), BALL::HashGrid3< Item >::set(), and BALL::HashGrid3< Item >::setNeighbours_().
BALL_INLINE Size BALL::HashGrid3< Item >::getSizeX | ( | ) | const [inline] |
Get the x dimension of the grid.
References BALL::HashGrid3< Item >::dimension_x_.
BALL_INLINE Size BALL::HashGrid3< Item >::getSizeY | ( | ) | const [inline] |
Get the y dimension of the grid.
References BALL::HashGrid3< Item >::dimension_y_.
BALL_INLINE Size BALL::HashGrid3< Item >::getSizeZ | ( | ) | const [inline] |
Get the z dimension of the grid.
References BALL::HashGrid3< Item >::dimension_z_.
BALL_INLINE const Vector3 & BALL::HashGrid3< Item >::getUnit | ( | ) | const [inline] |
Returns the unit of the grid (const version).
References BALL::HashGrid3< Item >::unit_.
BALL_INLINE Vector3 & BALL::HashGrid3< Item >::getUnit | ( | ) | [inline] |
Returns the unit of the grid.
References BALL::HashGrid3< Item >::unit_.
BALL_INLINE void BALL::HashGrid3< Item >::host | ( | Visitor< HashGrid3< Item > > & | visitor | ) | [inline] |
BALL_INLINE void BALL::HashGrid3< Item >::insert | ( | const Vector3 & | vector, | |
const Item & | item | |||
) | [inline] |
Insert an item at position vector
.
References BALL::HashGrid3< Item >::getBox(), and BALL::HashGridBox3< Item >::insert().
BALL_INLINE void BALL::HashGrid3< Item >::insert | ( | Position | x, | |
Position | y, | |||
Position | z, | |||
const Item & | item | |||
) | [inline] |
Insert an item at position (x, y, z).
References BALL::HashGridBox3< Item >::insert().
BALL_INLINE bool BALL::HashGrid3< Item >::isEmpty | ( | ) | const [inline] |
Tests, whether this
is empty.
References BALL::HashGrid3< Item >::getSize().
Referenced by BALL::HashGrid3< Item >::countNonEmptyBoxes(), and BALL::HashGrid3< Item >::dump().
bool BALL::HashGrid3< Item >::isValid | ( | ) | const [inline, virtual] |
Validity check.
References BALL::HashGrid3< Item >::box_, and BALL::HashGrid3< Item >::getSize().
BALL_INLINE bool BALL::HashGrid3< Item >::operator!= | ( | const HashGrid3< Item > & | grid | ) | const [inline] |
Inequality operator.
BALL_INLINE const HashGrid3< Item > & BALL::HashGrid3< Item >::operator= | ( | const HashGrid3< Item > & | grid | ) | [inline] |
Assignment operator.
BALL_INLINE bool BALL::HashGrid3< Item >::operator== | ( | const HashGrid3< Item > & | grid | ) | const [inline] |
BALL_INLINE bool BALL::HashGrid3< Item >::remove | ( | const Vector3 & | vector, | |
const Item & | item | |||
) | [inline] |
Remove an item from position vector
.
References BALL::HashGrid3< Item >::getBox(), and BALL::HashGridBox3< Item >::remove().
BALL_INLINE bool BALL::HashGrid3< Item >::remove | ( | Position | x, | |
Position | y, | |||
Position | z, | |||
const Item & | item | |||
) | [inline] |
Remove an item from position (x, y ,z).
References BALL::HashGrid3< Item >::getBox(), and BALL::HashGridBox3< Item >::remove().
void BALL::HashGrid3< Item >::set | ( | const HashGrid3< Item > & | grid, | |
bool | deep = true | |||
) | [inline] |
assigns the content of a hash grid (obsolete)
References BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::dimension_x_, BALL::HashGrid3< Item >::dimension_y_, BALL::HashGrid3< Item >::dimension_z_, BALL::HashGridBox3< Item >::first_item_, BALL::HashGrid3< Item >::getSize(), BALL::HashGridBox3< Item >::insert(), BALL::HashGridBox3< Item >::isEmpty(), BALL::HashGrid3< Item >::origin_, and BALL::HashGrid3< Item >::unit_.
void BALL::HashGrid3< Item >::set | ( | const Vector3 & | origin, | |
float | unit, | |||
Size | size | |||
) | [inline] |
assigns the content of a hash grid (obsolete)
References BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::clear(), BALL::HashGrid3< Item >::dimension_x_, BALL::HashGrid3< Item >::dimension_y_, BALL::HashGrid3< Item >::dimension_z_, BALL::HashGrid3< Item >::getSize(), BALL::HashGrid3< Item >::origin_, BALL::TVector3< T >::set(), BALL::HashGrid3< Item >::setNeighbours_(), and BALL::HashGrid3< Item >::unit_.
void BALL::HashGrid3< Item >::set | ( | const Vector3 & | origin, | |
const Vector3 & | unit, | |||
Size | dimension_x, | |||
Size | dimension_y, | |||
Size | dimension_z | |||
) | [inline] |
assigns the content of a hash grid (obsolete)
Referenced by BALL::HashGrid3< Item >::get().
BALL_INLINE void BALL::HashGrid3< Item >::setNeighbours_ | ( | ) | [inline, private] |
update the neighbour information in the individual boxes
References BALL::HashGrid3< Item >::box_, BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::getIndices(), and BALL::HashGrid3< Item >::getSize().
Referenced by BALL::HashGrid3< Item >::HashGrid3(), and BALL::HashGrid3< Item >::set().
friend class BoxIteratorTraits [friend] |
HashGridBox3<Item>* BALL::HashGrid3< Item >::box_ [private] |
Referenced by BALL::HashGrid3< Item >::apply(), BALL::HashGrid3< Item >::clear(), BALL::HashGrid3< Item >::countNonEmptyBoxes(), BALL::HashGrid3< Item >::dump(), BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::getIndex_(), BALL::HashGrid3< Item >::HashGrid3(), BALL::HashGrid3< Item >::isValid(), BALL::HashGrid3< Item >::operator==(), BALL::HashGrid3< Item >::set(), BALL::HashGrid3< Item >::setNeighbours_(), and BALL::HashGrid3< Item >::~HashGrid3().
Size BALL::HashGrid3< Item >::dimension_x_ [private] |
Referenced by BALL::HashGrid3< Item >::clear(), BALL::HashGrid3< Item >::dump(), BALL::HashGrid3< Item >::get(), BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::getSize(), BALL::HashGrid3< Item >::getSizeX(), BALL::HashGrid3< Item >::HashGrid3(), BALL::HashGrid3< Item >::operator==(), and BALL::HashGrid3< Item >::set().
Size BALL::HashGrid3< Item >::dimension_y_ [private] |
Referenced by BALL::HashGrid3< Item >::clear(), BALL::HashGrid3< Item >::dump(), BALL::HashGrid3< Item >::get(), BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::getSize(), BALL::HashGrid3< Item >::getSizeY(), BALL::HashGrid3< Item >::HashGrid3(), BALL::HashGrid3< Item >::operator==(), and BALL::HashGrid3< Item >::set().
Size BALL::HashGrid3< Item >::dimension_z_ [private] |
Referenced by BALL::HashGrid3< Item >::clear(), BALL::HashGrid3< Item >::dump(), BALL::HashGrid3< Item >::get(), BALL::HashGrid3< Item >::getBox(), BALL::HashGrid3< Item >::getSize(), BALL::HashGrid3< Item >::getSizeZ(), BALL::HashGrid3< Item >::HashGrid3(), BALL::HashGrid3< Item >::operator==(), and BALL::HashGrid3< Item >::set().
Vector3 BALL::HashGrid3< Item >::origin_ [private] |
Vector3 BALL::HashGrid3< Item >::unit_ [private] |