STARSC Аттракторы

STARSC.JPG

Построить фрактал STARSC Аттракторы

Данный фрактал строиться по приведенной ниже формуле:

x' = a sin(2πx) + b sin(2πx)cos(2πy) + c sin(4πx) + d sin(6πx)cos(4πy)
y' = a sin(2πy) + b sin(2πy)cos(2πx) + c sin(4πy) + d sin(6πy)cos(4πx)

Program STARSC;
Uses CRT, Graph;
Var
    GD, GM: Integer;
    nx, ny: Integer;
    key: Char;
    a, b, c, d, x, y: Real;
    x1, y1, sx, sy, sx4, sy4: Real;
Begin
    Randomize;
    GD:=Detect;
    InitGraph(GD, GM, 'c:\bp\bgi');
    While key<>#27 do Begin
      a := 2*(0.5-Random);
      b := 2*(0.5-Random);
      c := 2*(0.5-Random);
      d := 2*(0.5-Random);
      x := Random;
      y := Random;
      While not KeyPressed do Begin
        sx  := pi*2*x;
        sy  := pi*2*y;
        sx4 := pi*4*x;
        sy4 := pi*4*y;
        x1 := a*sin(sx) + b*sin(sx)*cos(sy) + c*sin(sx4) +
	     d*sin(pi*6*x)*cos(sy4);
        y1 := a*sin(sy) + b*sin(sy)*cos(sx) + c*sin(sy4) +
	     d*sin(pi*6*y)*cos(sx4);
        nx := Round(100*x1 + 320);
        ny := Round(100*y1 + 240);
        PutPixel(nx, ny, GetPixel(nx,ny)+1);
        x := x1;
        y := y1;
      End;
      Key:=Readkey;
      ClearDevice;
    End;
    CloseGraph;
End.

Ключевые слова: 
фрактал starsc аттракторы
ВложениеРазмер
STARSC.rar26.09 кб