PerlinNoise Class |
Namespace: Accord.Math
The PerlinNoise type exposes the following members.
Name | Description | |
---|---|---|
PerlinNoise |
Initializes a new instance of the PerlinNoise class.
| |
PerlinNoise(Int32, Double) |
Initializes a new instance of the PerlinNoise class.
| |
PerlinNoise(Int32, Double, Double, Double) |
Initializes a new instance of the PerlinNoise class.
|
Name | Description | |
---|---|---|
InitAmplitude |
Initial amplitude.
| |
InitFrequency |
Initial frequency.
| |
Octaves |
Number of octaves, [1, 32]. Default is 4.
| |
Persistence |
Persistence value.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
Function |
1-D Perlin noise function.
| |
Function2D |
2-D Perlin noise function.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
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):
// create Perlin noise function PerlinNoise noise = new PerlinNoise( 8, 0.5, 1.0 / 32 ); // generate clouds effect float[,] texture = new float[height, width]; for ( int y = 0; y < height; y++ ) { for ( int x = 0; x < width; x++ ) { texture[y, x] = Math.Max( 0.0f, Math.Min( 1.0f, (float) noise.Function2D( x, y ) * 0.5f + 0.5f ) ); } }