public class PerlinNoise
extends java.lang.Object
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.
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.| Modifier and Type | Field and Description |
|---|---|
static double |
SCALE
This class simply calls methods from
ClassicNoise and multiplies the inputs by 0.11709966304863834, or
1.0 / Math.E / Math.PI. |
| Modifier | Constructor and Description |
|---|---|
protected |
PerlinNoise() |
| Modifier and Type | Method and Description |
|---|---|
static double |
noise(double xin,
double yin)
Delegates to
ClassicNoise.getNoiseWithSeed(double, double, long); multiplies its inputs by SCALE
and uses a seed of 123456789. |
static double |
noise(double xin,
double yin,
double zin)
Delegates to
ClassicNoise.getNoiseWithSeed(double, double, double, long); multiplies its inputs by
SCALE and uses a seed of 123456789. |
static double |
noise(double x,
double y,
double z,
double w)
Delegates to
ClassicNoise.getNoiseWithSeed(double, double, double, double, long); multiplies its inputs
by SCALE and uses a seed of 123456789. |
public static final double SCALE
ClassicNoise and multiplies the inputs by 0.11709966304863834, or
1.0 / Math.E / Math.PI. Where a seed is used, it's always 123456789.public static double noise(double xin,
double yin)
ClassicNoise.getNoiseWithSeed(double, double, long); multiplies its inputs by SCALE
and uses a seed of 123456789.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 acceptedpublic static double noise(double xin,
double yin,
double zin)
ClassicNoise.getNoiseWithSeed(double, double, double, long); multiplies its inputs by
SCALE and uses a seed of 123456789.xin - X inputyin - Y inputzin - Z inputpublic static double noise(double x,
double y,
double z,
double w)
ClassicNoise.getNoiseWithSeed(double, double, double, double, long); multiplies its inputs
by SCALE and uses a seed of 123456789.x - X positiony - Y positionz - Z positionw - W position (fourth dimension)Copyright © Eben Howard 2012–2022. All rights reserved.