Delphi ile küre çizimi tam kodu:
unit Kure;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var x,y,z,fi,teta:real;
a,b:Integer;
begin
teta:=0;
while teta<(2*Pi) do
begin
fi:=0;
while fi<(2*Pi) do
begin
x:=300+300*cos(fi)*cos(teta);
y:=400+300*cos(fi)*sin(teta);
z:=300+300*sin(fi);
a:=round(x*cos(Pi/4)+z*sin(Pi/4));
b:=round((x*cos(Pi/4)*sin(Pi/5.1))+(y*cos(Pi/5.1))-(z*cos(Pi/4)*sin(Pi/5.1)));
fi:=fi+0.001;
Canvas.Pixels[a,b]:=clYellow;
end;
//tct:=tct+0.01;
teta:=teta+0.1;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.Refresh;
end;
end.