OmegaEngine API
1.0.3
|
Perlin noise function. More...
Public Member Functions | |
PerlinNoise () | |
Initializes a new instance of the PerlinNoise class. More... | |
double | Function (double x) |
1-D Perlin noise function. More... | |
double | Function2D (double x, double y) |
2-D Perlin noise function. More... | |
Properties | |
double | InitFrequency [get, set] |
Initial frequency. More... | |
double | InitAmplitude [get, set] |
Initial amplitude. More... | |
double | Persistence [get, set] |
Persistence value. More... | |
int | Octaves [get, set] |
Number of octaves, [1, 32]. More... | |
Perlin noise function.
The class implements 1-D and 2-D Perlin noise functions, which represent sum of several smooth noise functions with different frequency and amplitude. The description of Perlin noise function and its calculation may be found on Hugo Elias's page.
The number of noise functions, which comprise the resulting Perlin noise function, is set by Octaves property. Amplitude and frequency values for each octave start from values, which are set by InitFrequency and InitAmplitude properties.
Sample usage (clouds effect):
|
inline |
Initializes a new instance of the PerlinNoise class.
|
inline |
1-D Perlin noise function.
x | x value. |
|
inline |
2-D Perlin noise function.
x | x value. |
y | y value. |
|
getset |
Initial amplitude.
The property sets initial amplitude of the first octave. Amplitudes for next octaves are calculated using the next equation:
amplitudei = InitAmplitude * Persistencei, where i = [0, Octaves).
Default value is set to 1.
|
getset |
Initial frequency.
The property sets initial frequency of the first octave. Frequencies for next octaves are calculated using the next equation:
frequencyi = InitFrequency * 2i, where i = [0, Octaves).
Default value is set to 1.
|
getset |
Number of octaves, [1, 32].
The property sets the number of noise functions, which sum up the resulting Perlin noise function.
Default value is set to 4.
|
getset |
Persistence value.
The property sets so called persistence value, which controls the way how amplitude is calculated for each octave comprising the Perlin noise function.
Default value is set to 0.65.