HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_HashGrid< utPtr > Class Template Reference

#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
 

Detailed Description

template<typename utPtr>
class UT_HashGrid< utPtr >

Definition at line 44 of file UT_HashGrid.h.

Constructor & Destructor Documentation

template<typename utPtr >
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.

template<typename utPtr>
UT_HashGrid< utPtr >::~UT_HashGrid ( )
inline

Trivial destructor.

Definition at line 66 of file UT_HashGrid.h.

Member Function Documentation

template<typename utPtr >
void UT_HashGrid< utPtr >::findAllCloseIndices ( const UT_Vector3 p,
UT_IntArray idxlist 
) const
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.

template<typename utPtr>
void UT_HashGrid< utPtr >::findCloseElements ( const UT_Vector3 p,
UT_Array< utPtr > &  list 
) const
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.

template<typename utPtr>
fpreal UT_HashGrid< utPtr >::getCellWidth ( ) const
inline

Definition at line 108 of file UT_HashGrid.h.

template<typename utPtr>
utPtr UT_HashGrid< utPtr >::getElement ( int  idx) const
inline

Definition at line 106 of file UT_HashGrid.h.

template<typename utPtr >
int64 UT_HashGrid< utPtr >::getMemoryUsage ( bool  inclusive) const

Definition at line 56 of file UT_HashGrid.C.

template<typename utPtr>
int UT_HashGrid< utPtr >::getNumCells ( ) const
inline

Definition at line 70 of file UT_HashGrid.h.

template<typename utPtr>
UT_Vector3 UT_HashGrid< utPtr >::getPos ( int  idx) const
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 105 of file UT_HashGrid.h.

template<typename utPtr>
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.

template<typename utPtr >
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.

template<typename utPtr >
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.

template<typename utPtr >
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.


The documentation for this class was generated from the following files: