HDK
|
#include <UT_HashGrid.h>
Public Member Functions | |
UT_HashGrid (fpreal cellsize, const UT_Vector3 &origin, bool fullinit, unsigned int sz=0) | |
~UT_HashGrid () | |
Trivial destructor. More... | |
int64 | getMemoryUsage (bool inclusive) const |
int | getNumCells () const |
bool | insert (const UT_Vector3 &p, utPtr t) |
void | insertBlanks (int nblanks) |
void | findCloseElements (const UT_Vector3 &p, UT_Array< utPtr > &list) const |
void | findAllCloseIndices (const UT_Vector3 &p, UT_IntArray &idxlist) const |
void | reset (unsigned int sz=0) |
void | reset (fpreal cellsize, const UT_Vector3 &origin, bool fullinit, unsigned int sz=0) |
UT_Vector3 | getPos (int idx) const |
utPtr | getElement (int idx) const |
fpreal | getCellWidth () const |
Definition at line 39 of file UT_HashGrid.h.
UT_HashGrid< utPtr >::UT_HashGrid | ( | fpreal | cellsize, |
const UT_Vector3 & | origin, | ||
bool | fullinit, | ||
unsigned int | sz = 0 |
||
) |
Constructor takes a floating point value to indicate the size of each grid cell to be stored by the, and optionally takes a size parameter to determine the initial size of the grid cell array. The constructor also requires an origin about which the point set will be roughly centred. fullinit determines whether or not a point is associated with all surrounding grid cells immediately upon addition, or if a point should only ever be associated with one grid cell. In the second case, each query requires that 27 grid cells be checked instead of 1. This is essentially a trade off between the cost of building the data structure and the cost of making point queries. If the number of point queries is likely to outnumber the number of points added to the tree, then fullinit = true is recommended.
Definition at line 34 of file UT_HashGrid.C.
|
inline |
Trivial destructor.
Definition at line 61 of file UT_HashGrid.h.
|
inline |
Finds all close indices, does no distance lookups! This is every index within +/- one cell
Definition at line 212 of file UT_HashGrid.C.
|
inline |
Finds all elements close to the given point and returns a list of those elements.
Definition at line 143 of file UT_HashGrid.C.
|
inline |
Definition at line 103 of file UT_HashGrid.h.
|
inline |
Definition at line 101 of file UT_HashGrid.h.
int64 UT_HashGrid< utPtr >::getMemoryUsage | ( | bool | inclusive | ) | const |
Definition at line 56 of file UT_HashGrid.C.
|
inline |
Definition at line 65 of file UT_HashGrid.h.
|
inline |
These lookup our element and positions using the hash grid's index which corresponds to the order in which you called insert.
Definition at line 100 of file UT_HashGrid.h.
bool UT_HashGrid< utPtr >::insert | ( | const UT_Vector3 & | p, |
utPtr | t | ||
) |
Inserts a new element in to the set using the given point to determine that element's location in the grid. Returns true if successful.
Definition at line 73 of file UT_HashGrid.C.
void UT_HashGrid< utPtr >::insertBlanks | ( | int | nblanks | ) |
Inserts blank elements so our index list will match an external structure with holes.
Definition at line 131 of file UT_HashGrid.C.
void UT_HashGrid< utPtr >::reset | ( | unsigned int | sz = 0 | ) |
Resets the structure by clearing all elements from it and optionally reinitializing the cell array to the given size.
Definition at line 262 of file UT_HashGrid.C.
void UT_HashGrid< utPtr >::reset | ( | fpreal | cellsize, |
const UT_Vector3 & | origin, | ||
bool | fullinit, | ||
unsigned int | sz = 0 |
||
) |
Additional reset function that also changes the cell width and origin for the structure.
Definition at line 280 of file UT_HashGrid.C.