Package squidpony.squidmath
Class PerlinNoise
java.lang.Object
squidpony.squidmath.PerlinNoise
public class PerlinNoise extends Object
Delegates to
This formerly produced Simplex noise, which was incredibly confusing; if you want that type of noise you should use
ClassicNoise methods and always uses the same seed (123456789); that means this produces
"Classic Perlin Noise" and not Simplex Noise (both were created by Ken Perlin). ClassicNoise provides more options
because it implements Noise.Noise2D and other Noise interfaces; you can use Noise2D and
its relatives with classes like Noise.Ridged2D. You could also use FastNoise with
FastNoise.PERLIN_FRACTAL as its noiseType, which includes features like adding together multiple octaves or
the above ridged noise. This is pretty much here as a bare-bones, basic noise generator.
This formerly produced Simplex noise, which was incredibly confusing; if you want that type of noise you should use
SeededNoise. To exactly reproduce the old PerlinNoise methods, you can call
return SeededNoise.noise(x * 0.11709966304863834, y * 0.11709966304863834, 123456789) for 2D,
return SeededNoise.noise(x * 0.11709966304863834, y * 0.11709966304863834, z * 0.11709966304863834, 123456789) for 3D, or
return SeededNoise.noise(x * 0.11709966304863834, y * 0.11709966304863834, z * 0.11709966304863834, w * 0.11709966304863834, 123456789) for 4D.
0.11709966304863834 is just the frequency this uses; it's 1.0 / Math.E / Math.PI, which is meant to
hit an integer multiple very rarely.-
Field Summary
Fields Modifier and Type Field Description static doubleSCALEThis class simply calls methods fromClassicNoiseand multiplies the inputs by 0.11709966304863834, or1.0 / Math.E / Math.PI. -
Constructor Summary
Constructors Modifier Constructor Description protectedPerlinNoise() -
Method Summary
Modifier and Type Method Description static doublenoise(double xin, double yin)Delegates toClassicNoise.getNoiseWithSeed(double, double, long); multiplies its inputs bySCALEand uses a seed of 123456789.static doublenoise(double xin, double yin, double zin)Delegates toClassicNoise.getNoiseWithSeed(double, double, double, long); multiplies its inputs bySCALEand uses a seed of 123456789.static doublenoise(double x, double y, double z, double w)Delegates toClassicNoise.getNoiseWithSeed(double, double, double, double, long); multiplies its inputs bySCALEand uses a seed of 123456789.
-
Field Details
-
SCALE
This class simply calls methods fromClassicNoiseand multiplies the inputs by 0.11709966304863834, or1.0 / Math.E / Math.PI. Where a seed is used, it's always 123456789.- See Also:
- Constant Field Values
-
-
Constructor Details
-
PerlinNoise
protected PerlinNoise()
-
-
Method Details
-
noise
Delegates toClassicNoise.getNoiseWithSeed(double, double, long); multiplies its inputs bySCALEand uses a seed of 123456789.- Parameters:
xin- x input; works well if between 0.0 and 1.0, but anything is acceptedyin- y input; works well if between 0.0 and 1.0, but anything is accepted- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toClassicNoise.getNoiseWithSeed(double, double, double, long); multiplies its inputs bySCALEand uses a seed of 123456789.- Parameters:
xin- X inputyin- Y inputzin- Z input- Returns:
- noise from -1.0 to 1.0, inclusive
-
noise
Delegates toClassicNoise.getNoiseWithSeed(double, double, double, double, long); multiplies its inputs bySCALEand uses a seed of 123456789.- Parameters:
x- X positiony- Y positionz- Z positionw- W position (fourth dimension)- Returns:
- noise from -1.0 to 1.0, inclusive
-