Template Struct index3d_hash
Defined in File index3d_t.h
Struct Documentation
-
template<typename cell_coord_t = int32_t>
struct index3d_hash Hash functor and comparator for
index3d_t, usable with bothstd::unordered_map/tsl::robin_map(hash) andstd::map(comparator).The hash function is the optimized spatial hash from: Teschner et al., “Optimized spatial hashing for collision detection of
deformable objects”, VMV 2003. It mixes the three integer coordinates with large prime multipliers and truncates to 20 bits, giving good distribution for typical voxel grids.
The
operator()(k1,k2)overload provides a strict weak ordering onindex3d_t(X-primary, Y-secondary, Z-tertiary) forstd::map.Public Functions
-
inline std::size_t operator()(const index3d_t<cell_coord_t> &k) const noexcept
Hash operator for unordered maps:
-
inline bool operator()(const index3d_t<cell_coord_t> &k1, const index3d_t<cell_coord_t> &k2) const noexcept
k1 < k2? for std::map containers
-
inline std::size_t operator()(const index3d_t<cell_coord_t> &k) const noexcept