Lights Of Heaven

Rabu, 10 Oktober 2012

ALGORITMA TREELEAF 3


menggunakan delphi7,,,,,silahkan dicoba



procedure TForm1.Button1Click(Sender: TObject);
var r,d,e,c,x,y,z,theta,thetf: real;
a,xc,yc:integer;
begin
a:=184;
xc:=300;
yc:=300;
thetf:=10.10;
d:=30*PI;
e:=6*sin(45*thetf);
theta:=a+d+e;
c:=1/a;
while (thetf<theta) do
begin
 r:=a+d/cos(15*thetf);
 x:=d+r*cos(thetf);
 y:=a-r*sin(thetf);
 canvas.pixels[trunc(xc+x),trunc(yc+y)]:=clred;

 canvas.pixels[trunc(xc-x),trunc(yc+y)]:=clred;
 canvas.pixels[trunc(xc+x),trunc(yc-y)]:=clred;
 canvas.pixels[trunc(xc-x),trunc(yc-y)]:=clred;
 thetf:=thetf+c;
 end;
end;
end.

disamakan yang di bawah ini keseluruhannya....


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var r,d,e,c,x,y,z,theta,thetf: real;
    a,xc,yc:integer;
begin
    a:=184;
    xc:=300;
    yc:=300;
    thetf:=10.10;
    d:=30*PI;
    e:=6*sin(45*thetf);
    theta:=a+d+e;
    c:=1/a;

    while (thetf<theta) do
      begin
        r:=a+d/cos(15*thetf);
        x:=d+r*cos(thetf);
        y:=a-r*sin(thetf);
        canvas.pixels[trunc(xc+x),trunc(yc+y)]:=clred;
        canvas.pixels[trunc(xc-x),trunc(yc+y)]:=clred;
        canvas.pixels[trunc(xc+x),trunc(yc-y)]:=clred;
        canvas.pixels[trunc(xc-x),trunc(yc-y)]:=clred;
        thetf:=thetf+c;
      end;

end;

end.


Stumble
Delicious
Technorati
Twitter
Facebook
Reddit

Tidak ada komentar:

:) :( ;) :D ;;-) :-/ :x :P :-* =(( :-O X( :7 B-) :-S #:-S 7:) :(( :)) :| /:) =)) O:-) :-B =; :-c :)] ~X( :-h :-t 8-7 I-) 8-| L-) :-a :-$ [-( :O) 8-} 2:-P (:| =P~ :-? #-o =D7 :-SS @-) :^o :-w 7:P 2):) X_X :!! \m/ :-q :-bd ^#(^ :ar!

SILAHKAN KOMENTARNYA

tolong komentarnya.....