Commit | Line | Data |
---|---|---|
89996944 RC |
1 | #ifndef lint |
2 | static char sccsid[] = "@(#)circle.c 4.1 (Berkeley) %G%"; | |
3 | #endif | |
4 | ||
5 | #include "hp2648.h" | |
6 | ||
7 | circle (xc,yc,r) | |
8 | int xc,yc,r; | |
9 | { | |
10 | double costheta,sintheta,x,y,xn; | |
11 | int xi,yi; | |
12 | ||
13 | if(r<1){ | |
14 | point(xc,yc); | |
15 | return; | |
16 | } | |
17 | sintheta = 1.0/r; | |
18 | costheta = pow(1-sintheta*sintheta,0.5); | |
19 | xi = x = r; | |
20 | yi = y = 0; | |
21 | do { | |
22 | point(xc+xi,yc+yi); | |
23 | xn = x; | |
24 | xi = x = x*costheta + y*sintheta; | |
25 | yi = y = y*costheta - xn*sintheta; | |
26 | } while( ! (yi==0 && xi >= r-1)); | |
27 | } |