1 /*-
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.proprietary.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)circle.c 8.1 (Berkeley) 06/04/93";
10 #endif /* not lint */
11
12 #include "hp2648.h"
13
circle(xc,yc,r)14 circle (xc,yc,r)
15 int xc,yc,r;
16 {
17 double costheta,sintheta,x,y,xn;
18 int xi,yi;
19
20 if(r<1){
21 point(xc,yc);
22 return;
23 }
24 sintheta = 1.0/r;
25 costheta = pow(1-sintheta*sintheta,0.5);
26 xi = x = r;
27 yi = y = 0;
28 do {
29 point(xc+xi,yc+yi);
30 xn = x;
31 xi = x = x*costheta + y*sintheta;
32 yi = y = y*costheta - xn*sintheta;
33 } while( ! (yi==0 && xi >= r-1));
34 }
35