Package squidpony.squidmath
Class WhirlingNoise
java.lang.Object
squidpony.squidmath.SeededNoise
squidpony.squidmath.WhirlingNoise
- All Implemented Interfaces:
Serializable
,Noise.Noise2D
,Noise.Noise3D
,Noise.Noise4D
,Noise.Noise6D
public class WhirlingNoise extends SeededNoise implements Noise.Noise2D, Noise.Noise3D, Noise.Noise4D, Noise.Noise6D, Serializable
A Noise class that's here for compatibility; it extends
Created by Tommy Ettinger on 12/14/2016. The technique for point hashing in the "noiseAlt" code is based closely on this paper, with credit to Andrew Kensler, Aaron Knoll and Peter Shirley. This technique is good, but it may be periodic in undesirable ways, and isn't much faster when implemented in Java than
SeededNoise
and delegates to it for all methods
except noiseAlt(double, double)
and noiseAlt(double, double, double)
. Normally you should use
SeededNoise directly for new code if you expect to mostly use the inner classes in Noise
for special effects,
or FastNoise
if you want the effects all in one place or to use float
instead of double
.
Created by Tommy Ettinger on 12/14/2016. The technique for point hashing in the "noiseAlt" code is based closely on this paper, with credit to Andrew Kensler, Aaron Knoll and Peter Shirley. This technique is good, but it may be periodic in undesirable ways, and isn't much faster when implemented in Java than
IntPointHash
, if at all.- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected static float[][]
grad3f
The 32 3D vertices of a rhombic triacontahedron.static WhirlingNoise
instance
static int[]
perm_u
static int[]
perm_v
static int[]
perm_w
static int[]
perm_x
static int[]
perm_y
static int[]
perm_z
Fields inherited from class squidpony.squidmath.SeededNoise
defaultSeed, F2, F3, F4, F6, G2, G3, G4, G6, grad3d, grad4d, gradient6DLUT, LIMIT4, LIMIT6, phiGrad2, SIMPLEX_4D
-
Constructor Summary
Constructors Constructor Description WhirlingNoise()
WhirlingNoise(long seed)
-
Method Summary
Modifier and Type Method Description protected static float
dotf(float[] g, float x, float y, float z)
double
getNoise(double x, double y)
Delegates toSeededNoise.noise(double, double, long)
with the initial seed given to this object.double
getNoise(double x, double y, double z)
Delegates toSeededNoise.noise(double, double, double, long)
with the initial seed given to this object.double
getNoise(double x, double y, double z, double w)
Delegates toSeededNoise.noise(double, double, double, double, long)
with the initial seed given to this object.double
getNoiseWithSeed(double x, double y, double z, double w, long seed)
Delegates toSeededNoise.noise(double, double, double, double, long)
.double
getNoiseWithSeed(double x, double y, double z, long seed)
Delegates toSeededNoise.noise(double, double, double, long)
.double
getNoiseWithSeed(double x, double y, long seed)
Delegates toSeededNoise.noise(double, double, long)
.static double
noise(double xin, double yin)
Delegates toSeededNoise.noise(double, double, long)
with 123456789 as the seed.static double
noise(double xin, double yin, double zin)
Delegates toSeededNoise.noise(double, double, double, long)
with 123456789 as the seed.static double
noise(double x, double y, double z, double w)
Delegates toSeededNoise.noise(double, double, double, double, long)
with 123456789 as the seed.static double
noise(double x, double y, double z, double w, long seed)
Delegates toSeededNoise.noise(double, double, double, double, long)
.static double
noise(double xin, double yin, double zin, long seed)
Delegates toSeededNoise.noise(double, double, double, long)
.static double
noise(double xin, double yin, long seed)
Delegates toSeededNoise.noise(double, double, long)
.static float
noiseAlt(double x, double y)
2D simplex noise returning a float; extremely similar tonoise(double, double)
, but this may be slightly faster or slightly slower.static float
noiseAlt(double x, double y, double z)
3D simplex noise returning a float; extremely similar tonoise(double, double, double)
, but this may be slightly faster or slightly slower.Methods inherited from class squidpony.squidmath.SeededNoise
getNoise, getNoiseWithSeed, gradCoord3D, noise
-
Field Details
-
instance
-
grad3f
The 32 3D vertices of a rhombic triacontahedron. These were modified from values taken from Vladimir Bulatov's stellation applet, which has available source but is unlicensed, and is available here, but the vertices are mathematical constants so copyright isn't an issue. -
perm_x
-
perm_y
-
perm_z
-
perm_w
-
perm_u
-
perm_v
-
-
Constructor Details
-
WhirlingNoise
public WhirlingNoise() -
WhirlingNoise
-
-
Method Details
-
dotf
-
getNoise
Delegates toSeededNoise.noise(double, double, long)
with the initial seed given to this object.- Specified by:
getNoise
in interfaceNoise.Noise2D
- Overrides:
getNoise
in classSeededNoise
- Parameters:
x
- X inputy
- Y input- Returns:
- noise from -1.0 to 1.0, inclusive
-
getNoiseWithSeed
Delegates toSeededNoise.noise(double, double, long)
.- Specified by:
getNoiseWithSeed
in interfaceNoise.Noise2D
- Overrides:
getNoiseWithSeed
in classSeededNoise
- Parameters:
x
- X inputy
- Y inputseed
- will completely alter the shape of the noise if changed between calls- Returns:
- noise from -1.0 to 1.0, inclusive
-
getNoise
Delegates toSeededNoise.noise(double, double, double, long)
with the initial seed given to this object.- Specified by:
getNoise
in interfaceNoise.Noise3D
- Overrides:
getNoise
in classSeededNoise
- Parameters:
x
- X inputy
- Y inputz
- Z input- Returns:
- noise from -1.0 to 1.0, inclusive
-
getNoiseWithSeed
Delegates toSeededNoise.noise(double, double, double, long)
.- Specified by:
getNoiseWithSeed
in interfaceNoise.Noise3D
- Overrides:
getNoiseWithSeed
in classSeededNoise
- Parameters:
x
- X inputy
- Y inputz
- Z inputseed
- will completely alter the shape of the noise if changed between calls- Returns:
- noise from -1.0 to 1.0, inclusive
-
getNoise
Delegates toSeededNoise.noise(double, double, double, double, long)
with the initial seed given to this object.- Specified by:
getNoise
in interfaceNoise.Noise4D
- Overrides:
getNoise
in classSeededNoise
- Parameters:
x
- X inputy
- Y inputz
- Z inputw
- W input (fourth-dimension)- Returns:
- noise from -1.0 to 1.0, inclusive
-
getNoiseWithSeed
Delegates toSeededNoise.noise(double, double, double, double, long)
.- Specified by:
getNoiseWithSeed
in interfaceNoise.Noise4D
- Overrides:
getNoiseWithSeed
in classSeededNoise
- Parameters:
x
- X inputy
- Y inputz
- Z inputw
- W input (fourth-dimension)seed
- will completely alter the shape of the noise if changed between calls- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toSeededNoise.noise(double, double, long)
with 123456789 as the seed.- Parameters:
xin
- X inputyin
- Y input- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toSeededNoise.noise(double, double, long)
.- Parameters:
xin
- X inputyin
- Y inputseed
- will completely alter the shape of the noise if changed between calls- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toSeededNoise.noise(double, double, double, long)
with 123456789 as the seed.- Parameters:
xin
- X inputyin
- Y inputzin
- Z input- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toSeededNoise.noise(double, double, double, long)
.- Parameters:
xin
- X inputyin
- Y inputzin
- Z inputseed
- will completely alter the shape of the noise if changed between calls- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toSeededNoise.noise(double, double, double, double, long)
with 123456789 as the seed.- Parameters:
x
- X inputy
- Y inputz
- Z inputw
- W input (fourth-dimensional)- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toSeededNoise.noise(double, double, double, double, long)
.- Parameters:
x
- X inputy
- Y inputz
- Z inputw
- W input (fourth-dimensional)seed
- will completely alter the shape of the noise if changed between calls- Returns:
- noise from -1.0 to 1.0, inclusive
-
noiseAlt
2D simplex noise returning a float; extremely similar tonoise(double, double)
, but this may be slightly faster or slightly slower. This uses its parameters verbatim, so you should apply frequency changes yourself. This also cannot take a seed, whilenoise(double, double, long)
can.- Parameters:
x
- x inputy
- y input- Returns:
- noise from -1.0 to 1.0, inclusive
-
noiseAlt
3D simplex noise returning a float; extremely similar tonoise(double, double, double)
, but this may be slightly faster or slightly slower. This uses its parameters verbatim, so you should apply frequency changes yourself. This also cannot take a seed, whilenoise(double, double, double, long)
can.- Parameters:
x
- X inputy
- Y inputz
- Z input- Returns:
- noise from -1.0 to 1.0, inclusive
-