home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1996 March / buyer-0396.iso / thompson / vincent / product / etoile.pas < prev    next >
Pascal/Delphi Source File  |  1995-09-11  |  1KB  |  66 lines

  1.  
  2. program etoile;
  3.  
  4. const
  5.      nom_fichier='Etoile.txt';
  6.      fin='FIN.';
  7.      polygone='POLYGONE';
  8.      finpoly='FIN_POLY';
  9.  
  10.  
  11. type
  12.   TRPoint = record
  13.     X, Y: Real;
  14.   end;
  15.  
  16.  
  17. var script:text;
  18.  
  19. procedure calcul;
  20. const maxpoints=12;
  21. var
  22.   I, J: Integer;
  23.   CentreX,
  24.   CentreY: Integer;
  25.   Rayon,pas: Word;
  26.   Radians: real;
  27.   Points: array[0..MaxPoints] of TRPoint;
  28. begin
  29.   CentreX := 100;
  30.   CentreY := 100;
  31.   rayon   := 90;
  32.   Pas     := 360 div MaxPoints;
  33.   for I := 0 to MaxPoints - 1 do
  34.   begin
  35.        Radians := (Pas * I) * PI / 180;
  36.        Points[I].x := Cos(Radians);
  37.        Points[I].y := Sin(Radians);
  38.   end;
  39.  
  40.   for I := 0 to MaxPoints - 1 do
  41.   begin
  42.     for J := I + 1 to MaxPoints - 1 do
  43.     begin
  44.          write(script,polygone);
  45.          write(script,
  46.              CentreX + Round(Points[I].X * Rayon):5,
  47.              CentreY + Round(Points[I].Y * Rayon):5);
  48.          write(script,
  49.              CentreX + Round(Points[J].X * Rayon):5,
  50.              CentreY + Round(Points[J].Y * Rayon):5);
  51.          writeln(script,'  '+finpoly);
  52.     end;
  53.   end;
  54.   writeln(script,fin);
  55. end;
  56.  
  57.  
  58.  
  59. begin
  60.      Assign(script, nom_fichier);
  61.      {$I-}  Rewrite(script);  {$I+}
  62.      if IOResult=0 then calcul;
  63.      close(script);
  64. end.
  65.  
  66.