X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctgraphics%2Fezplot.cpp;h=05ca13fbf856b7c07656734183b226065a4a79d2;hp=73db34d6a4d34efb80e169c5fd636d24ce74eaf0;hb=3fba6928127cd65870bdcd96c8114ad5894247ae;hpb=bf7295a63667dcca309389ee6dd5328a3a25f22b diff --git a/libctgraphics/ezplot.cpp b/libctgraphics/ezplot.cpp index 73db34d..05ca13f 100644 --- a/libctgraphics/ezplot.cpp +++ b/libctgraphics/ezplot.cpp @@ -1,8 +1,12 @@ /***************************************************************************** +** FILE IDENTIFICATION +** +** EZPLOT +** ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ezplot.cpp,v 1.1 2000/06/19 18:05:03 kevin Exp $ +** $Id: ezplot.cpp,v 1.5 2000/07/13 07:03:21 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 @@ -17,18 +21,15 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ -/*----------------------------------------------------------------------*/ -/* EZPLOT */ -/*----------------------------------------------------------------------*/ #include "ezplot.h" #include "algo.h" + static int plot (SGP_ID *gid); static void drawaxis(void); static void symbol (int sym, double symwidth, double symheight); - /*-------------------------------------*/ /* GLOBAL variables for EZPLOT & EZSET */ /*-------------------------------------*/ @@ -98,8 +99,8 @@ static int y_fldwid, y_frac; /* in fraction of number, used for printf() */ static double xtl_wid, ytl_wid; /* length of ticks labels in NDC */ static double tl_height; /* height of tick labels in NDC */ -static char x_numfmt[10]; /* format to print x tick labels */ -static char y_numfmt[10]; /* format to print y tick labels */ +static char x_numfmt[20]; /* format to print x tick labels */ +static char y_numfmt[20]; /* format to print y tick labels */ /*---------------------------------------------------------------------- @@ -122,10 +123,22 @@ static char y_numfmt[10]; /* format to print y tick labels */ *----------------------------------------------------------------------*/ +SGP_ID +ezplot (float x[], double y[], int num) +{ + double dx [num]; + + for (int i = 0; i < num; i++) + dx[i] = x[i]; + + return ezplot (dx, y, num); +} + + SGP_ID ezplot (double x[], double y[], int num) { - unsigned int size, i; + unsigned int size; SGP_ID gid = NULL; if (ez.i_plotimmediate == TRUE) { @@ -147,7 +160,7 @@ ezplot (double x[], double y[], int num) size = num * sizeof(double); ez.curve[ez.i_numcurves].x = new double [size]; ez.curve[ez.i_numcurves].y = new double [size]; - for (i = 0; i < num; i++) { + for (int i = 0; i < num; i++) { ez.curve[ez.i_numcurves].x[i] = x[i]; ez.curve[ez.i_numcurves].y[i] = y[i]; } @@ -898,10 +911,7 @@ void ezinit(void) void ezfree(void) { - static char errmsg[] = "EZFREE in EZPLOT"; - int i; - - for (i = 0; i < ez.i_numcurves; i++) { + for (int i = 0; i < ez.i_numcurves; i++) { delete ez.curve[i].x; delete ez.curve[i].y; }