Support Forum G3D Web Page |
A multiset of values (i.e., with duplicates allowed) indexed efficiently by spatial location. More...
Classes | |
class | BoxIterator |
class | CellIterator |
class | Iterator |
class | SphereIterator |
Public Types | |
enum | { CURRENT = 0 } |
typedef Array< Value, 15 > | ValueArray |
Public Member Functions | |
FastPointHashGrid (float gatherRadiusHint=0.5f, int expectedNumCells=16) | |
Iterator | begin () const |
BoxIterator | begin (const AABox &box) const |
SphereIterator | begin (const Sphere &sphere) const |
Iterates over all values that are contained within the sphere. More... | |
CellIterator | beginCell () |
Iterates over non-empty cells, each of which contains a ValueArray. More... | |
float | cellWidth () const |
void | clear (float gatherRadiusHint=CURRENT, int newExpectedNumCells=CURRENT) |
void | debugPrintStatistics () const |
void | fastClear () |
Removes all elements but does not release the underlying structure. More... | |
void | insert (const Value &v) |
If the same value is inserted multiple times, it will appear multiple times (which is usually desirable). More... | |
void | insert (const Array< Value > &array) |
int | numCells () const |
Actual number of grid cells currently allocated. More... | |
int | size () const |
Returns the number of elements. More... | |
TableType * | underlyingTable () const |
Protected Types | |
typedef FastPODTable< Vector4int16, ValueArray, HashTrait< Vector4int16 >, EqualsTrait< Vector4int16 >, false > | TableType |
Protected Member Functions | |
Vector4int16 | toCell (const Vector3 &pos) const |
Static Protected Member Functions | |
static float | gatherRadiusToCellWidth (float r) |
Increase this value if the cost of iterating over cells seems high. More... | |
Protected Attributes | |
float | m_cellsPerMeter |
float | m_metersPerCell |
int | m_size |
TableType * | m_table |
A multiset of values (i.e., with duplicates allowed) indexed efficiently by spatial location.
This is optimized for 64-bit processors. It generally performs at least as well as PointHashGrid (although it does not support remove operations), is about 2x faster to build, and has a simpler structure that is more amenable to serialization.
|
protected |
typedef Array<Value, 15> G3D::FastPointHashGrid< Value, PosFunc >::ValueArray |
|
inline |
|
inline |
|
inline |
|
inline |
Iterates over all values that are contained within the sphere.
|
inline |
Iterates over non-empty cells, each of which contains a ValueArray.
|
inline |
|
inline |
gatherRadiusHint | If CURRENT, use the current cell width |
newExpectedNumCells | If CURRENT, use the current expected number of cells |
Referenced by G3D::FastPointHashGrid< Value, PosFunc >::FastPointHashGrid().
|
inline |
|
inline |
Removes all elements but does not release the underlying structure.
|
inlinestaticprotected |
Increase this value if the cost of iterating over cells seems high.
Decrease this value if the cost of rejecting points that are outside of a box seems high
Currently the best sphere gather performance seems to be when the cell width is slightly smaller than the radius of the gather sphere, so that one can expect between 27 and 64 cells to be gathered.
Referenced by G3D::FastPointHashGrid< Value, PosFunc >::clear().
|
inline |
If the same value is inserted multiple times, it will appear multiple times (which is usually desirable).
Referenced by G3D::FastPointHashGrid< Value, PosFunc >::insert().
|
inline |
|
inline |
Actual number of grid cells currently allocated.
|
inline |
Returns the number of elements.
|
inlineprotected |
Referenced by G3D::FastPointHashGrid< Value, PosFunc >::insert().
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by G3D::FastPointHashGrid< Value, PosFunc >::clear(), G3D::FastPointHashGrid< Value, PosFunc >::debugPrintStatistics(), G3D::FastPointHashGrid< Value, PosFunc >::fastClear(), G3D::FastPointHashGrid< Value, PosFunc >::numCells(), and G3D::FastPointHashGrid< Value, PosFunc >::underlyingTable().