Art & Programming - sucks!


Some years ago I was programming a lot - One of the nicest things was the programming of fractal graphics

Mandelbrotmange

Just to show that programming this graphics is very easy, here some sample source code in Pascal

In Addition I can strongly recommend the homepage of Donald E. Knuth
The inventor of TeX and writer of the book "The art of Computer Programming"

Program Mandelbrotmenge;

uses Graph,Crt,druck;

Const MaxTiefe=100;
      Min=-0.76960;
      Max=-0.76955;
      IMin=-0.1158;
      IMax=-0.11575;
      MaxXWert=650;
      MaxYWert=340;
Var   c,ci,z,zi,e,ei,
      XSchritt,
      YSchritt:real;
      GraphDriver,
      GraphMode,
      XVersetzt,
      YVersetzt,
      Hilfx,
      Hilfy,
      X,
      Y,
      Zaehler:integer;



   begin

     DetectGraph(GraphDriver,GraphMode);
     InitGraph(GraphDriver,GraphMode,'');

    XVersetzt:=round(getMaxX/2-MaxXWert/2);
    YVersetzt:=round(getMaxY/2-MaxYWert/2);

    Rectangle(XVersetzt,YVersetzt,XVersetzt+MaxXWert,YVersetzt+MaxYWert);

    SetFillStyle(10,15);
    FloodFill(0,0,15);

    XSchritt:=(Max-Min)/MaxXWert;
    YSchritt:=(IMax-IMin)/MaxYWert;

    c:=Min;
     for X:= 1 to MaxXWert do begin
     c:=c+XSchritt;
     ci:=IMin;
            for Y:= 1 to MaxYWert  do begin
            ci:=ci+YSchritt;
            z:=0;
            zi:=0;
            Zaehler:=0;
                     repeat
                         Zaehler:=Zaehler+1;
                         e:=z*z-zi*zi;
                         ei:=2*z*zi;
                         z:=e+c;
                         zi:=ei+ci;
                     until (z*z+zi*zi>=4) or (Zaehler>maxtiefe);
            if zaehler>=maxtiefe  then PutPixel(X+XVersetzt,Y+YVersetzt,15);
            end;
     end;
ausdruck(true);
end.

Nowaday you don't need to program it on your own - E.g. the Program FRACTINT

is easy to use making fractal graphics...


zurück zur Hauptseite