Class FastNoise

java.lang.Object
squidpony.squidmath.FastNoise
All Implemented Interfaces:
Serializable, Noise.Noise2D, Noise.Noise3D, Noise.Noise4D, Noise.Noise6D

public class FastNoise
extends Object
implements Serializable, Noise.Noise2D, Noise.Noise3D, Noise.Noise4D, Noise.Noise6D
A wide range of noise functions that can all be called from one configurable object. Originally from Jordan Peck's FastNoise library, hence the name (these functions are sometimes, but not always, very fast for noise that doesn't use the GPU). This implements Noise2D, Noise3D, Noise4D, and Noise6D, and this is the fastest continuous noise algorithm in the library. Though it doesn't implement an interface for them, you can also use this to get ridged-multi simplex noise (the same type as Noise.Ridged2D) with ridged2D(float, float, int, int), ridged3D(float, float, float, int, int), or any of the overloads that allow specifying alternate lacunarity and gain.
See Also:
Serialized Form
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int BILLOW  
    static int CELL_VALUE  
    static int CELLULAR  
    static int CUBIC  
    static int CUBIC_FRACTAL  
    static int DISTANCE  
    static int DISTANCE_2  
    static int DISTANCE_2_ADD  
    static int DISTANCE_2_DIV  
    static int DISTANCE_2_MUL  
    static int DISTANCE_2_SUB  
    static int EUCLIDEAN  
    static float F2f  
    static float F3f  
    static int FBM  
    static int FOAM  
    static int FOAM_FRACTAL  
    static float G2f  
    static float G3f  
    protected static float[] grad4f  
    protected static float[] grad6f  
    static float H2f  
    static int HERMITE  
    static FastNoise instance
    A publicly available FastNoise object with seed 1337, frequency 1.0f/32.0f, 1 octave of Simplex noise using SIMPLEX_FRACTAL noiseType, 2f lacunarity and 0.5f gain.
    static int LINEAR  
    static int MANHATTAN  
    static int NATURAL  
    static int NOISE_LOOKUP  
    static int PERLIN  
    static int PERLIN_FRACTAL  
    protected static float[][] phiGrad2f  
    static int QUINTIC  
    static int RIDGED_MULTI  
    static int SIMPLEX  
    static int SIMPLEX_FRACTAL  
    static int VALUE  
    static int VALUE_FRACTAL  
    static int WHITE_NOISE  
  • Constructor Summary

    Constructors 
    Constructor Description
    FastNoise()
    A constructor that takes no parameters, and uses all default settings with a seed of 1337.
    FastNoise​(int seed)
    A constructor that takes only a parameter for the FastNoise's seed, which should produce different results for any different seeds.
    FastNoise​(int seed, float frequency)
    A constructor that takes two parameters to specify the FastNoise from the start.
    FastNoise​(int seed, float frequency, int noiseType)
    A constructor that takes a few parameters to specify the FastNoise from the start.
    FastNoise​(int seed, float frequency, int noiseType, int octaves)
    A constructor that takes several parameters to specify the FastNoise from the start.
    FastNoise​(int seed, float frequency, int noiseType, int octaves, float lacunarity, float gain)
    A constructor that takes a lot of parameters to specify the FastNoise from the start.
  • Method Summary

    Modifier and Type Method Description
    protected static float dotf​(float[] g, float x, float y)  
    float getCellular​(float x, float y)  
    float getCellular​(float x, float y, float z)  
    float getConfiguredNoise​(float x, float y)
    After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 2D.
    float getConfiguredNoise​(float x, float y, float z)
    After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 3D.
    float getConfiguredNoise​(float x, float y, float z, float w)
    After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 3D.
    float getConfiguredNoise​(float x, float y, float z, float w, float u, float v)
    After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 3D.
    float getCubic​(float x, float y)  
    float getCubic​(float x, float y, float z)  
    float getCubicFractal​(float x, float y)  
    float getCubicFractal​(float x, float y, float z)  
    float getFoam​(float x, float y)  
    float getFoam​(float x, float y, float z)  
    float getFoam​(float x, float y, float z, float w)  
    float getFoam​(float x, float y, float z, float w, float u, float v)  
    float getFoamFractal​(float x, float y)  
    float getFoamFractal​(float x, float y, float z)  
    float getFoamFractal​(float x, float y, float z, float w, float u, float v)  
    int getFractalOctaves()
    Gets the octave count for all fractal noise types.
    int getFractalType()
    Gets the method for combining octaves in all fractal noise types, allowing an int argument corresponding to one of the following constants from this class: FBM (0), BILLOW (1), or RIDGED_MULTI (2).
    float getFrequency()
    Gets the frequency for all noise types.
    double getNoise​(double x, double y)  
    double getNoise​(double x, double y, double z)  
    double getNoise​(double x, double y, double z, double w)  
    double getNoise​(double x, double y, double z, double w, double u, double v)  
    int getNoiseType()
    Gets the default type of noise returned by getConfiguredNoise(float, float), using one of the following constants in this class: VALUE (0), VALUE_FRACTAL (1), PERLIN (2), PERLIN_FRACTAL (3), SIMPLEX (4), SIMPLEX_FRACTAL (5), CELLULAR (6), WHITE_NOISE (7), CUBIC (8), or CUBIC_FRACTAL (9).
    double getNoiseWithSeed​(double x, double y, double z, double w, double u, double v, long seed)  
    double getNoiseWithSeed​(double x, double y, double z, double w, long seed)  
    double getNoiseWithSeed​(double x, double y, double z, long seed)  
    double getNoiseWithSeed​(double x, double y, long seed)  
    float getNoiseWithSeed​(float x, float y, float z, float w, float u, float v, int seed)  
    float getNoiseWithSeed​(float x, float y, float z, float w, int seed)  
    float getNoiseWithSeed​(float x, float y, float z, int seed)  
    float getNoiseWithSeed​(float x, float y, int seed)  
    float getPerlin​(float x, float y)  
    float getPerlin​(float x, float y, float z)  
    float getPerlin​(float x, float y, float z, float w)  
    float getPerlin​(float x, float y, float z, float w, float u, float v)  
    float getPerlinFractal​(float x, float y)  
    float getPerlinFractal​(float x, float y, float z)  
    int getSeed()  
    float getSimplex​(float x, float y)  
    float getSimplex​(float x, float y, float z)  
    float getSimplex​(float x, float y, float z, float w)  
    float getSimplex​(float x, float y, float z, float w, float u, float v)  
    float getSimplexFractal​(float x, float y)  
    float getSimplexFractal​(float x, float y, float z)  
    float getSimplexFractal​(float x, float y, float z, float w)  
    float getSimplexFractal​(float x, float y, float z, float w, float u, float v)  
    float getValue​(float x, float y)  
    float getValue​(float x, float y, float z)  
    float getValue​(float x, float y, float z, float w)  
    float getValue​(float x, float y, float z, float w, float u, float v)  
    float getValueFractal​(float x, float y)  
    float getValueFractal​(float x, float y, float z)  
    float getValueFractal​(float x, float y, float z, float w)  
    float getValueFractal​(float x, float y, float z, float w, float u, float v)  
    float getWhiteNoise​(float x, float y)  
    float getWhiteNoise​(float x, float y, float z)  
    float getWhiteNoise​(float x, float y, float z, float w)  
    float getWhiteNoise​(float x, float y, float z, float w, float u, float v)  
    float getWhiteNoiseInt​(int x, int y)  
    float getWhiteNoiseInt​(int x, int y, int z)  
    float getWhiteNoiseInt​(int x, int y, int z, int w)  
    float getWhiteNoiseInt​(int x, int y, int z, int w, int u, int v)  
    protected float gradCoord2D​(int seed, int x, int y, float xd, float yd)  
    protected float gradCoord3D​(int seed, int x, int y, int z, float xd, float yd, float zd)  
    protected float gradCoord4D​(int seed, int x, int y, int z, int w, float xd, float yd, float zd, float wd)  
    protected float gradCoord6D​(int seed, int x, int y, int z, int w, int u, int v, float xd, float yd, float zd, float wd, float ud, float vd)  
    void gradientPerturb2​(float[] v2)  
    void gradientPerturb3​(float[] v3)  
    void gradientPerturbFractal2​(float[] v2)  
    void gradientPerturbFractal3​(float[] v3)  
    float layered2D​(float x, float y, int seed, int octaves)
    Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 2D.
    float layered2D​(float x, float y, int seed, int octaves, float frequency)
    Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 2D.
    float layered2D​(float x, float y, int seed, int octaves, float frequency, float lacunarity)
    Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (0.5) in D.
    float layered2D​(float x, float y, int seed, int octaves, float frequency, float lacunarity, float gain)
    Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (loosely, how much to emphasize lower-frequency octaves) in 2D.
    float layered3D​(float x, float y, float z, int seed, int octaves)
    Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 3D.
    float layered3D​(float x, float y, float z, int seed, int octaves, float frequency)
    Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 3D.
    float layered3D​(float x, float y, float z, int seed, int octaves, float frequency, float lacunarity)
    Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (0.5) in 3D.
    float layered3D​(float x, float y, float z, int seed, int octaves, float frequency, float lacunarity, float gain)
    Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (loosely, how much to emphasize lower-frequency octaves) in 3D.
    float ridged2D​(float x, float y, int seed, int octaves)
    Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5).
    float ridged2D​(float x, float y, int seed, int octaves, float frequency)
    Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5).
    float ridged2D​(float x, float y, int seed, int octaves, float frequency, float lacunarity)
    Generates ridged-multi simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves); gain is not used.
    float ridged3D​(float x, float y, float z, int seed, int octaves)
    Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5).
    float ridged3D​(float x, float y, float z, int seed, int octaves, float frequency)
    Generates ridged-multi simplex noise with the given amount of octaves, specified frequency, and the default lacunarity (2) and gain (0.5).
    float ridged3D​(float x, float y, float z, int seed, int octaves, float frequency, float lacunarity)
    Generates ridged-multi simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves); gain is not used.
    void setCellularDistanceFunction​(int cellularDistanceFunction)
    Sets the distance function used in cellular noise calculations, allowing an int argument corresponding to one of the following constants from this class: EUCLIDEAN (0), MANHATTAN (1), or NATURAL (2).
    void setCellularNoiseLookup​(FastNoise noise)
    Sets the FastNoise used to calculate a cell value if cellular return type is NOISE_LOOKUP.
    void setCellularReturnType​(int cellularReturnType)
    Sets the return type from cellular noise calculations, allowing an int argument corresponding to one of the following constants from this class: CELL_VALUE (0), NOISE_LOOKUP (1), DISTANCE (2), DISTANCE_2 (3), DISTANCE_2_ADD (4), DISTANCE_2_SUB (5), DISTANCE_2_MUL (6), or DISTANCE_2_DIV (7).
    void setFractalGain​(float gain)
    Sets the octave gain for all fractal noise types.
    void setFractalLacunarity​(float lacunarity)
    Sets the octave lacunarity for all fractal noise types.
    void setFractalOctaves​(int octaves)
    Sets the octave count for all fractal noise types.
    void setFractalType​(int fractalType)
    Sets the method for combining octaves in all fractal noise types, allowing an int argument corresponding to one of the following constants from this class: FBM (0), BILLOW (1), or RIDGED_MULTI (2).
    void setFrequency​(float frequency)
    Sets the frequency for all noise types.
    void setGradientPerturbAmp​(float gradientPerturbAmp)
    Sets the maximum perturb distance from original location when using gradientPerturb2(float[]), gradientPerturb3(float[]), gradientPerturbFractal2(float[]), or gradientPerturbFractal3(float[]); the default is 1.0.
    void setInterpolation​(int interpolation)
    Changes the interpolation method used to smooth between noise values, using on of the following constants from this class (lowest to highest quality): LINEAR (0), HERMITE (1), or QUINTIC (2).
    void setNoiseType​(int noiseType)
    Sets the default type of noise returned by getConfiguredNoise(float, float), using one of the following constants in this class: VALUE (0), VALUE_FRACTAL (1), PERLIN (2), PERLIN_FRACTAL (3), SIMPLEX (4), SIMPLEX_FRACTAL (5), CELLULAR (6), WHITE_NOISE (7), CUBIC (8), or CUBIC_FRACTAL (9).
    void setPointHash​(IPointHash hash)  
    void setSeed​(int seed)
    Sets the seed used for all noise types, as a long.
    float singleFoam​(int seed, float x, float y)  
    float singleFoam​(int seed, float x, float y, float z)  
    float singleFoam​(int seed, float x, float y, float z, float w)  
    float singleFoam​(int seed, float x, float y, float z, float w, float u, float v)  
    float singleSimplex​(int seed, float x, float y)  
    float singleSimplex​(int seed, float x, float y, float z)  
    float singleSimplex​(int seed, float x, float y, float z, float w)  
    float singleSimplex​(int seed, float x, float y, float z, float w, float u, float v)  
    float singleValue​(int seed, float x, float y)  

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • FastNoise

      public FastNoise()
      A constructor that takes no parameters, and uses all default settings with a seed of 1337. An example call to this would be new FastNoise(), which makes noise with the seed 1337, a default frequency of 1.0f/32.0f, 1 octave of Simplex noise (since this doesn't specify octave count, it always uses 1 even for the SIMPLEX_FRACTAL noiseType this uses, but you can call setFractalOctaves(int) later to benefit from the fractal noiseType), and normal lacunarity and gain (when unspecified, they are 2f and 0.5f).
    • FastNoise

      public FastNoise​(int seed)
      A constructor that takes only a parameter for the FastNoise's seed, which should produce different results for any different seeds. An example call to this would be new FastNoise(1337), which makes noise with the seed 1337, a default frequency of 1.0f/32.0f, 1 octave of Simplex noise (since this doesn't specify octave count, it always uses 1 even for the SIMPLEX_FRACTAL noiseType this uses, but you can call setFractalOctaves(int) later to benefit from the fractal noiseType), and normal lacunarity and gain (when unspecified, they are 2f and 0.5f).
      Parameters:
      seed - the int seed for the noise, which should significantly affect the produced noise
    • FastNoise

      public FastNoise​(int seed, float frequency)
      A constructor that takes two parameters to specify the FastNoise from the start. An example call to this would be new FastNoise(1337, 0.02f), which makes noise with the seed 1337, a lower frequency, 1 octave of Simplex noise (since this doesn't specify octave count, it always uses 1 even for the SIMPLEX_FRACTAL noiseType this uses, but you can call setFractalOctaves(int) later to benefit from the fractal noiseType), and normal lacunarity and gain (when unspecified, they are 2f and 0.5f).
      Parameters:
      seed - the int seed for the noise, which should significantly affect the produced noise
      frequency - the multiplier for all dimensions, which is usually fairly small (1.0f/32.0f is the default)
    • FastNoise

      public FastNoise​(int seed, float frequency, int noiseType)
      A constructor that takes a few parameters to specify the FastNoise from the start. An example call to this would be new FastNoise(1337, 0.02f, FastNoise.SIMPLEX), which makes noise with the seed 1337, a lower frequency, 1 octave of Simplex noise (since this doesn't specify octave count, it always uses 1 even for noiseTypes like SIMPLEX_FRACTAL, but using a fractal noiseType can make sense if you call setFractalOctaves(int) later), and normal lacunarity and gain (when unspecified, they are 2f and 0.5f).
      Parameters:
      seed - the int seed for the noise, which should significantly affect the produced noise
      frequency - the multiplier for all dimensions, which is usually fairly small (1.0f/32.0f is the default)
      noiseType - the noiseType, which should be a constant from this class (see setNoiseType(int))
    • FastNoise

      public FastNoise​(int seed, float frequency, int noiseType, int octaves)
      A constructor that takes several parameters to specify the FastNoise from the start. An example call to this would be new FastNoise(1337, 0.02f, FastNoise.SIMPLEX_FRACTAL, 4), which makes noise with the seed 1337, a lower frequency, 4 octaves of Simplex noise, and normal lacunarity and gain (when unspecified, they are 2f and 0.5f).
      Parameters:
      seed - the int seed for the noise, which should significantly affect the produced noise
      frequency - the multiplier for all dimensions, which is usually fairly small (1.0f/32.0f is the default)
      noiseType - the noiseType, which should be a constant from this class (see setNoiseType(int))
      octaves - how many octaves of noise to use when the noiseType is one of the _FRACTAL types
    • FastNoise

      public FastNoise​(int seed, float frequency, int noiseType, int octaves, float lacunarity, float gain)
      A constructor that takes a lot of parameters to specify the FastNoise from the start. An example call to this would be new FastNoise(1337, 0.02f, FastNoise.SIMPLEX_FRACTAL, 4, 0.5f, 2f), which makes noise with a lower frequency, 4 octaves of Simplex noise, and the "inverse" effect on how those octaves work (which makes the extra added octaves be more significant to the final result and also have a lower frequency, while normally added octaves have a higher frequency and tend to have a minor effect on the large-scale shape of the noise).
      Parameters:
      seed - the int seed for the noise, which should significantly affect the produced noise
      frequency - the multiplier for all dimensions, which is usually fairly small (1.0f/32.0f is the default)
      noiseType - the noiseType, which should be a constant from this class (see setNoiseType(int))
      octaves - how many octaves of noise to use when the noiseType is one of the _FRACTAL types
      lacunarity - typically 2.0, or 0.5 to change how extra octaves work (inverse mode)
      gain - typically 0.5, or 2.0 to change how extra octaves work (inverse mode)
  • Method Details

    • dotf

      protected static float dotf​(float[] g, float x, float y)
    • getSeed

      public int getSeed()
      Returns:
      Returns the seed used by this object
    • setSeed

      public void setSeed​(int seed)
      Sets the seed used for all noise types, as a long. If this is not called, defaults to 1337L.
      Parameters:
      seed - a seed as a long
    • setFrequency

      public void setFrequency​(float frequency)
      Sets the frequency for all noise types. If this is not called, it defaults to 0.03125f (or 1f/32f).
      Parameters:
      frequency - the frequency for all noise types, as a positive non-zero float
    • getFrequency

      public float getFrequency()
      Gets the frequency for all noise types. The default is 0.03125f, or 1f/32f.
      Returns:
      the frequency for all noise types, which should be a positive non-zero float
    • setInterpolation

      public void setInterpolation​(int interpolation)
      Changes the interpolation method used to smooth between noise values, using on of the following constants from this class (lowest to highest quality): LINEAR (0), HERMITE (1), or QUINTIC (2). If this is not called, it defaults to HERMITE. This is used in Value, Gradient Noise and Position Perturbing.
      Parameters:
      interpolation - an int (0, 1, or 2) corresponding to a constant from this class for an interpolation level
    • setNoiseType

      public void setNoiseType​(int noiseType)
      Sets the default type of noise returned by getConfiguredNoise(float, float), using one of the following constants in this class: VALUE (0), VALUE_FRACTAL (1), PERLIN (2), PERLIN_FRACTAL (3), SIMPLEX (4), SIMPLEX_FRACTAL (5), CELLULAR (6), WHITE_NOISE (7), CUBIC (8), or CUBIC_FRACTAL (9). If this isn't called, getConfiguredNoise() will default to SIMPLEX.
      Parameters:
      noiseType - an int from 0 to 9 corresponding to a constant from this class for a noise type
    • getNoiseType

      public int getNoiseType()
      Gets the default type of noise returned by getConfiguredNoise(float, float), using one of the following constants in this class: VALUE (0), VALUE_FRACTAL (1), PERLIN (2), PERLIN_FRACTAL (3), SIMPLEX (4), SIMPLEX_FRACTAL (5), CELLULAR (6), WHITE_NOISE (7), CUBIC (8), or CUBIC_FRACTAL (9). The default is SIMPLEX.
      Returns:
      the noise type as a code, from 0 to 9 inclusive
    • setFractalOctaves

      public void setFractalOctaves​(int octaves)
      Sets the octave count for all fractal noise types. If this isn't called, it will default to 3.
      Parameters:
      octaves - the number of octaves to use for fractal noise types, as a positive non-zero int
    • getFractalOctaves

      public int getFractalOctaves()
      Gets the octave count for all fractal noise types. The default is 3.
      Returns:
      the number of octaves to use for fractal noise types, as a positive non-zero int
    • setFractalLacunarity

      public void setFractalLacunarity​(float lacunarity)
      Sets the octave lacunarity for all fractal noise types. Lacunarity is a multiplicative change to frequency between octaves. If this isn't called, it defaults to 2.
      Parameters:
      lacunarity - a non-0 float that will be used for the lacunarity of fractal noise types; commonly 2.0 or 0.5
    • setFractalGain

      public void setFractalGain​(float gain)
      Sets the octave gain for all fractal noise types. If this isn't called, it defaults to 0.5.
      Parameters:
      gain - the gain between octaves, as a float
    • setFractalType

      public void setFractalType​(int fractalType)
      Sets the method for combining octaves in all fractal noise types, allowing an int argument corresponding to one of the following constants from this class: FBM (0), BILLOW (1), or RIDGED_MULTI (2). If this hasn't been called, it will use FBM.
      Parameters:
      fractalType - an int (0, 1, or 2) that corresponds to a constant like FBM or RIDGED_MULTI
    • getFractalType

      public int getFractalType()
      Gets the method for combining octaves in all fractal noise types, allowing an int argument corresponding to one of the following constants from this class: FBM (0), BILLOW (1), or RIDGED_MULTI (2). The default is FBM.
      Returns:
      the fractal type as a code; 0, 1, or 2
    • setCellularDistanceFunction

      public void setCellularDistanceFunction​(int cellularDistanceFunction)
      Sets the distance function used in cellular noise calculations, allowing an int argument corresponding to one of the following constants from this class: EUCLIDEAN (0), MANHATTAN (1), or NATURAL (2). If this hasn't been called, it will use EUCLIDEAN.
      Parameters:
      cellularDistanceFunction - an int that can be 0, 1, or 2, corresponding to a constant from this class
    • setCellularReturnType

      public void setCellularReturnType​(int cellularReturnType)
      Sets the return type from cellular noise calculations, allowing an int argument corresponding to one of the following constants from this class: CELL_VALUE (0), NOISE_LOOKUP (1), DISTANCE (2), DISTANCE_2 (3), DISTANCE_2_ADD (4), DISTANCE_2_SUB (5), DISTANCE_2_MUL (6), or DISTANCE_2_DIV (7). If this isn't called, it will use CELL_VALUE.
      Parameters:
      cellularReturnType -
    • setCellularNoiseLookup

      public void setCellularNoiseLookup​(FastNoise noise)
      Sets the FastNoise used to calculate a cell value if cellular return type is NOISE_LOOKUP. There is no default value; this must be called if using noise lookup to set the noise to a non-null value. The lookup value is acquired through getConfiguredNoise() so ensure you setNoiseType() on the noise lookup. Value, Foam, Perlin, or Simplex is recommended.
      Parameters:
      noise - another FastNoise object that should be configured already
    • setGradientPerturbAmp

      public void setGradientPerturbAmp​(float gradientPerturbAmp)
      Sets the maximum perturb distance from original location when using gradientPerturb2(float[]), gradientPerturb3(float[]), gradientPerturbFractal2(float[]), or gradientPerturbFractal3(float[]); the default is 1.0.
      Parameters:
      gradientPerturbAmp - the maximum perturb distance from the original location when using relevant methods
    • setPointHash

      public void setPointHash​(IPointHash hash)
    • getNoise

      public double getNoise​(double x, double y)
      Specified by:
      getNoise in interface Noise.Noise2D
    • getNoiseWithSeed

      public double getNoiseWithSeed​(double x, double y, long seed)
      Specified by:
      getNoiseWithSeed in interface Noise.Noise2D
    • getNoise

      public double getNoise​(double x, double y, double z)
      Specified by:
      getNoise in interface Noise.Noise3D
    • getNoiseWithSeed

      public double getNoiseWithSeed​(double x, double y, double z, long seed)
      Specified by:
      getNoiseWithSeed in interface Noise.Noise3D
    • getNoise

      public double getNoise​(double x, double y, double z, double w)
      Specified by:
      getNoise in interface Noise.Noise4D
    • getNoiseWithSeed

      public double getNoiseWithSeed​(double x, double y, double z, double w, long seed)
      Specified by:
      getNoiseWithSeed in interface Noise.Noise4D
    • getNoise

      public double getNoise​(double x, double y, double z, double w, double u, double v)
      Specified by:
      getNoise in interface Noise.Noise6D
    • getNoiseWithSeed

      public double getNoiseWithSeed​(double x, double y, double z, double w, double u, double v, long seed)
      Specified by:
      getNoiseWithSeed in interface Noise.Noise6D
    • getNoiseWithSeed

      public float getNoiseWithSeed​(float x, float y, int seed)
    • getNoiseWithSeed

      public float getNoiseWithSeed​(float x, float y, float z, int seed)
    • getNoiseWithSeed

      public float getNoiseWithSeed​(float x, float y, float z, float w, int seed)
    • getNoiseWithSeed

      public float getNoiseWithSeed​(float x, float y, float z, float w, float u, float v, int seed)
    • gradCoord2D

      protected float gradCoord2D​(int seed, int x, int y, float xd, float yd)
    • gradCoord3D

      protected float gradCoord3D​(int seed, int x, int y, int z, float xd, float yd, float zd)
    • gradCoord4D

      protected float gradCoord4D​(int seed, int x, int y, int z, int w, float xd, float yd, float zd, float wd)
    • gradCoord6D

      protected float gradCoord6D​(int seed, int x, int y, int z, int w, int u, int v, float xd, float yd, float zd, float wd, float ud, float vd)
    • getConfiguredNoise

      public float getConfiguredNoise​(float x, float y)
      After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 2D.
      Parameters:
      x -
      y -
      Returns:
      noise as a float from -1f to 1f
    • getConfiguredNoise

      public float getConfiguredNoise​(float x, float y, float z)
      After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 3D.
      Parameters:
      x -
      y -
      z -
      Returns:
      noise as a float from -1f to 1f
    • getConfiguredNoise

      public float getConfiguredNoise​(float x, float y, float z, float w)
      After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 3D.
      Parameters:
      x -
      y -
      z -
      w -
      Returns:
      noise as a float from -1f to 1f
    • getConfiguredNoise

      public float getConfiguredNoise​(float x, float y, float z, float w, float u, float v)
      After being configured with the setters in this class, such as setNoiseType(int), setFrequency(float), setFractalOctaves(int), and setFractalType(int), among others, you can call this method to get the particular variety of noise you specified, in 3D.
      Parameters:
      x -
      y -
      z -
      w -
      u -
      v -
      Returns:
      noise as a float from -1f to 1f
    • getWhiteNoise

      public float getWhiteNoise​(float x, float y, float z, float w, float u, float v)
    • getWhiteNoise

      public float getWhiteNoise​(float x, float y, float z, float w)
    • getWhiteNoise

      public float getWhiteNoise​(float x, float y, float z)
    • getWhiteNoise

      public float getWhiteNoise​(float x, float y)
    • getWhiteNoiseInt

      public float getWhiteNoiseInt​(int x, int y, int z, int w, int u, int v)
    • getWhiteNoiseInt

      public float getWhiteNoiseInt​(int x, int y, int z, int w)
    • getWhiteNoiseInt

      public float getWhiteNoiseInt​(int x, int y, int z)
    • getWhiteNoiseInt

      public float getWhiteNoiseInt​(int x, int y)
    • getValueFractal

      public float getValueFractal​(float x, float y)
    • getValue

      public float getValue​(float x, float y)
    • singleValue

      public float singleValue​(int seed, float x, float y)
    • getValueFractal

      public float getValueFractal​(float x, float y, float z)
    • getValue

      public float getValue​(float x, float y, float z)
    • getValueFractal

      public float getValueFractal​(float x, float y, float z, float w)
    • getValue

      public float getValue​(float x, float y, float z, float w)
    • getValueFractal

      public float getValueFractal​(float x, float y, float z, float w, float u, float v)
    • getValue

      public float getValue​(float x, float y, float z, float w, float u, float v)
    • getFoamFractal

      public float getFoamFractal​(float x, float y)
    • getFoam

      public float getFoam​(float x, float y)
    • singleFoam

      public float singleFoam​(int seed, float x, float y)
    • getFoamFractal

      public float getFoamFractal​(float x, float y, float z)
    • getFoam

      public float getFoam​(float x, float y, float z)
    • singleFoam

      public float singleFoam​(int seed, float x, float y, float z)
    • getFoam

      public float getFoam​(float x, float y, float z, float w)
    • singleFoam

      public float singleFoam​(int seed, float x, float y, float z, float w)
    • getFoamFractal

      public float getFoamFractal​(float x, float y, float z, float w, float u, float v)
    • getFoam

      public float getFoam​(float x, float y, float z, float w, float u, float v)
    • singleFoam

      public float singleFoam​(int seed, float x, float y, float z, float w, float u, float v)
    • getPerlinFractal

      public float getPerlinFractal​(float x, float y, float z)
    • getPerlin

      public float getPerlin​(float x, float y, float z)
    • getPerlin

      public float getPerlin​(float x, float y, float z, float w)
    • getPerlinFractal

      public float getPerlinFractal​(float x, float y)
    • getPerlin

      public float getPerlin​(float x, float y)
    • getPerlin

      public float getPerlin​(float x, float y, float z, float w, float u, float v)
    • getSimplexFractal

      public float getSimplexFractal​(float x, float y, float z)
    • layered3D

      public float layered3D​(float x, float y, float z, int seed, int octaves)
      Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 3D.
      Parameters:
      x -
      y -
      z -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • layered3D

      public float layered3D​(float x, float y, float z, int seed, int octaves, float frequency)
      Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 3D.
      Parameters:
      x -
      y -
      z -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • layered3D

      public float layered3D​(float x, float y, float z, int seed, int octaves, float frequency, float lacunarity)
      Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (0.5) in 3D.
      Parameters:
      x -
      y -
      z -
      seed -
      octaves -
      frequency -
      lacunarity -
      Returns:
      noise as a float between -1f and 1f
    • layered3D

      public float layered3D​(float x, float y, float z, int seed, int octaves, float frequency, float lacunarity, float gain)
      Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (loosely, how much to emphasize lower-frequency octaves) in 3D.
      Parameters:
      x -
      y -
      z -
      seed -
      octaves -
      frequency -
      lacunarity -
      gain -
      Returns:
      noise as a float between -1f and 1f
    • ridged3D

      public float ridged3D​(float x, float y, float z, int seed, int octaves)
      Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5).
      Parameters:
      x -
      y -
      z -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • ridged3D

      public float ridged3D​(float x, float y, float z, int seed, int octaves, float frequency)
      Generates ridged-multi simplex noise with the given amount of octaves, specified frequency, and the default lacunarity (2) and gain (0.5).
      Parameters:
      x -
      y -
      z -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • ridged3D

      public float ridged3D​(float x, float y, float z, int seed, int octaves, float frequency, float lacunarity)
      Generates ridged-multi simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves); gain is not used.
      Parameters:
      x -
      y -
      z -
      seed - any int
      octaves - how many "layers of detail" to generate; at least 1, but note this slows down with many octaves
      frequency - often about 1f / 32f, but generally adjusted for the use case
      lacunarity - when octaves is 2 or more, this affects the change between layers
      Returns:
      noise as a float between -1f and 1f
    • getSimplex

      public float getSimplex​(float x, float y, float z)
    • singleSimplex

      public float singleSimplex​(int seed, float x, float y, float z)
    • getSimplexFractal

      public float getSimplexFractal​(float x, float y)
    • layered2D

      public float layered2D​(float x, float y, int seed, int octaves)
      Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 2D.
      Parameters:
      x -
      y -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • layered2D

      public float layered2D​(float x, float y, int seed, int octaves, float frequency)
      Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5) in 2D.
      Parameters:
      x -
      y -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • layered2D

      public float layered2D​(float x, float y, int seed, int octaves, float frequency, float lacunarity)
      Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (0.5) in D.
      Parameters:
      x -
      y -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • layered2D

      public float layered2D​(float x, float y, int seed, int octaves, float frequency, float lacunarity, float gain)
      Generates layered simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves) and gain (loosely, how much to emphasize lower-frequency octaves) in 2D.
      Parameters:
      x -
      y -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • ridged2D

      public float ridged2D​(float x, float y, int seed, int octaves)
      Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5).
      Parameters:
      x -
      y -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • ridged2D

      public float ridged2D​(float x, float y, int seed, int octaves, float frequency)
      Generates ridged-multi simplex noise with the given amount of octaves and default frequency (0.03125), lacunarity (2) and gain (0.5).
      Parameters:
      x -
      y -
      seed -
      octaves -
      Returns:
      noise as a float between -1f and 1f
    • ridged2D

      public float ridged2D​(float x, float y, int seed, int octaves, float frequency, float lacunarity)
      Generates ridged-multi simplex noise with the given amount of octaves and specified lacunarity (the amount of frequency change between octaves); gain is not used.
      Parameters:
      x -
      y -
      seed - any int
      octaves - how many "layers of detail" to generate; at least 1, but note this slows down with many octaves
      frequency - often about 1f / 32f, but generally adjusted for the use case
      lacunarity - when octaves is 2 or more, this affects the change between layers
      Returns:
      noise as a float between -1f and 1f
    • getSimplex

      public float getSimplex​(float x, float y)
    • singleSimplex

      public float singleSimplex​(int seed, float x, float y)
    • getSimplex

      public float getSimplex​(float x, float y, float z, float w)
    • singleSimplex

      public float singleSimplex​(int seed, float x, float y, float z, float w)
    • getSimplexFractal

      public float getSimplexFractal​(float x, float y, float z, float w)
    • singleSimplex

      public float singleSimplex​(int seed, float x, float y, float z, float w, float u, float v)
    • getSimplex

      public float getSimplex​(float x, float y, float z, float w, float u, float v)
    • getSimplexFractal

      public float getSimplexFractal​(float x, float y, float z, float w, float u, float v)
    • getCubicFractal

      public float getCubicFractal​(float x, float y, float z)
    • getCubic

      public float getCubic​(float x, float y, float z)
    • getCubicFractal

      public float getCubicFractal​(float x, float y)
    • getCubic

      public float getCubic​(float x, float y)
    • getCellular

      public float getCellular​(float x, float y, float z)
    • getCellular

      public float getCellular​(float x, float y)
    • gradientPerturb3

      public void gradientPerturb3​(float[] v3)
    • gradientPerturbFractal3

      public void gradientPerturbFractal3​(float[] v3)
    • gradientPerturb2

      public void gradientPerturb2​(float[] v2)
    • gradientPerturbFractal2

      public void gradientPerturbFractal2​(float[] v2)