home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / CNC11TP.ZIP / CIRCRAS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-20  |  1.5 KB  |  41 lines

  1. { Copyright (C) 1989 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
  2.  
  3. procedure StrokeCircle ( xc, yc : integer ; r : word ) ;
  4.  
  5.      { CircRAS - draw circular point constellation using   }
  6.      {           rotation angle method and `strange' angle }
  7.      {           step                                      }
  8.  
  9. var
  10.    Color            : word ;    { default color }
  11.    ixar,iyar        : word ;    { aspect ratio parameters }
  12.    iar              : longint ; { aspect ratio B16 }
  13.    ida              : integer ; { loop control }
  14.    it,ix,iy         : longint ; { coordinate variables B22 }
  15.  
  16. begin
  17.                                 { constraint test }
  18.    if r < 504 then begin
  19.                                 { aspect ratio }
  20.       Color := GetColor ;
  21.       GetAspectRatio(ixar,iyar) ;
  22.       iar := SwapLong(longint(ixar)) div longint(iyar) ;
  23.                                 { prescale and offset }
  24.       ix := SwapLong(r shl 6 + idr) ;
  25.       iy := 0 ;
  26.                                 { circle }
  27.       for ida := 1 to r do begin
  28.                                 { rotate coordinates }
  29.          it := (iy div 16 + ix) div 8 - iy ;
  30.          iy := (-ix div 16 + iy) div 8 + ix ;
  31.          ix := it ;
  32.                                 { apply aspect ratio }
  33.          PutPixel(xc+RoundScaleB6(LongHi(ix)),
  34.                   yc+RoundScaleB6(LongHi(LongHi(iy)*iar)),Color)
  35.  
  36.       end
  37.    end
  38. end ;
  39.  
  40. { Copyright (C) 1989 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
  41.