1*48517Sbostic /*- 2*48517Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*48517Sbostic * All rights reserved. 4*48517Sbostic * 5*48517Sbostic * %sccs.include.proprietary.c% 619975Sdist */ 719975Sdist 815446Sralph #ifndef lint 9*48517Sbostic static char sccsid[] = "@(#)circle.c 5.2 (Berkeley) 04/22/91"; 10*48517Sbostic #endif /* not lint */ 1115446Sralph 1215446Sralph #include "hp2648.h" 1315446Sralph 1415446Sralph circle (xc,yc,r) 1515446Sralph int xc,yc,r; 1615446Sralph { 1715446Sralph double costheta,sintheta,x,y,xn; 1815446Sralph int xi,yi; 1915446Sralph 2015446Sralph if(r<1){ 2115446Sralph point(xc,yc); 2215446Sralph return; 2315446Sralph } 2415446Sralph sintheta = 1.0/r; 2515446Sralph costheta = pow(1-sintheta*sintheta,0.5); 2615446Sralph xi = x = r; 2715446Sralph yi = y = 0; 2815446Sralph do { 2915446Sralph point(xc+xi,yc+yi); 3015446Sralph xn = x; 3115446Sralph xi = x = x*costheta + y*sintheta; 3215446Sralph yi = y = y*costheta - xn*sintheta; 3315446Sralph } while( ! (yi==0 && xi >= r-1)); 3415446Sralph } 35