1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123:
| t UNT_AM_Main;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, jpeg;
type TFRM_Main = class(TForm) BTN_Options: TBitBtn; BTN_Zeichnen: TBitBtn; IMG_Apfelmann: TImage; SHP_Unterteilung: TShape; procedure BTN_OptionsClick(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); procedure BTN_ZeichnenClick(Sender: TObject); private public end;
var FRM_Main: TFRM_Main;
implementation
uses UNT_AM_Options;
{$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 iteration(x_bild,y_bild: integer); begin x := xmin + x_bild*dx; y := ymax - y_bild*dy; creal := (x_bild) *dx+xmin; cimag := (400-y_bild) *dy+ymin; 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_Main.IMG_Apfelmann.canvas.pixels[x_bild+1,y_bild+1] := 16000000div(k+1); end;
procedure TFRM_Main.BTN_OptionsClick(Sender: TObject); begin FRM_Options.show; end;
procedure TFRM_Main.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var a,b : real; begin a := xmin + (x-152)*(xmax-xmin)/500; b := ymax - (y-8)*(ymax-ymin)/400; FRM_Options.EDT_xmin.Text := floattostrf(a,fffixed,10,8); FRM_Options.EDT_ymax.Text := floattostrf(b,fffixed,10,8); xo := x; yl := y; xu := x; yr := y; md := true; end;
procedure TFRM_Main.FormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin md := false; end;
procedure TFRM_Main.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var a,b : real; begin if md then begin a := xmin + (x-152)*(xmax-xmin)/500; b := ymax - (y-8)*(ymax-ymin)/400; FRM_Options.EDT_xmax.Text := floattostrf(a,fffixed,10,8); FRM_Options.EDT_ymin.Text := floattostrf(b,fffixed,10,8); IMG_Apfelmann.canvas.Pen.Mode := pmnotxor; IMG_Apfelmann.canvas.Rectangle(xo,yl,xu,yr); IMG_Apfelmann.canvas.Rectangle(xo,yl,x,y); IMG_Apfelmann.canvas.Pen.Mode := pmcopy; xu := x; yr := y; end; end;
procedure TFRM_Main.FormCreate(Sender: TObject); begin md := false; end;
procedure TFRM_Main.BTN_ZeichnenClick(Sender: TObject); begin xmax := strtofloat(FRM_Options.EDT_xmax.text); xmin := strtofloat(FRM_Options.EDT_xmin.text); ymax := strtofloat(FRM_Options.EDT_ymax.text); ymin := strtofloat(FRM_Options.EDT_ymin.text); kmax := strtoint(FRM_Options.EDT_kmax.text); rmax := strtoint(FRM_Options.EDT_rmax.Text); creal := strtofloat(FRM_Options.EDT_creal.text); cimag := strtofloat(FRM_Options.EDT_cimag.text); dx := (xmax-xmin)/500; dy := (ymax-ymin)/400; for x_bild := 0 to 500 do for y_bild := 0 to 400 do iteration (x_bild,y_bild); end;
end. |