X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctgraphics%2Fcircle.cpp;fp=libctgraphics%2Fcircle.cpp;h=0000000000000000000000000000000000000000;hb=37ccf79b1044c04db41f5cf924f63c75be1c2366;hp=5c74deeb7a0016dc6a095309de3f796900b854ed;hpb=8c23e6b9615942ac464414b788c5f68b7f66e39d;p=ctsim.git diff --git a/libctgraphics/circle.cpp b/libctgraphics/circle.cpp deleted file mode 100644 index 5c74dee..0000000 --- a/libctgraphics/circle.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** -** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg -** -** $Id: circle.cpp,v 1.2 2000/06/19 19:04:05 kevin Exp $ -** $Log: circle.cpp,v $ -** Revision 1.2 2000/06/19 19:04:05 kevin -** reorganized header files -** -** Revision 1.1 2000/06/19 18:05:03 kevin -** initial cvs import -** -** Revision 1.1 2000/06/13 16:20:31 kevin -** finished c++ conversions -** -** Revision 1.2 2000/05/24 22:49:01 kevin -** Updated SGP: first function X-windows version -** -** Revision 1.1.1.1 2000/04/28 13:02:44 kevin -** Initial CVS import for first public release -** -** -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License (version 2) as -** published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -******************************************************************************/ - -/* FUNCTION - * sgp2_circle - draw circle of radius r at current center - */ - -#include "math.h" -#include "ctsupport.h" -#include "sgp.h" - -void -sgp2_draw_circle (const double r) -{ - sgp2_draw_arc (0.0, 7.0, r); -} - -/*==============================================================*/ -/* draw arc around current center. pass angles and radius */ -/*==============================================================*/ - -void -sgp2_draw_arc (double start, double stop, const double r) -{ - double c, s, theta, angle; - float x, y, xp, yp; - - if ((stop-start) > 2 * PI) - stop = start + 2 * PI; - if ((start-stop) > 2 * PI) - stop = start + 2 * PI; - while (start >= stop) - stop += 2*PI; - - x = r * cos ((double) start); - y = r * sin ((double) start); - sgp2_move_rel (x, y); /* move from center to start of arc */ - - theta = 5 * PI / 180; - c = cos(theta); - s = sin(theta); - - for (angle = start; angle < stop - theta; angle += theta) { - xp = c * x - s * y; - yp = s * x + c * y; - sgp2_line_rel (xp - x, yp - y); - x = xp; y = yp; - } - - c = cos (stop - angle); - s = sin (stop - angle); - xp = c * x - s * y; - yp = s * x + c * y; - sgp2_line_rel (xp - x, yp - y); - - x = r * cos ((double) stop); - y = r * sin ((double) stop); - sgp2_move_rel (-x, -y); /* move back to center of circle */ -}