home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / elan / intgraph / moving.eln < prev    next >
Text File  |  1988-10-11  |  911b  |  36 lines

  1.  
  2. moving radar:
  3.   enter graphics mode;
  4.   print heading;
  5.   determine parameters;
  6.   draw moving radar;
  7.   wait for confirmation (2 * graphics x limit DIV 3, 1);
  8.   leave graphics mode.
  9.  
  10. print heading:
  11.   put ("Moving radar");
  12.   line;
  13.   put ("============");
  14.   line.
  15.   
  16. determine parameters:
  17.   REAL VAR radius :: ask real ("Radius? ");
  18.   radius := min (radius, real (min (graphics y limit, graphics x limit)) / 2.1);
  19.   put ("Radius used: ");
  20.   put (text (int (radius), 3));
  21.   REAL CONST step x :: min (1.0, real (graphics x limit) / 360.0);
  22.   REAL VAR centre x :: max (0.0, radius - 260.0);
  23.   INT CONST centre y :: graphics y limit - int (radius).
  24.  
  25. draw moving radar:
  26.   INT VAR i;
  27.   FOR i FROM 0 UPTO 360
  28.   REP
  29.     move (round (centre x), centre y);
  30.     draw (round (centre x + aspect * sin (i) * radius), centre y + round (cos (i) * radius));
  31.     centre x INCR step x
  32.   ENDREP.
  33.  
  34. 
  35.  
  36.