unit Fractals; interface Uses extctrls, graphics; Procedure GenRandomFrac( X : TImage; X1,X2,Y1,Y2 : Word ); Procedure Julia ( X : TImage; X1,X2,Y1,Y2 : Word ); implementation Uses Pal,Img,MainForm, SysUtils, cmplx; Procedure Julia ( X : TImage; X1,X2,Y1,Y2 : Word ); Var XMax, XMin, YMax, YMin : Extended; Radius, CIter,MaxIter : Integer; P, Jp,Kp : Complex; I, J : Word; CLast : LongInt; V : pByteArray; Begin FrcForm.FrcImg.Visible := False; CLast := MainF.List.Items.Add( IntToStr(CIter) ); MainF.List.Items[CLast] := '0'; Jp.re := 0.32; Jp.im := -0.043; XMax := 1.5; XMin := -1.5; YMax := 1.5; YMin := -1.5; Radius := 10; MaxIter := 255; X.Picture.Bitmap.PixelFormat := pf32bit; For I := Y1 to y2-1 Do Begin V := X.Picture.Bitmap.ScanLine[I]; If v = nil then exit; For J := x1 to x2-1 Do Begin CIter := 0; P.re:=Xmin+J*((Xmax-Xmin)/(X2-X1)); P.im:=Ymin+I*((Ymax-Ymin)/(Y2-Y1)); While (CIter < MaxIter) AND (Abs(P) < Radius) Do Begin Inc(CIter); //Equation here ((Z+1)^2+C)/z // P := Divi(Mult(Add(P,Jp),Add(P,Jp)),P); P := Add(Mult(P,P),Jp); // P:= Mult(Mult(Jp,P),Add(Jp,P)); End; Citer := Citer mod 255; V[J*4] := Pal3[Citer,0]; V[J*4+1] := Pal3[Citer,1]; V[J*4+2] := Pal3[Citer,2]; End; MainF.Gauge.Progress := Round(I * MainF.Gauge.MaxValue / (y2-y1)); End; FrcForm.FrcImg.Visible := True; FrcForm.FrcImg.Repaint; End; (* Procedure Julia( X : TImage ); const divs=120; blowup=10; mxc=256; var cycle:word; norm:extended; point,npoint:complex; a,b:integer; ci,cx : extended; S : String; ch : Char; t,q : text; Begin cx := 0.191035774; ci := -0.593232841; MainF.List.Items.Add(inttostr (X.height)+','+inttostr(X.width)); MainF.Refresh; FrcForm.FrcImg.Visible := False; FrcForm.FrcImg.Stretch := False; for b:=0 to X.Height do begin for a:=0 to X.Width do begin X.Canvas.Pixels[A,B] := 255; norm:=0; cycle:=0; point.x:=(a-X.Width/2)/divs; point.i:=(b-X.Height/2)/divs; while (norm<=blowup) and (cycle<=mxc) do begin npoint.x:=(point.x*point.x) - (point.i*point.i) + cx; npoint.i:=2*point.i*point.x+ci; inc(cycle); point.x:=npoint.x; point.i:=npoint.i; norm:= (point.x*point.x)+(point.i*point.i); if norm<0 then norm:=11 else norm:=sqrt( (point.x*point.x)+(point.i*point.i) ); end; X.Canvas.Pixels[A,B] := CPal[Cycle Div 2]; end; MainF.Gauge.Progress := Round(B * MainF.Gauge.MaxValue / X.Height); // FrcForm.FrcImg.Repaint; end; //end of for } FrcForm.FrcImg.Visible := True; FrcForm.FrcImg.Stretch := True; End; *) Procedure GenRandomFrac( X : TImage; X1, X2, Y1, Y2 : Word ); Begin End; end.