Skip to content

Commit

Permalink
Add comment on changed prime numbers
Browse files Browse the repository at this point in the history
Signed-off-by: Benedikt Mersch <benedikt.mersch@gmail.com>
  • Loading branch information
benemer committed Jun 26, 2023
1 parent b0272b3 commit f18dc75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions nanovdb/nanovdb/NanoVDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,8 @@ class Coord

/// @brief Return a hash key derived from the existing coordinates.
/// @details For details on this hash function please see the VDB paper.
/// The prime numbers are modified based on the ACM Transactions on Graphics paper:
/// "Real-time 3D reconstruction at scale using voxel hashing"
template<int Log2N = 3 + 4 + 5>
__hostdev__ uint32_t hash() const { return ((1 << Log2N) - 1) & (mVec[0] * 73856093 ^ mVec[1] * 19349669 ^ mVec[2] * 83492791); }

Expand Down
4 changes: 3 additions & 1 deletion openvdb/openvdb/math/Coord.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ class Coord

/// @brief Return a hash value for this coordinate
/// @note Log2N is the binary logarithm of the hash table size.
/// @details The hash function is taken from the SIGGRAPH paper:
/// @details The hash function is originally taken from the SIGGRAPH paper:
/// "VDB: High-resolution sparse volumes with dynamic topology"
/// and the prime numbers are modified based on the ACM Transactions on Graphics paper:
/// "Real-time 3D reconstruction at scale using voxel hashing"
template<int Log2N = 20>
size_t hash() const
{
Expand Down

0 comments on commit f18dc75

Please sign in to comment.