From 89996944e98eb69e7b1683e3fce56797688d82c7 Mon Sep 17 00:00:00 2001 From: Ralph Campbell Date: Thu, 10 Nov 1983 22:12:33 -0800 Subject: [PATCH] date and time created 83/11/10 14:12:33 by ralph SCCS-vsn: lib/libplot/hp2648/circle.c 4.1 --- usr/src/lib/libplot/hp2648/circle.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 usr/src/lib/libplot/hp2648/circle.c diff --git a/usr/src/lib/libplot/hp2648/circle.c b/usr/src/lib/libplot/hp2648/circle.c new file mode 100644 index 0000000000..702361198d --- /dev/null +++ b/usr/src/lib/libplot/hp2648/circle.c @@ -0,0 +1,27 @@ +#ifndef lint +static char sccsid[] = "@(#)circle.c 4.1 (Berkeley) %G%"; +#endif + +#include "hp2648.h" + +circle (xc,yc,r) +int xc,yc,r; +{ + double costheta,sintheta,x,y,xn; + int xi,yi; + + if(r<1){ + point(xc,yc); + return; + } + sintheta = 1.0/r; + costheta = pow(1-sintheta*sintheta,0.5); + xi = x = r; + yi = y = 0; + do { + point(xc+xi,yc+yi); + xn = x; + xi = x = x*costheta + y*sintheta; + yi = y = y*costheta - xn*sintheta; + } while( ! (yi==0 && xi >= r-1)); +} -- 2.20.1