unit Bahnen;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
BerechneButton: TButton;
Image1: TImage;
aEdit: TLabeledEdit;
bEdit: TLabeledEdit;
Image2: TImage;
procedure BerechneButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure drawFunc(a,b:real);
var z,x : real;
begin
x := 0;
Repeat
z:= (x*Pi)/180;
form1.image1.Canvas.Pixels [trunc(a*100*cos(z))+423,trunc(b*100*sin(z))+353]:= clblack;
x := x + (1/10);
Until x > 360;
end;
procedure gehe_nach( c,d:integer);
begin
form1.image1.Canvas.pen.color:=clblack;
form1.image1.Canvas.pen.width:=1;
form1.image1.Canvas.moveto(c,d)
end;
procedure linie(e,f:integer);
begin
form1.image1.Canvas.pen.color:=clblack;
form1.image1.Canvas.pen.width:=1;
form1.image1.Canvas.lineto(e,f);
end;
procedure TForm1.BerechneButtonClick(Sender: TObject);
var a,b:real;
c,d,e,f,g,h,i,j:integer;
begin
Image2.Picture.LoadFromFile('C:\...\erlaeuterung.bmp');
a:=StrToInt(aedit.text);
b:=StrToInt(bedit.text);
c:=trunc((a*(-100))+423);
d:=trunc(353);
e:=trunc((a*100)+423);
f:=trunc(353);
drawFunc(a,b);
gehe_nach(c,d);
linie(e,f);
g:=trunc(423);
h:=trunc((b*100)+353);
i:=trunc(423);
j:=trunc((b*(-100))+353);
gehe_nach(g,h);
linie(i,j)
end;
end.