Class Noise

java.lang.Object
org.spongepowered.noise.Noise

public final class Noise extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    gradientCoherentNoise3D(double x, double y, double z, int seed, NoiseQuality quality)
    Generates a gradient-coherent-noise value from the coordinates of a three-dimensional input value.
    static double
    gradientNoise3D(double fx, double fy, double fz, int ix, int iy, int iz, int seed)
    Generates a gradient-noise value from the coordinates of a three-dimensional input value and the integer coordinates of a nearby three-dimensional value.
    static int
    intValueNoise3D(int x, int y, int z, int seed)
    Generates an integer-noise value from the coordinates of a three-dimensional input value.
    static double
    simplexStyleGradientCoherentNoise3D(double x, double y, double z, int seed, LatticeOrientation orientation, NoiseQualitySimplex quality)
    Generates a simplex-style gradient coherent noise value from the coordinates of a three-dimensional input value.
    static double
    valueCoherentNoise3D(double x, double y, double z, int seed, NoiseQuality quality)
    Generates a value-coherent-noise value from the coordinates of a three-dimensional input value.
    static double
    valueNoise3D(int x, int y, int z, int seed)
    Generates a value-noise value from the coordinates of a three-dimensional input value.

    Methods inherited from class java.lang.Object

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

    • simplexStyleGradientCoherentNoise3D

      public static double simplexStyleGradientCoherentNoise3D(double x, double y, double z, int seed, LatticeOrientation orientation, NoiseQualitySimplex quality)
      Generates a simplex-style gradient coherent noise value from the coordinates of a three-dimensional input value.

      Does not use the classic Simplex noise algorithm, but an alternative. Adapted from the following URLs: https://github.com/KdotJPG/New-Simplex-Style-Gradient-Noise/blob/master/java/FastSimplexStyleNoise.java https://github.com/KdotJPG/New-Simplex-Style-Gradient-Noise/blob/master/java/SuperSimplexNoise.java

      The return value ranges from 0 to 1.

      Parameters:
      x - The x coordinate of the input value.
      y - The y coordinate of the input value.
      z - The z coordinate of the input value.
      seed - The random number seed.
      orientation - The lattice orientation of the simplex-style coherent noise. See documentation for LatticeOrientation.
      quality - The quality of the simplex-style coherent noise.
      Returns:
      The generated gradient-coherent-noise value.
    • gradientCoherentNoise3D

      public static double gradientCoherentNoise3D(double x, double y, double z, int seed, NoiseQuality quality)
      Generates a gradient-coherent-noise value from the coordinates of a three-dimensional input value.

      The return value ranges from 0 to 1.

      For an explanation of the difference between gradient noise and value noise, see the comments for the gradientNoise3D(double, double, double, int, int, int, int) function.

      Parameters:
      x - The x coordinate of the input value.
      y - The y coordinate of the input value.
      z - The z coordinate of the input value.
      seed - The random number seed.
      quality - The quality of the coherent-noise.
      Returns:
      The generated gradient-coherent-noise value.
    • gradientNoise3D

      public static double gradientNoise3D(double fx, double fy, double fz, int ix, int iy, int iz, int seed)
      Generates a gradient-noise value from the coordinates of a three-dimensional input value and the integer coordinates of a nearby three-dimensional value.

      The difference between fx and ix must be less than or equal to one. The difference between fy and iy must be less than or equal to one. The difference between fz and iz must be less than or equal to one.

      A gradient-noise function generates better-quality noise than a value-noise function. Most noise modules use gradient noise for this reason, although it takes much longer to calculate.

      The return value ranges from 0 to 1.

      This function generates a gradient-noise value by performing the following steps:

      1. It first calculates a random normalized vector based on the nearby integer value passed to this function.
      2. It then calculates a new value by adding this vector to the nearby integer value passed to this function.
      3. It then calculates the dot product of the above-generated value and the floating-point input value passed to this function.

      A noise function differs from a random-number generator because it always returns the same output value if the same input value is passed to it.

      Parameters:
      fx - The floating-point x coordinate of the input value.
      fy - The floating-point y coordinate of the input value.
      fz - The floating-point z coordinate of the input value.
      ix - The integer x coordinate of a nearby value.
      iy - The integer y coordinate of a nearby value.
      iz - The integer z coordinate of a nearby value.
      seed - The random number seed.
      Returns:
      The generated gradient-noise value.
    • intValueNoise3D

      public static int intValueNoise3D(int x, int y, int z, int seed)
      Generates an integer-noise value from the coordinates of a three-dimensional input value.

      The return value ranges from 0 to 2147483647.

      A noise function differs from a random-number generator because it always returns the same output value if the same input value is passed to it.

      Parameters:
      x - The integer x coordinate of the input value.
      y - The integer y coordinate of the input value.
      z - The integer z coordinate of the input value.
      seed - A random number seed.
      Returns:
      The generated integer-noise value.
    • valueCoherentNoise3D

      public static double valueCoherentNoise3D(double x, double y, double z, int seed, NoiseQuality quality)
      Generates a value-coherent-noise value from the coordinates of a three-dimensional input value.
      Parameters:
      x - The x coordinate of the input value.
      y - The y coordinate of the input value.
      z - The z coordinate of the input value.
      seed - The random number seed.
      quality - The quality of the coherent-noise.
      Returns:
      The generated value-coherent-noise value.

      The return value ranges from 0 to 1.

      For an explanation of the difference between gradient noise and value noise, see the comments for gradientNoise3D(double, double, double, int, int, int, int).

    • valueNoise3D

      public static double valueNoise3D(int x, int y, int z, int seed)
      Generates a value-noise value from the coordinates of a three-dimensional input value.

      The return value ranges from 0 to 1.

      A noise function differs from a random-number generator because it always returns the same output value if the same input value is passed to it.

      Parameters:
      x - The x coordinate of the input value.
      y - The y coordinate of the input value.
      z - The z coordinate of the input value.
      seed - A random number seed.
      Returns:
      The generated value-noise value.