#include <hashGrid.h>
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) | |
Constructor using origin,
dimensions, and spacings of the grid. |
|
HashGrid3 (const Vector3 &origin, Size dimension_x, Size dimension_y, Size dimension_z, float spacing) | |
Constructor using origin,
dimensions, and a single spacing (only cubic
grids). |
|
HashGrid3 (const Vector3 &origin, const Vector3 &size, float spacing) | |
Constructor using two vectors and a
single 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
vector . |
|
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
vector . |
|
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
vector . |
|
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 this is
empty. |
|
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. |
|
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 |
Get the nearest item for a point.
|
|
static float | calculateMinSpacing (LongIndex memory, const Vector3 &size) |
Calculate the minimum required
spacing to build a HashGrid3 with the
given size and less than the given memory consumption.
|
?????
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 | |||
) |
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, | |
const Vector3 & | size, | |||
float | spacing | |||
) |
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 |
float BALL::HashGrid3< Item >::calculateMinSpacing | ( | LongIndex | memory, | |
const Vector3 & | size | |||
) | [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.
const Item * BALL::HashGrid3< Item >::getClosestItem | ( | const Vector3 & | point, | |
Size | distance | |||
) | const |
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().