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[][]grad3fThe 32 3D vertices of a rhombic triacontahedron.static WhirlingNoiseinstancestatic int[]perm_ustatic int[]perm_vstatic int[]perm_wstatic int[]perm_xstatic int[]perm_ystatic int[]perm_zFields 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 floatdotf(float[] g, float x, float y, float z)doublegetNoise(double x, double y)Delegates toSeededNoise.noise(double, double, long)with the initial seed given to this object.doublegetNoise(double x, double y, double z)Delegates toSeededNoise.noise(double, double, double, long)with the initial seed given to this object.doublegetNoise(double x, double y, double z, double w)Delegates toSeededNoise.noise(double, double, double, double, long)with the initial seed given to this object.doublegetNoiseWithSeed(double x, double y, double z, double w, long seed)Delegates toSeededNoise.noise(double, double, double, double, long).doublegetNoiseWithSeed(double x, double y, double z, long seed)Delegates toSeededNoise.noise(double, double, double, long).doublegetNoiseWithSeed(double x, double y, long seed)Delegates toSeededNoise.noise(double, double, long).static doublenoise(double xin, double yin)Delegates toSeededNoise.noise(double, double, long)with 123456789 as the seed.static doublenoise(double xin, double yin, double zin)Delegates toSeededNoise.noise(double, double, double, long)with 123456789 as the seed.static doublenoise(double x, double y, double z, double w)Delegates toSeededNoise.noise(double, double, double, double, long)with 123456789 as the seed.static doublenoise(double x, double y, double z, double w, long seed)Delegates toSeededNoise.noise(double, double, double, double, long).static doublenoise(double xin, double yin, double zin, long seed)Delegates toSeededNoise.noise(double, double, double, long).static doublenoise(double xin, double yin, long seed)Delegates toSeededNoise.noise(double, double, long).static floatnoiseAlt(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 floatnoiseAlt(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:
getNoisein interfaceNoise.Noise2D- Overrides:
getNoisein 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:
getNoiseWithSeedin interfaceNoise.Noise2D- Overrides:
getNoiseWithSeedin 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:
getNoisein interfaceNoise.Noise3D- Overrides:
getNoisein 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:
getNoiseWithSeedin interfaceNoise.Noise3D- Overrides:
getNoiseWithSeedin 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:
getNoisein interfaceNoise.Noise4D- Overrides:
getNoisein 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:
getNoiseWithSeedin interfaceNoise.Noise4D- Overrides:
getNoiseWithSeedin 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
-