Particle Universe
1.2
|
#include <ParticleUniverseSpatialHashTable.h>
Public Types | |
typedef std::vector< T > | HashTableCell |
typedef std::vector< HashTableCell > | HashTableContent |
Public Member Functions | |
SpatialHashTable (void) | |
SpatialHashTable (unsigned int tableSize, unsigned short cellDimension, unsigned short cellOverlap=0.0f) | |
virtual | ~SpatialHashTable (void) |
void | clear (void) |
unsigned int | size (void) const |
unsigned int | put (const Vector3 &position, T object) |
unsigned int | put (const unsigned int cellIndex, T object) |
HashTableCell & | getCell (const Vector3 &position) |
unsigned int | getCellIndex (const Vector3 &position) |
Protected Member Functions | |
unsigned int | _calculateIndex (const Vector3 &position) |
void | _initialise (void) |
Protected Attributes | |
SpatialHashTable::HashTableContent | mHashTable |
unsigned short | mCellDimension |
unsigned short | mCellOverlap |
unsigned int | mTableSize |
The SpatialHashTable is used to determine particles that are 'near' each other and discard particles that are further away. This way only a few particles are taken into account for certain calculations.
typedef std::vector<T> ParticleUniverse::SpatialHashTable< T >::HashTableCell |
typedef std::vector<HashTableCell> ParticleUniverse::SpatialHashTable< T >::HashTableContent |
|
inline |
Todo.
|
inline |
Todo.
|
inlinevirtual |
Destructor.
|
inlineprotected |
Todo.
|
inlineprotected |
Todo.
|
inline |
Clearing the hashtable means that every cell must be cleared, but not mHashTable itself. It still needs mTableSize vectors. Clearing mHashTable would implicate that all cells are removed, so you have to initialise again.
|
inline |
Todo.
|
inline |
Todo.
|
inline |
Todo.
If cell overlap is defined, take that into account. This means that the same object can be put into multiple cells.
|
inline |
If you have multiple objects for which you already know the cellIndex, you can use this convenience function to save time.
|
inline |
Todo.
|
protected |
|
protected |
|
protected |
|
protected |