home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / CNC11TP.ZIP / CIRCRAM.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-19  |  1.6 KB  |  47 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.      { CircRAM - draw circle using rotation angle method   }
  6.      {           and `minimum' angle step                  }
  7.  
  8. var
  9.    ixar,iyar        : word ;    { aspect ratio parameters }
  10.    iar              : longint ; { aspect ratio B16 }
  11.    ida              : integer ; { loop control }
  12.    ix,iy,it         : longint ; { coordinate variables B22 }
  13.    ix0,iy0,ix1,iy1  : integer ; { display coordinates B0 }
  14.  
  15. begin
  16.                                 { constraint test }
  17.    if r < 510 then begin
  18.                                 { aspect ratio }
  19.       GetAspectRatio(ixar,iyar) ;
  20.       iar := SwapLong(longint(ixar)) div longint(iyar) ;
  21.                                 { prescale and offset }
  22.       ix := SwapLong(r shl 6 + idr) ;
  23.       iy := 0 ;
  24.                                 { starting position }
  25.       ix0 := RoundScaleB6(LongHi(ix)) ;
  26.       iy0 := 0 ;
  27.       MoveTo(xc+ix0,yc) ;
  28.                                 { circle }
  29.       for ida := 1 to 49 do begin
  30.                                 { rotate coordinates }
  31.          it :=  (-ix div 16 - iy) div 8  + ix ;
  32.          iy :=  (-iy div 16 + ix) div 8  + iy ;
  33.          ix := it ;
  34.                                 { apply aspect and scale B0 }
  35.          ix1 := RoundScaleB6(LongHi(ix)) ;
  36.          iy1 := RoundScaleB6(LongHi(LongHi(iy) * iar)) ;
  37.          LineTo(xc+ix1,yc+iy1)
  38.  
  39.       end ;
  40.                                 { closure }
  41.       LineTo(xc+ix0,yc+iy0)
  42.  
  43.    end
  44. end ;
  45.  
  46. { Copyright (C) 1989 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
  47.