From 37ccf79b1044c04db41f5cf924f63c75be1c2366 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Mon, 19 Jun 2000 19:20:11 +0000 Subject: [PATCH] r112: *** empty log message *** --- libctgraphics/Makefile.am | 2 +- libctgraphics/circle.cpp | 93 ------------------- libctgraphics/drawbox.cpp | 44 --------- libctgraphics/sgp.cpp | 79 +++++++++++++++- libctgraphics/{sgpdrive.cpp => sgpdriver.cpp} | 2 +- 5 files changed, 80 insertions(+), 140 deletions(-) delete mode 100644 libctgraphics/circle.cpp delete mode 100644 libctgraphics/drawbox.cpp rename libctgraphics/{sgpdrive.cpp => sgpdriver.cpp} (99%) diff --git a/libctgraphics/Makefile.am b/libctgraphics/Makefile.am index 7bc2d47..5daeb60 100644 --- a/libctgraphics/Makefile.am +++ b/libctgraphics/Makefile.am @@ -1,5 +1,5 @@ noinst_LIBRARIES = libctgraphics.a -libctgraphics_a_SOURCES=ezplot.cpp ezsupport.cpp ezset.cpp ezpol.cpp circle.cpp ctm.cpp drawbox.cpp sgp.cpp sgpdrive.cpp sgptext.cpp +libctgraphics_a_SOURCES=ezplot.cpp ezsupport.cpp ezset.cpp ezpol.cpp ctm.cpp sgp.cpp sgpdriver.cpp sgptext.cpp INCLUDES=@my_includes@ EXTRA_DIST=Makefile.nt 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 */ -} diff --git a/libctgraphics/drawbox.cpp b/libctgraphics/drawbox.cpp deleted file mode 100644 index f0bc899..0000000 --- a/libctgraphics/drawbox.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** -** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg -** -** $Id: drawbox.cpp,v 1.2 2000/06/19 19:04:05 kevin Exp $ -** -** 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 -******************************************************************************/ - -/* NAME - * sgp2_draw_rect Draw box in graphics mode - * - * SYNOPSIS - * drawbox (xmin, ymin, xmax, ymax) - * double xmin, ymin Lower left corner of box - * double xmax, ymax Upper left corner of box - * - * NOTES - * This routine leaves the current position of graphic cursor at lower - * left corner of box. - */ - -#include "sgp.h" - -void -sgp2_draw_rect(double xmin, double ymin, double xmax, double ymax) -{ - sgp2_move_abs (xmin, ymin); - sgp2_line_abs (xmax, ymin); - sgp2_line_abs (xmax, ymax); - sgp2_line_abs (xmin, ymax); - sgp2_line_abs (xmin, ymin); -} diff --git a/libctgraphics/sgp.cpp b/libctgraphics/sgp.cpp index 55d3c0e..cc87671 100644 --- a/libctgraphics/sgp.cpp +++ b/libctgraphics/sgp.cpp @@ -7,7 +7,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sgp.cpp,v 1.2 2000/06/19 19:04:05 kevin Exp $ +** $Id: sgp.cpp,v 1.3 2000/06/19 19:16:17 kevin Exp $ ** ** 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 @@ -448,6 +448,83 @@ sgp2_point_rel (double x, double y) } +/* NAME + * sgp2_draw_rect Draw box in graphics mode + * + * SYNOPSIS + * drawbox (xmin, ymin, xmax, ymax) + * double xmin, ymin Lower left corner of box + * double xmax, ymax Upper left corner of box + * + * NOTES + * This routine leaves the current position of graphic cursor at lower + * left corner of box. + */ + +void +sgp2_draw_rect(double xmin, double ymin, double xmax, double ymax) +{ + sgp2_move_abs (xmin, ymin); + sgp2_line_abs (xmax, ymin); + sgp2_line_abs (xmax, ymax); + sgp2_line_abs (xmin, ymax); + sgp2_line_abs (xmin, ymin); +} + +/* FUNCTION + * sgp2_circle - draw circle of radius r at current center + */ + +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 */ +} + + /*----------------------------------------------------------------------*/ /* Current Transformation Matrix Routine */ /*----------------------------------------------------------------------*/ diff --git a/libctgraphics/sgpdrive.cpp b/libctgraphics/sgpdriver.cpp similarity index 99% rename from libctgraphics/sgpdrive.cpp rename to libctgraphics/sgpdriver.cpp index 09445ba..76e08ef 100644 --- a/libctgraphics/sgpdrive.cpp +++ b/libctgraphics/sgpdriver.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sgpdrive.cpp,v 1.3 2000/06/19 19:04:05 kevin Exp $ +** $Id: sgpdriver.cpp,v 1.1 2000/06/19 19:20:11 kevin Exp $ ** ** 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 -- 2.34.1