iMSTK
Interactive Medical Simulation Toolkit
|
Implementation of SpatialHashTable using separate chaining. More...
#include <imstkSpatialHashTableSeparateChaining.h>
Public Member Functions | |
SpatialHashTableSeparateChaining () | |
Default constructor. | |
void | insertPoints (const VecDataArray< double, 3 > &points) |
Insert an array of points. More... | |
void | insertPoint (const Vec3d &point) |
Insert an array of points. More... | |
void | setLoadFactorMax (float loadFactorMax) |
Sets the max load factor. More... | |
std::vector< size_t > | getPointsInAABB (const Vec3d &corner1, const Vec3d &corner2) |
Finds IDs of all points in an AABB. More... | |
void | getPointsInAABB (std::vector< size_t > &result, const Vec3d &corner1, const Vec3d &corner2) |
Finds IDs of all points in an AABB. More... | |
std::vector< size_t > | getPointsInSphere (const Vec3d &ppos, double radius) |
Find IDs of all points in a sphere centered at ppos and having given radius. More... | |
void | getPointsInSphere (std::vector< size_t > &result, const Vec3d &ppos, const double radius) |
Find IDs of all points in a sphere centered at ppos and having given radius. More... | |
void | clear () |
Clears the table. | |
virtual void | setCellSize (double x, double y, double z) override |
Protected constructor. More... | |
void | recomputePointHash () |
Update cell size for all points and rehash. This is called after changing the cell dimensions. | |
Protected Member Functions | |
virtual void | rehash () override |
Rehash the hash table. | |
![]() | |
SpatialHashTable () | |
Protected constructor. | |
Protected Attributes | |
float | m_loadFactorMax = 10.0f |
unsigned long | m_currentID = 0 |
std::shared_ptr< std::unordered_set< PointEntry > > | m_table |
![]() | |
double | m_cellSize [3] |
Implementation of SpatialHashTable using separate chaining.
Definition at line 73 of file imstkSpatialHashTableSeparateChaining.h.
std::vector< size_t > imstk::SpatialHashTableSeparateChaining::getPointsInAABB | ( | const Vec3d & | corner1, |
const Vec3d & | corner2 | ||
) |
Finds IDs of all points in an AABB.
corner1 | One corner to the box |
corner2 | The other corner to the box |
Definition at line 47 of file imstkSpatialHashTableSeparateChaining.cpp.
void imstk::SpatialHashTableSeparateChaining::getPointsInAABB | ( | std::vector< size_t > & | result, |
const Vec3d & | corner1, | ||
const Vec3d & | corner2 | ||
) |
Finds IDs of all points in an AABB.
result | The list to contain search result |
corner1 | One corner to the box |
corner2 | The other corner to the box |
Definition at line 55 of file imstkSpatialHashTableSeparateChaining.cpp.
std::vector< size_t > imstk::SpatialHashTableSeparateChaining::getPointsInSphere | ( | const Vec3d & | ppos, |
double | radius | ||
) |
Find IDs of all points in a sphere centered at ppos and having given radius.
pos | Postision of the given point |
radius | The search radius |
Definition at line 108 of file imstkSpatialHashTableSeparateChaining.cpp.
void imstk::SpatialHashTableSeparateChaining::getPointsInSphere | ( | std::vector< size_t > & | result, |
const Vec3d & | ppos, | ||
const double | radius | ||
) |
Find IDs of all points in a sphere centered at ppos and having given radius.
result | The list to contain search result |
pos | Postision of the given point |
radius | The search radius |
Definition at line 116 of file imstkSpatialHashTableSeparateChaining.cpp.
void imstk::SpatialHashTableSeparateChaining::insertPoint | ( | const Vec3d & | point | ) |
Insert an array of points.
point | A point |
Definition at line 28 of file imstkSpatialHashTableSeparateChaining.cpp.
void imstk::SpatialHashTableSeparateChaining::insertPoints | ( | const VecDataArray< double, 3 > & | points | ) |
Insert an array of points.
points | An array of point |
Definition at line 19 of file imstkSpatialHashTableSeparateChaining.cpp.
|
overridevirtual |
Protected constructor.
x,y,z | Dimensions for each cell |
Implements imstk::SpatialHashTable.
Definition at line 180 of file imstkSpatialHashTableSeparateChaining.cpp.
void imstk::SpatialHashTableSeparateChaining::setLoadFactorMax | ( | float | loadFactorMax | ) |
Sets the max load factor.
loadFactorMax | The new capacity after a rehash |
Definition at line 172 of file imstkSpatialHashTableSeparateChaining.cpp.