Laman

Sabtu, 19 Oktober 2013

Listing Program Modifikasi Threeleaf Bentuk Kupu-Kupu (menggunakan delphi)

Bentuk Kupu-Kupu Terbalik


procedure TForm1.hreeleaf1Click(Sender: TObject);
var r,d,c,x,y,theta,thetf: real;
a,xc,yc:integer;
begin
 a:=100;xc:=300;yc:=200;
thetf:=0.0;
d:=25*PI;
theta:=d;
c:=1/a;
while (thetf<theta) do
begin
r:=a*sin(8*thetf)*cos(thetf);
x:=r*cos(thetf);
y:=-r*sin(thetf);
canvas.pixels[trunc(xc+x),trunc(yc+y)]:=clpurple;
thetf:=thetf+c;
end;
end;
end.


                                                           Bentuk Kupu-Kupu Kecil


procedure TForm1.hreeleaf1Click(Sender: TObject);
var r,d,c,x,y,theta,thetf: real;
a,xc,yc:integer;
begin
 a:=100;xc:=300;yc:=200;
thetf:=0.0;
d:=25*PI;
theta:=d;
c:=1/a;
while (thetf<theta) do
begin
r:=a*sin(8*thetf)*cos(thetf);
x:=r*cos(thetf);
y:=r*sin(thetf);
canvas.pixels[trunc(xc+x),trunc(yc+y)]:=clpurple;
thetf:=thetf+c;
end;
end;
end.

                                                            Bentuk Kupu-Kupu Besar


procedure TForm1.hreeleaf1Click(Sender: TObject);
var r,d,c,x,y,theta,thetf: real;
a,xc,yc:integer;
begin
 a:=300;xc:=300;yc:=200;
thetf:=0.0;
d:=25*PI;
theta:=d;
c:=1/a;
while (thetf<theta) do
begin
r:=a*sin(8*thetf)*cos(thetf);
x:=r*cos(thetf);
y:=r*sin(thetf);
canvas.pixels[trunc(xc+x),trunc(yc+y)]:=clpurple;
thetf:=thetf+c;
end;
end;
end.

0 komentar:

Posting Komentar