public double Function2D ( double x , double y ) { double frequency = initFrequency ; double amplitude = initAmplitude ; double sum = 0 ; // octaves for ( int i = 0 ; i < octaves ; i ++ ) { sum += SmoothedNoise ( x * frequency , y * frequency ) * amplitude ; frequency *= 2 ; amplitude *= persistence ; } return sum ; }
2 - D Perlin noise function .