KrisLibrary
1.0.0
|
A grid containing objects (referenced by void pointers) More...
#include <GridSubdivision.h>
Public Types | |
typedef IntTriple | Index |
typedef void * | Value |
typedef bool(* | QueryCallback) (void *value) |
typedef UNORDERED_MAP_TEMPLATE< Index, Value, IndexHash > | HashTable |
Public Member Functions | |
GridHash3D (Real h=1) | |
GridHash3D (const Vector3 &h) | |
size_t | GetBucketCount () const |
void | SetBucketCount (size_t n) |
Vector3 | GetResolution () const |
void | SetResolution (const Vector3 &h) |
Changes the resolution after construction – need to have all buckets empty. | |
void | SetResolution (Real h) |
Changes the resolution after construction – need to have all buckets empty. | |
void | Set (const Index &i, void *data) |
Sets the data at a given index. | |
void * | Get (const Index &i) const |
Retrieves the data at a given index. | |
void * | Erase (const Index &i) |
Important: this method just removes the item from the hash, but does not delete its memory. | |
bool | Contains (const Index &i) |
Returns true if the hash contains the given index. | |
void | Clear () |
void | Enumerate (std::vector< Value > &items) const |
void | PointToIndex (const Vector3 &p, Index &i) const |
void | PointToIndex (const Vector3 &p, Index &i, Vector3 &u) const |
void | IndexBucketBounds (const Index &i, Vector3 &bmin, Vector3 &bmax) const |
void | GetRange (Index &imin, Index &imax) const |
void | GetRange (Vector3 &bmin, Vector3 &bmax) const |
bool | IndexQuery (const Index &imin, const Index &imax, QueryCallback f) const |
bool | BoxQuery (const Vector3 &bmin, const Vector3 &bmax, QueryCallback f) const |
bool | BallQuery (const Vector3 &c, Real r, QueryCallback f) const |
bool | SegmentQuery (const Vector3 &a, const Vector3 &b, QueryCallback f) const |
void | IndexItems (const Index &imin, const Index &imax, std::vector< Value > &items) const |
void | BoxItems (const Vector3 &bmin, const Vector3 &bmax, std::vector< Value > &items) const |
void | BallItems (const Vector3 &c, Real r, std::vector< Value > &items) const |
void | SegmentItems (const Vector3 &a, const Vector3 &b, std::vector< Value > &items) const |
Public Attributes | |
Vector3 | hinv |
HashTable | buckets |
A grid containing objects (referenced by void pointers)
The map from a point x to an index is floor(x./h) where ./ indicates element-wise division, and h is the resolution parameter defined on construction (see Grid).