home *** CD-ROM | disk | FTP | other *** search
- { Copyright (C) 1989 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
-
- procedure StrokeCircle ( xc, yc : integer ; r : word ) ;
-
- { CircRA - draw circle using rotation angle method }
-
- var
- ixar,iyar : word ; { aspect ratio parameters }
- ar : single ; { aspect ratio }
- da,cosda,sinda : single ; { step angle and functions }
- ida,nda : integer ; { loop control }
- t,x,y : single ; { coordinate variables }
-
- begin
- { aspect ratio }
- GetAspectRatio(ixar,iyar) ;
- ar := ixar/iyar ;
- { step angle and functions }
- da := 2.0 * sqrt(1.0/r) ;
- nda := Round(2.0 * Pi / da) ;
- if Odd(nda) then Inc(nda) ;
- da := 2.0 * Pi / nda ;
- cosda := cos(da) ;
- sinda := sin(da) ;
- { starting point with offset }
- x := r + dr ;
- y := 0.0 ;
- MoveTo(xc+Round(x),yc) ;
- { circle }
- for ida := 1 to nda do begin
- { rotate coordinates }
- t := x * cosda - y * sinda ;
- y := x * sinda + y * cosda ;
- x := t ;
- { apply aspect ratio }
- LineTo(xc+Round(x),yc+Round(y*ar))
-
- end
- end ;
-
- { Copyright (C) 1989 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }