Package squidpony.squidmath
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 assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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 assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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 assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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 assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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), orRIDGED_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 bygetConfiguredNoise(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), orCUBIC_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)
void
setCellularNoiseLookup(FastNoise noise)
Sets the FastNoise used to calculate a cell value if cellular return type isNOISE_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), orDISTANCE_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), orRIDGED_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 usinggradientPerturb2(float[])
,gradientPerturb3(float[])
,gradientPerturbFractal2(float[])
, orgradientPerturbFractal3(float[])
; the default is 1.0.void
setInterpolation(int interpolation)
void
setNoiseType(int noiseType)
Sets the default type of noise returned bygetConfiguredNoise(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), orCUBIC_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)
-
Field Details
-
VALUE
- See Also:
- Constant Field Values
-
VALUE_FRACTAL
- See Also:
- Constant Field Values
-
PERLIN
- See Also:
- Constant Field Values
-
PERLIN_FRACTAL
- See Also:
- Constant Field Values
-
SIMPLEX
- See Also:
- Constant Field Values
-
SIMPLEX_FRACTAL
- See Also:
- Constant Field Values
-
CELLULAR
- See Also:
- Constant Field Values
-
WHITE_NOISE
- See Also:
- Constant Field Values
-
CUBIC
- See Also:
- Constant Field Values
-
CUBIC_FRACTAL
- See Also:
- Constant Field Values
-
FOAM
- See Also:
- Constant Field Values
-
FOAM_FRACTAL
- See Also:
- Constant Field Values
-
LINEAR
- See Also:
- Constant Field Values
-
HERMITE
- See Also:
- Constant Field Values
-
QUINTIC
- See Also:
- Constant Field Values
-
FBM
- See Also:
- Constant Field Values
-
BILLOW
- See Also:
- Constant Field Values
-
RIDGED_MULTI
- See Also:
- Constant Field Values
-
EUCLIDEAN
- See Also:
- Constant Field Values
-
MANHATTAN
- See Also:
- Constant Field Values
-
NATURAL
- See Also:
- Constant Field Values
-
CELL_VALUE
- See Also:
- Constant Field Values
-
NOISE_LOOKUP
- See Also:
- Constant Field Values
-
DISTANCE
- See Also:
- Constant Field Values
-
DISTANCE_2
- See Also:
- Constant Field Values
-
DISTANCE_2_ADD
- See Also:
- Constant Field Values
-
DISTANCE_2_SUB
- See Also:
- Constant Field Values
-
DISTANCE_2_MUL
- See Also:
- Constant Field Values
-
DISTANCE_2_DIV
- See Also:
- Constant Field Values
-
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. It's encouraged to use methods that temporarily configure this variable, likegetNoiseWithSeed(float, float, int)
rather than changing its settings and using a method that needs that lasting configuration, likegetConfiguredNoise(float, float)
. -
F2f
- See Also:
- Constant Field Values
-
G2f
- See Also:
- Constant Field Values
-
H2f
- See Also:
- Constant Field Values
-
F3f
- See Also:
- Constant Field Values
-
G3f
- See Also:
- Constant Field Values
-
phiGrad2f
-
grad4f
-
grad6f
-
-
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 benew 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 callsetFractalOctaves(int)
later to benefit from the fractal noiseType), and normal lacunarity and gain (when unspecified, they are 2f and 0.5f). -
FastNoise
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 benew 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 callsetFractalOctaves(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
A constructor that takes two parameters to specify the FastNoise from the start. An example call to this would benew 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 callsetFractalOctaves(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 noisefrequency
- the multiplier for all dimensions, which is usually fairly small (1.0f/32.0f is the default)
-
FastNoise
A constructor that takes a few parameters to specify the FastNoise from the start. An example call to this would benew 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 callsetFractalOctaves(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 noisefrequency
- 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 (seesetNoiseType(int)
)
-
FastNoise
A constructor that takes several parameters to specify the FastNoise from the start. An example call to this would benew 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 noisefrequency
- 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 (seesetNoiseType(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 benew 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 noisefrequency
- 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 (seesetNoiseType(int)
)octaves
- how many octaves of noise to use when the noiseType is one of the _FRACTAL typeslacunarity
- 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
-
getSeed
- Returns:
- Returns the seed used by this object
-
setSeed
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
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
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
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), orQUINTIC
(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
Sets the default type of noise returned bygetConfiguredNoise(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), orCUBIC_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
Gets the default type of noise returned bygetConfiguredNoise(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), orCUBIC_FRACTAL
(9). The default is SIMPLEX.- Returns:
- the noise type as a code, from 0 to 9 inclusive
-
setFractalOctaves
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
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
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
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
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), orRIDGED_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 likeFBM
orRIDGED_MULTI
-
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), orRIDGED_MULTI
(2). The default is FBM.- Returns:
- the fractal type as a code; 0, 1, or 2
-
setCellularDistanceFunction
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), orNATURAL
(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
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), orDISTANCE_2_DIV
(7). If this isn't called, it will use CELL_VALUE.- Parameters:
cellularReturnType
-
-
setCellularNoiseLookup
Sets the FastNoise used to calculate a cell value if cellular return type isNOISE_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
Sets the maximum perturb distance from original location when usinggradientPerturb2(float[])
,gradientPerturb3(float[])
,gradientPerturbFractal2(float[])
, orgradientPerturbFractal3(float[])
; the default is 1.0.- Parameters:
gradientPerturbAmp
- the maximum perturb distance from the original location when using relevant methods
-
setPointHash
-
getNoise
- Specified by:
getNoise
in interfaceNoise.Noise2D
-
getNoiseWithSeed
- Specified by:
getNoiseWithSeed
in interfaceNoise.Noise2D
-
getNoise
- Specified by:
getNoise
in interfaceNoise.Noise3D
-
getNoiseWithSeed
- Specified by:
getNoiseWithSeed
in interfaceNoise.Noise3D
-
getNoise
- Specified by:
getNoise
in interfaceNoise.Noise4D
-
getNoiseWithSeed
- Specified by:
getNoiseWithSeed
in interfaceNoise.Noise4D
-
getNoise
- Specified by:
getNoise
in interfaceNoise.Noise6D
-
getNoiseWithSeed
public double getNoiseWithSeed(double x, double y, double z, double w, double u, double v, long seed)- Specified by:
getNoiseWithSeed
in interfaceNoise.Noise6D
-
getNoiseWithSeed
-
getNoiseWithSeed
-
getNoiseWithSeed
-
getNoiseWithSeed
-
gradCoord2D
-
gradCoord3D
-
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
After being configured with the setters in this class, such assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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
After being configured with the setters in this class, such assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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
After being configured with the setters in this class, such assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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
After being configured with the setters in this class, such assetNoiseType(int)
,setFrequency(float)
,setFractalOctaves(int)
, andsetFractalType(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
-
getWhiteNoise
-
getWhiteNoise
-
getWhiteNoise
-
getWhiteNoiseInt
-
getWhiteNoiseInt
-
getWhiteNoiseInt
-
getWhiteNoiseInt
-
getValueFractal
-
getValue
-
singleValue
-
getValueFractal
-
getValue
-
getValueFractal
-
getValue
-
getValueFractal
-
getValue
-
getFoamFractal
-
getFoam
-
singleFoam
-
getFoamFractal
-
getFoam
-
singleFoam
-
getFoam
-
singleFoam
-
getFoamFractal
-
getFoam
-
singleFoam
-
getPerlinFractal
-
getPerlin
-
getPerlin
-
getPerlinFractal
-
getPerlin
-
getPerlin
-
getSimplexFractal
-
layered3D
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
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
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
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 intoctaves
- how many "layers of detail" to generate; at least 1, but note this slows down with many octavesfrequency
- often about1f / 32f
, but generally adjusted for the use caselacunarity
- whenoctaves
is 2 or more, this affects the change between layers- Returns:
- noise as a float between -1f and 1f
-
getSimplex
-
singleSimplex
-
getSimplexFractal
-
layered2D
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
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
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
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
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
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 intoctaves
- how many "layers of detail" to generate; at least 1, but note this slows down with many octavesfrequency
- often about1f / 32f
, but generally adjusted for the use caselacunarity
- whenoctaves
is 2 or more, this affects the change between layers- Returns:
- noise as a float between -1f and 1f
-
getSimplex
-
singleSimplex
-
getSimplex
-
singleSimplex
-
getSimplexFractal
-
singleSimplex
-
getSimplex
-
getSimplexFractal
-
getCubicFractal
-
getCubic
-
getCubicFractal
-
getCubic
-
getCellular
-
getCellular
-
gradientPerturb3
-
gradientPerturbFractal3
-
gradientPerturb2
-
gradientPerturbFractal2
-