1*19975Sdist /* 2*19975Sdist * Copyright (c) 1980 Regents of the University of California. 3*19975Sdist * All rights reserved. The Berkeley software License Agreement 4*19975Sdist * specifies the terms and conditions for redistribution. 5*19975Sdist */ 6*19975Sdist 715446Sralph #ifndef lint 8*19975Sdist static char sccsid[] = "@(#)circle.c 5.1 (Berkeley) 05/07/85"; 9*19975Sdist #endif not lint 1015446Sralph 1115446Sralph #include "hp2648.h" 1215446Sralph 1315446Sralph circle (xc,yc,r) 1415446Sralph int xc,yc,r; 1515446Sralph { 1615446Sralph double costheta,sintheta,x,y,xn; 1715446Sralph int xi,yi; 1815446Sralph 1915446Sralph if(r<1){ 2015446Sralph point(xc,yc); 2115446Sralph return; 2215446Sralph } 2315446Sralph sintheta = 1.0/r; 2415446Sralph costheta = pow(1-sintheta*sintheta,0.5); 2515446Sralph xi = x = r; 2615446Sralph yi = y = 0; 2715446Sralph do { 2815446Sralph point(xc+xi,yc+yi); 2915446Sralph xn = x; 3015446Sralph xi = x = x*costheta + y*sintheta; 3115446Sralph yi = y = y*costheta - xn*sintheta; 3215446Sralph } while( ! (yi==0 && xi >= r-1)); 3315446Sralph } 34