38 #ifndef FCL_BROADPHASE_SPATIALHASH_INL_H
39 #define FCL_BROADPHASE_SPATIALHASH_INL_H
48 struct SpatialHash<double>;
53 : cell_size(cell_size_), scene_limit(scene_limit_)
64 int min_x = std::floor((
aabb.min_[0] - scene_limit.min_[0]) / cell_size);
65 int max_x = std::ceil((
aabb.max_[0] - scene_limit.min_[0]) / cell_size);
66 int min_y = std::floor((
aabb.min_[1] - scene_limit.min_[1]) / cell_size);
67 int max_y = std::ceil((
aabb.max_[1] - scene_limit.min_[1]) / cell_size);
68 int min_z = std::floor((
aabb.min_[2] - scene_limit.min_[2]) / cell_size);
69 int max_z = std::ceil((
aabb.max_[2] - scene_limit.min_[2]) / cell_size);
71 std::vector<unsigned int> keys((max_x - min_x) * (max_y - min_y) * (max_z - min_z));
73 for(
int x = min_x; x < max_x; ++x)
75 for(
int y = min_y; y < max_y; ++y)
77 for(
int z = min_z; z < max_z; ++z)
79 keys[
id++] = x + y * width[0] + z * width[0] * width[1];