unit UNT_julia_1;
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TFRM_apfelmann =
class(TForm)
BTN_zeichnen: TBitBtn;
BTN_close: TBitBtn;
LBL_xmin: TLabel;
EDT_xmax: TEdit;
LBL_xmax: TLabel;
EDT_ymin: TEdit;
LBL_ymin: TLabel;
EDT_xmin: TEdit;
LBL_ymax: TLabel;
EDT_ymax: TEdit;
LBL_kmax: TLabel;
EDT_kmax: TEdit;
LBL_creal: TLabel;
EDT_creal: TEdit;
LBL_cimag: TLabel;
EDT_cimag: TEdit;
LBL_fluchtgrenze: TLabel;
EDT_rmax: TEdit;
procedure BTN_closeClick(Sender: TObject);
procedure BTN_zeichnenClick(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FRM_apfelmann: TFRM_apfelmann;
implementation
{$R *.dfm}
var x_bild,y_bild,kmax,k,rmax,xo,xu,yl,yr : integer;
x,xalt,y,dx,dy,creal,cimag : real;
xmax,xmin,ymax,ymin : real;
md : boolean;
procedure TFRM_apfelmann.BTN_closeClick(Sender: TObject);
begin
close;
end;
procedure iteration(x_bild,y_bild: integer);
begin
x := xmin + x_bild*dx;
y := ymax - y_bild*dy;
cimag := (x_bild -300) / 100;
creal := (y_bild -200) / 100;
k := 0;
repeat
xalt := x;
x := sqr(x) - sqr(y) + creal;
y := 2*xalt*y + cimag;
inc(k);
until (sqr(x)+sqr(y)>rmax)
or (k>kmax);
if k >= kmax
then k:=0;
FRM_apfelmann.canvas.pixels[x_bild+152,y_bild+8] := 16000000div(k+1);
end;
procedure TFRM_apfelmann.BTN_zeichnenClick(Sender: TObject);
begin
xmax := strtofloat(EDT_xmax.text);
xmin := strtofloat(EDT_xmin.text);
ymax := strtofloat(EDT_ymax.text);
ymin := strtofloat(EDT_ymin.text);
kmax := strtoint(EDT_kmax.text);
rmax := strtoint(EDT_rmax.Text);
creal := strtofloat(EDT_creal.text);
cimag := strtofloat(EDT_cimag.text);
dx := (xmax-xmin)/600;
dy := (ymax-ymin)/400;
for x_bild := 0
to 600
do
for y_bild := 0
to 400
do iteration (x_bild,y_bild);
end;
procedure TFRM_apfelmann.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var a,b : real;
begin
a := xmin +(x-152)*(xmax-xmin)/600;
b := ymax - (y-8)*(ymax-ymin)/400;
EDT_xmin.Text := floattostrf(a,fffixed,10,8);
EDT_ymax.Text := floattostrf(b,fffixed,10,8);
xo := x; yl := y; xu := x; yr := y;
md := true;
end;
procedure TFRM_apfelmann.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
md := false;
end;
procedure TFRM_apfelmann.FormMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var a,b : real;
begin
if md
then
begin
a := xmin + (x-152)*(xmax-xmin)/600;
b := ymax - (y-8)*(ymax-ymin)/400;
EDT_xmax.Text := floattostrf(a,fffixed,10,8);
EDT_ymin.Text := floattostrf(b,fffixed,10,8);
canvas.Pen.Mode := pmnotxor;
canvas.Rectangle(xo,yl,xu,yr);
canvas.Rectangle(xo,yl,x,y);
canvas.Pen.Mode := pmcopy;
xu := x; yr := y;
end;
end;
procedure TFRM_apfelmann.FormCreate(Sender: TObject);
begin
md := false;
end;
end.