java.lang.Object
imagingbook.common.noise.hashing.HashPermute
- All Implemented Interfaces:
HashFunction
Permutation-based hash function, similar to the one proposed in [1]. See [2] for details.
[1] K. Perlin. An image synthesizer. SIGGRAPH Computer Graphics 19(3), 287–296 (1985).
[2] W. Burger, M.J.
Burge, Principles of Digital Image Processing – Advanced Methods (Vol. 3), Supplementary Chapter 8:
"Synthetic Gradient Noise", Springer (2013). https://dx.doi.org/10.13140/RG.2.1.3427.7284
- Version:
- 2022/11/24
-
Constructor Summary
ConstructorsConstructorDescriptionHashPermute(int seed) Constructor creating a hash function with the specified seed value. -
Method Summary
Modifier and TypeMethodDescriptiondoublehash(int u) 1D hash function: maps a singleintkey to adoublehash value in [0,1].double[]hash(int[] p) N-dimensional permutation hash; this version does not use any bit splitting.double[]hash(int u, int v) 2D hash function: maps a pair ofintkeys to a pair ofdoublehash values in [0,1].double[]hash(int u, int v, int w) 3D hash function: maps a triplet ofintkeys to a triplet ofdoublehash values in [0,1].
-
Constructor Details
-
HashPermute
Constructor creating a hash function with the specified seed value.- Parameters:
seed- the random seed value (set to 0 use a random seed value).
-
-
Method Details
-
hash
Description copied from interface:HashFunction1D hash function: maps a singleintkey to adoublehash value in [0,1].- Specified by:
hashin interfaceHashFunction- Parameters:
u- the key- Returns:
- the hash value
-
hash
Description copied from interface:HashFunction2D hash function: maps a pair ofintkeys to a pair ofdoublehash values in [0,1].- Specified by:
hashin interfaceHashFunction- Parameters:
u- the 1st keyv- the 2nd key- Returns:
- the hash values
-
hash
Description copied from interface:HashFunction3D hash function: maps a triplet ofintkeys to a triplet ofdoublehash values in [0,1].- Specified by:
hashin interfaceHashFunction- Parameters:
u- the 1st keyv- the 2nd keyw- the 3rd key- Returns:
- the hash values
-
hash
N-dimensional permutation hash; this version does not use any bit splitting. Instead, the hash8() function is applied repeatedly for every gradient dimension by using the dimension number (k) as a local seed (sd) - in addition to the global seed (seed).- Specified by:
hashin interfaceHashFunction- Parameters:
p- a N-vector of keys- Returns:
- a N-vector of hash values
-