|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.math.SimplexNoise
public class SimplexNoise
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 |
---|
public SimplexNoise()
Method Detail |
---|
public static double noise(double xin, double yin)
public static void noiseGradient(Vec2 gradient, double xin, double yin)
gradient
- this is set equal to the gradient of the noise functionxin
- the x coordinate at which to evaluate the functionyin
- the y coordinate at which to evaluate the functionpublic static double noise(double xin, double yin, double zin)
public static void noiseGradient(Vec3 gradient, double xin, double yin, double zin)
gradient
- this is set equal to the gradient of the noise functionxin
- the x coordinate at which to evaluate the functionyin
- the y coordinate at which to evaluate the functionzin
- the z coordinate at which to evaluate the functionpublic static void noiseVector(Vec3 v, double xin, double yin, double zin)
v
- this is set equal to the value of the noise functionxin
- the x coordinate at which to evaluate the functionyin
- the y coordinate at which to evaluate the functionzin
- the z coordinate at which to evaluate the functionpublic static double noise(double x, double y, double z, double w)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |