artofillusion.math
Class SimplexNoise

java.lang.Object
  extended by artofillusion.math.SimplexNoise

public class SimplexNoise
extends java.lang.Object

This class implements Ken Perlin's "simplex noise" algorithm. It is based on an implementation is by Stefan Gustavson, found in his article, "Simplex Noise Demystified" (http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf). It has been modified to improve performance, and methods to calculate the gradient of the noise function and a vector valued noise function have been added.

This is a function which varies smoothly between -1.0 and 1.0, with all of the variation happening on a length scale of about 1. Typically, you will want to add several octaves of this function together to create a fractal noise function. Methods are also provided for calculating the gradient of the noise function, and a closely related noise function which is vector valued.

Note: it is generally recommended to use the Noise class instead of calling this one directly, since that allows the preferred noise generator to be changed.


Constructor Summary
SimplexNoise()
           
 
Method Summary
static double noise(double xin, double yin)
          Calculate the noise value at a point in 2D space.
static double noise(double xin, double yin, double zin)
          Calculate the noise value at a point in 3D space.
static double noise(double x, double y, double z, double w)
          Calculate the noise value at a point in 4D space.
static void noiseGradient(Vec2 gradient, double xin, double yin)
          Calculate the gradient of the noise function at a point in 2D space.
static void noiseGradient(Vec3 gradient, double xin, double yin, double zin)
          Calculate the gradient of the noise function at a point in 3D space.
static void noiseVector(Vec3 v, double xin, double yin, double zin)
          Calculate a vector valued noise function at a point in 3D space.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplexNoise

public SimplexNoise()
Method Detail

noise

public static double noise(double xin,
                           double yin)
Calculate the noise value at a point in 2D space.


noiseGradient

public static void noiseGradient(Vec2 gradient,
                                 double xin,
                                 double yin)
Calculate the gradient of the noise function at a point in 2D space.

Parameters:
gradient - this is set equal to the gradient of the noise function
xin - the x coordinate at which to evaluate the function
yin - the y coordinate at which to evaluate the function

noise

public static double noise(double xin,
                           double yin,
                           double zin)
Calculate the noise value at a point in 3D space.


noiseGradient

public static void noiseGradient(Vec3 gradient,
                                 double xin,
                                 double yin,
                                 double zin)
Calculate the gradient of the noise function at a point in 3D space.

Parameters:
gradient - this is set equal to the gradient of the noise function
xin - the x coordinate at which to evaluate the function
yin - the y coordinate at which to evaluate the function
zin - the z coordinate at which to evaluate the function

noiseVector

public static void noiseVector(Vec3 v,
                               double xin,
                               double yin,
                               double zin)
Calculate a vector valued noise function at a point in 3D space. This function is closely related to the simplex noise function, but is generally less smooth. Nonetheless, it is useful in many cases where a random vector is needed at each point in space. The length of the vector is typically on the order of 1.

Parameters:
v - this is set equal to the value of the noise function
xin - the x coordinate at which to evaluate the function
yin - the y coordinate at which to evaluate the function
zin - the z coordinate at which to evaluate the function

noise

public static double noise(double x,
                           double y,
                           double z,
                           double w)
Calculate the noise value at a point in 4D space.



Copyright © 1999-2011 by Peter Eastman.