9 #include "imstkSpatialHashTable.h" 10 #include "imstkMath.h" 11 #include "imstkVecDataArray.h" 13 #include <unordered_set> 35 unsigned int x = (
unsigned int)(point.point.x() / point.cellSize[0]);
36 unsigned int y = (
unsigned int)(point.point.y() / point.cellSize[1]);
37 unsigned int z = (
unsigned int)(point.point.z() / point.cellSize[2]);
39 return (104729 * x + 104743 * y + 104759 * z);
51 if (point1.ID != point2.ID)
56 if (point1.point != point2.point)
91 void insertPoint(
const Vec3d& point);
97 void setLoadFactorMax(
float loadFactorMax);
104 std::vector<size_t> getPointsInAABB(
const Vec3d& corner1,
const Vec3d& corner2);
112 void getPointsInAABB(std::vector<size_t>& result,
const Vec3d& corner1,
const Vec3d& corner2);
119 std::vector<size_t> getPointsInSphere(
const Vec3d& ppos,
double radius);
127 void getPointsInSphere(std::vector<size_t>& result,
const Vec3d& ppos,
const double radius);
138 virtual void setCellSize(
double x,
double y,
double z)
override;
143 void recomputePointHash();
149 virtual void rehash()
override;
151 float m_loadFactorMax = 10.0f;
152 unsigned long m_currentID = 0;
153 std::shared_ptr<std::unordered_set<PointEntry>> m_table;
Implementation of SpatialHashTable using separate chaining.
Returns a hash value for a PointEntry.
Abstract class for spatial hash tables.
Test if two points are the same or not by comparing their id and coordinates.