C# 클래스 Accord.Math.PerlinNoise

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):

// 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 ) ); } }
파일 보기 프로젝트 열기: accord-net/framework

공개 메소드들

메소드 설명
Function ( double x ) : double

1-D Perlin noise function.

Function2D ( double x, double y ) : double

2-D Perlin noise function.

PerlinNoise ( ) : System

Initializes a new instance of the PerlinNoise class.

PerlinNoise ( int octaves, double persistence ) : System

Initializes a new instance of the PerlinNoise class.

PerlinNoise ( int octaves, double persistence, double initFrequency, double initAmplitude ) : System

Initializes a new instance of the PerlinNoise class.

비공개 메소드들

메소드 설명
CosineInterpolate ( double x1, double x2, double a ) : double

Cosine interpolation.

Noise ( int x ) : double

Ordinary noise function

Noise ( int x, int y ) : double
SmoothedNoise ( double x ) : double

Smoothed noise.

SmoothedNoise ( double x, double y ) : double

메소드 상세

Function() 공개 메소드

1-D Perlin noise function.
public Function ( double x ) : double
x double x value.
리턴 double

Function2D() 공개 메소드

2-D Perlin noise function.
public Function2D ( double x, double y ) : double
x double x value.
y double y value.
리턴 double

PerlinNoise() 공개 메소드

Initializes a new instance of the PerlinNoise class.
public PerlinNoise ( ) : System
리턴 System

PerlinNoise() 공개 메소드

Initializes a new instance of the PerlinNoise class.
public PerlinNoise ( int octaves, double persistence ) : System
octaves int Number of octaves (see property).
persistence double Persistence value (see property).
리턴 System

PerlinNoise() 공개 메소드

Initializes a new instance of the PerlinNoise class.
public PerlinNoise ( int octaves, double persistence, double initFrequency, double initAmplitude ) : System
octaves int Number of octaves (see property).
persistence double Persistence value (see property).
initFrequency double Initial frequency (see property).
initAmplitude double Initial amplitude (see property).
리턴 System