Class HashUtil

java.lang.Object
de.articdive.jnoise.core.util.HashUtil

public final class HashUtil extends Object
Utility class for calculating hashes using a simple collection of primes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant used for calculating hashes along the W axis.
    static final int
    Constant used for calculating hashes along the X axis.
    static final int
    Constant used for calculating hashes along the Y axis.
    static final int
    Constant used for calculating hashes along the Z axis.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    hash1D(long seed, long x)
    Hashes a 1D point using a seed.
    static int
    hash2D(long seed, long x, long y)
    Hashes a 2D point using a seed.
    static int
    hash3D(long seed, long x, long y, long z)
    Hashes a 3D point using a seed.
    static int
    hash4D(long seed, long x, long y, long z, long w)
    Hashes a 4D point using a seed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • X_PRIME

      public static final int X_PRIME
      Constant used for calculating hashes along the X axis.
      See Also:
    • Y_PRIME

      public static final int Y_PRIME
      Constant used for calculating hashes along the Y axis.
      See Also:
    • Z_PRIME

      public static final int Z_PRIME
      Constant used for calculating hashes along the Z axis.
      See Also:
    • W_PRIME

      public static final int W_PRIME
      Constant used for calculating hashes along the W axis.
      See Also:
  • Method Details

    • hash1D

      public static int hash1D(long seed, long x)
      Hashes a 1D point using a seed.
      Parameters:
      seed - seed to hash with.
      x - X-Coordinate of the 1D point.
      Returns:
      hash value of the 1D point.
    • hash2D

      public static int hash2D(long seed, long x, long y)
      Hashes a 2D point using a seed.
      Parameters:
      seed - seed to hash with.
      x - X-Coordinate of the 2D point.
      y - Y-Coordinate of the 2D point.
      Returns:
      hash value of the 2D point.
    • hash3D

      public static int hash3D(long seed, long x, long y, long z)
      Hashes a 3D point using a seed.
      Parameters:
      seed - seed to hash with.
      x - X-Coordinate of the 3D point.
      y - Y-Coordinate of the 3D point.
      z - Z-Coordinate of the 3D Point.
      Returns:
      hash value of the 3D point.
    • hash4D

      public static int hash4D(long seed, long x, long y, long z, long w)
      Hashes a 4D point using a seed.
      Parameters:
      seed - seed to hash with.
      x - X-Coordinate of the 4D point.
      y - Y-Coordinate of the 4D point.
      z - Z-Coordinate of the 4D Point.
      w - W-Coordinate of the 4D Point.
      Returns:
      hash value of the 4D point.