- All Implemented Interfaces:
- IPointHash
public class PermPointHash
extends IPointHash.IntImpl
A mid-to-low quality point hash that uses a similar (not identical) technique to what OpenSimplex2 uses, with
a permutation array created at construction. To get an x,y,z point, this looks up x in the permutation array (using
only the bottom 11 bits of x), which gets an 11-bit number, then XORs that with y, masks to 11 bits, and looks that
up again in the same permutation array, finishing by XORing with z and masking to 11 bits. To match the behavior of
other IPointHash implementations, this finishes by attempting to include variable state using:
(((...) - state ^ 0xD1B54A35) * 0x125493 + state ^ 0xD1B54A35) * 0x125493;
, which also pushes the usable bits
up throughout the returned int, instead of just in the lowest 11 bits.
This is fast in OpenSimplex2, but the quality is so lackluster here, even with extra operations, that this isn't
recommended at all.