java.lang.Object
imagingbook.common.noise.hashing.Hash32
- All Implemented Interfaces:
HashFunction
- Direct Known Subclasses:
Hash32Shift
,Hash32ShiftMult
,Hash32Ward
Hash functions for gradient (Perlin) noise.
- Version:
- 2022/11/24
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
hash
(int u) 1D hash function: maps a singleint
key to adouble
hash 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 ofint
keys to a pair ofdouble
hash values in [0,1].double[]
hash
(int u, int v, int w) 3D hash function: maps a triplet ofint
keys to a triplet ofdouble
hash values in [0,1].
-
Constructor Details
-
Hash32
-
-
Method Details
-
hash
Description copied from interface:HashFunction
1D hash function: maps a singleint
key to adouble
hash value in [0,1].- Specified by:
hash
in interfaceHashFunction
- Parameters:
u
- the key- Returns:
- the hash value
-
hash
Description copied from interface:HashFunction
2D hash function: maps a pair ofint
keys to a pair ofdouble
hash values in [0,1].- Specified by:
hash
in interfaceHashFunction
- Parameters:
u
- the 1st keyv
- the 2nd key- Returns:
- the hash values
-
hash
Description copied from interface:HashFunction
3D hash function: maps a triplet ofint
keys to a triplet ofdouble
hash values in [0,1].- Specified by:
hash
in 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 hashInt() function is applied repeatedly for every gradient dimension by using the dimension number (k) as a local seed - in addition to the global seed (seed).- Specified by:
hash
in interfaceHashFunction
- Parameters:
p
- a N-vector of keys- Returns:
- a N-vector of hash values
-