Class ClassicNoise

java.lang.Object
squidpony.squidmath.ClassicNoise
All Implemented Interfaces:
Noise.Noise2D, Noise.Noise3D, Noise.Noise4D, Noise.Noise6D

public class ClassicNoise
extends Object
implements Noise.Noise2D, Noise.Noise3D, Noise.Noise4D, Noise.Noise6D
"Classic Perlin" noise, as opposed to the Simplex Noise also created by Ken Perlin (which is produced by SeededNoise; both can be produced by FastNoise). This noise can in theory be scaled up to arbitrary dimensions, but in practice uses unreasonably hefty amounts of memory when dimensionality exceeds 10 or so, since it needs to hash Math.pow(2, dimensionality) points per sample of noise, which involves over a thousand points in 10 dimensions and over a million points in 20 dimensions. For that reason, it's limited to 6D noise here, and also implements 2D, 3D, and 4D. Its performance is surprisingly good at 2D, 3D, and 4D but trails off quickly at 6D. Its quality is worse than normal simplex noise in 2D, but you can use JitterNoise (which takes the same algorithm and distorts the grid pseudo-randomly) to get unusually high-quality 2D noise. The quality is actually quite good in 4D and higher; there's often some rhythmic patterns in 3D when time is z, but with 4 or 6 dimensions this can have fewer artifacts than Simplex in the same dimension. The 3D and higher dimensionality versions don't seem to need jitter to avoid grid artifacts, at least most of the time. This uses different gradient vectors than what was recommended in the "Improved Perlin Noise" paper, since the ones this uses avoid 45-degree angular artifacts in all dimensions implemented.
ClassicNoise is a good choice with parts of WorldMapGenerator that need a Noise3D implementation, and it tends to about as fast as SeededNoise in 3D. It is not recommended for 2D use; prefer JitterNoise or SeededNoise for that. You can also use FastNoise with FastNoise.PERLIN_FRACTAL as the noiseType if you primarily want to use float input and get float output. If you want higher-dimensional noise than this supports, you can use PhantomNoise.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static ClassicNoise instance  
    long seed  
  • Constructor Summary

    Constructors 
    Constructor Description
    ClassicNoise()  
    ClassicNoise​(long seed)  
  • Method Summary

    Modifier and Type Method Description
    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)  
    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)  
    protected static double gradCoord2D​(long seed, int x, int y, double xd, double yd)  
    protected static double gradCoord3D​(long seed, int x, int y, int z, double xd, double yd, double zd)  
    protected static double gradCoord4D​(long seed, int x, int y, int z, int w, double xd, double yd, double zd, double wd)  
    protected static double gradCoord6D​(long seed, int x, int y, int z, int w, int u, int v, double xd, double yd, double zd, double wd, double ud, double vd)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait