home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Buyer 1996 March
/
buyer-0396.iso
/
thompson
/
vincent
/
product
/
etoile.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-09-11
|
1KB
|
66 lines
program etoile;
const
nom_fichier='Etoile.txt';
fin='FIN.';
polygone='POLYGONE';
finpoly='FIN_POLY';
type
TRPoint = record
X, Y: Real;
end;
var script:text;
procedure calcul;
const maxpoints=12;
var
I, J: Integer;
CentreX,
CentreY: Integer;
Rayon,pas: Word;
Radians: real;
Points: array[0..MaxPoints] of TRPoint;
begin
CentreX := 100;
CentreY := 100;
rayon := 90;
Pas := 360 div MaxPoints;
for I := 0 to MaxPoints - 1 do
begin
Radians := (Pas * I) * PI / 180;
Points[I].x := Cos(Radians);
Points[I].y := Sin(Radians);
end;
for I := 0 to MaxPoints - 1 do
begin
for J := I + 1 to MaxPoints - 1 do
begin
write(script,polygone);
write(script,
CentreX + Round(Points[I].X * Rayon):5,
CentreY + Round(Points[I].Y * Rayon):5);
write(script,
CentreX + Round(Points[J].X * Rayon):5,
CentreY + Round(Points[J].Y * Rayon):5);
writeln(script,' '+finpoly);
end;
end;
writeln(script,fin);
end;
begin
Assign(script, nom_fichier);
{$I-} Rewrite(script); {$I+}
if IOResult=0 then calcul;
close(script);
end.