Class JitterNoise

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

public class JitterNoise
extends Object
implements Noise.Noise2D, Noise.Noise3D, Noise.Noise4D, Noise.Noise6D
"Classic Perlin" noise with jitter applied to the grid it operates on. Not to be confused with the Simplex Noise also created by Ken Perlin (which is in SeededNoise), or with the non-jittered but similar ClassicNoise. 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 similar to SeededNoise in 2D, and slows down further on 3D, 4D, and especially 6D. However, due to the grid jitter, its quality is improved substantially over vanilla Simplex Noise, and it appears more detailed with one octave than Simplex does. 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 recommended for most usage in WorldMapGenerator that needs a Noise3D implementation, and it tends to about as fast as SeededNoise in 3D with less artifacts. JitterNoise is a fair amount slower than ClassicNoise, but it has much better quality in 2D and may have somewhat-better quality in higher dimensions as well. There's probably no reason to prefer JitterNoise over ClassicNoise for 6D output, because they're practically indistinguishable other than ClassicNoise being much faster.
  • Field Summary

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

    Constructors 
    Constructor Description
    JitterNoise()  
    JitterNoise​(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