function TPerlinNoise.PerlinNoise_2D(x, y: single): single;
var
total, amplitude, a: single;
frequency, i: integer;
begin
total:= 0;
amplitude:= FTiefe1Ampl;
frequency:= 1;
for i:= 1 to FOctaves do begin
a:= InterpolatedNoise_1(x * frequency, y * frequency);
total:= total + a * amplitude;
frequency:= frequency * 2;
amplitude:= amplitude * FPersistence;
end;
Result:= total + FOffset;
end;
procedure TPerlinNoise.InitGenerator(Persistence: single; Octaves: integer; Min, Max: single);
var
Bereich, total, amplitude: single;
i: integer;
begin
FPersistence:= Persistence;
FOctaves:= Octaves;
FSeed:= 0;
Bereich:= Max - Min;
FOffset:= Min + Bereich * 0.5;
total:= 0;
amplitude:= 1;
for i:= 1 to FOctaves do begin
total:= total + amplitude;
amplitude:= amplitude * FPersistence;
end;
FTiefe1Ampl:= Bereich / total;
FMaxValue:= total;
FRange:= Bereich;
end;