Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
hash.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/math_fwd.h"
4
5#include <Common/primitive_type.h>
6
7#include <cstddef>
8#include <concepts>
9
10namespace ph::math
11{
12
22template<typename Integer>
23std::size_t discrete_spatial_hash(
24 Integer x,
25 Integer y,
26 Integer z,
27 std::size_t hashTableSize);
28
32template<typename Integer>
33std::size_t discrete_spatial_hash(
34 Integer x,
35 Integer y,
36 std::size_t hashTableSize);
37
38template<std::integral T>
39std::size_t discrete_spatial_hash(const TVector3<T>& point, std::size_t hashTableSize);
40
45template<std::floating_point T>
46std::size_t discrete_spatial_hash(
47 const TVector3<T>& point,
48 const TVector3<T>& cellSize,
49 std::size_t hashTableSize);
50
54uint32 murmur3_bit_mix_32(uint32 v);
55
59uint64 murmur3_bit_mix_64(uint64 v);
60
64uint64 murmur3_v13_bit_mix_64(uint64 v);
65
69uint64 moremur_bit_mix_64(uint64 v);
70
72{
73 uint32 operator () (const uint32 v) const
74 {
75 return murmur3_bit_mix_32(v);
76 }
77};
78
84template<typename T, typename BitMixerType = Murmur3BitMixer32>
85uint32 murmur3_32(const T& data, uint32 seed);
86
95template<typename T, typename BitMixerType>
96uint32 murmur3_32(
97 const T* data,
98 std::size_t dataSize,
99 BitMixerType&& bitMixer,
100 uint32 seed);
101
108uint32 permuted_index(uint32 i, uint32 l, uint32 p);
109
110}// end namespace ph::math
111
112#include "Math/hash.ipp"
Math functions and utilities.
Definition TransformInfo.h:10
uint64 murmur3_bit_mix_64(uint64 v)
MurmurHash3's bit mixer. 64-bit version.
Definition hash.ipp:82
uint32 permuted_index(uint32 i, uint32 l, uint32 p)
Get the permuted index or value in O(1) space and O(1) time.
Definition hash.ipp:206
uint64 moremur_bit_mix_64(uint64 v)
A MurmurHash3-style bit mixer that outperforms the original by quite some margin. 64-bit version.
Definition hash.ipp:104
uint32 murmur3_bit_mix_32(uint32 v)
MurmurHash3's bit mixer. 32-bit version.
Definition hash.ipp:71
uint64 murmur3_v13_bit_mix_64(uint64 v)
MurmurHash3's bit mixer. 64-bit version.
Definition hash.ipp:93
uint32 murmur3_32(const T &data, uint32 seed)
Generate 32-bit hash values using MurmurHash3. Note that there are no collisions when T has <= 32 bit...
Definition hash.ipp:119
std::size_t discrete_spatial_hash(Integer x, Integer y, Integer z, std::size_t hashTableSize)
Definition hash.ipp:19
Definition hash.h:72
uint32 operator()(const uint32 v) const
Definition hash.h:73