r163: *** empty log message ***
[ctsim.git] / tools / if-2.cpp
index 2558360f32341352d12a4ab612fbc93ae4405d76..9fee32a01286ede9aeb9783f203fa985003a1b89 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if-2.cpp,v 1.2 2000/07/28 08:28:08 kevin Exp $
+**  $Id: if-2.cpp,v 1.3 2000/07/28 10:51:31 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
@@ -79,7 +79,7 @@ if2_main (int argc, char *const argv[])
   int opt_sub = 0;
   int opt_mul = 0;
   int opt_comp = 0;
-  int opt_outputFile = 0;
+  bool opt_outputFile = false;
   int opt_rowPlot = -1;
   int opt_columnPlot = -1;
   Timer timerProgram;
@@ -94,26 +94,28 @@ if2_main (int argc, char *const argv[])
     switch (c) {
     case O_ADD:
       opt_add = 1;
-      opt_outputFile = 1;
+      opt_outputFile = true;
       break;
     case O_SUB :
       opt_sub = 1;
-      opt_outputFile = 1;
+      opt_outputFile = true;
       break;
     case O_MUL:
       opt_mul = 1;
-      opt_outputFile = 1;
+      opt_outputFile = true;
       break;
     case O_ROW_PLOT:
       opt_rowPlot = strtol(optarg, &endptr, 10);
       if (endptr != optarg + strlen(optarg)) {
        if2_usage(argv[0]);
       }
+      break;
     case O_COLUMN_PLOT:
       opt_columnPlot = strtol(optarg, &endptr, 10);
       if (endptr != optarg + strlen(optarg)) {
        if2_usage(argv[0]);
       }
+      break;
     case O_COMP:
       opt_comp = 1;
       break;
@@ -231,15 +233,16 @@ if2_main (int argc, char *const argv[])
     SGPDriver driver ("Column Plot");
     SGP sgp (driver);
     EZPlot ezplot (sgp);
-    ezplot.ezset  ("clear.");
-    ezplot.ezset  ("xticks major 5.");
-    ezplot.ezset  ("xlabel Column");
-    ezplot.ezset  ("ylabel Pixel");
-    ezplot.ezset ("curves 2");
-    ezplot.ezset  ("box.");
-    ezplot.ezset  ("grid.");
-    ezplot.addCurve (v1[opt_columnPlot], plot_xaxis, im_in1.ny());
-    ezplot.addCurve (v2[opt_columnPlot], plot_xaxis, im_in2.ny());
+    ezplot.ezset ("clear.");
+    ezplot.ezset ("xticks major 5.");
+    ezplot.ezset ("xlabel Column");
+    ezplot.ezset ("title Column Plot");
+    ezplot.ezset ("ylabel Pixel");
+    ezplot.ezset ("box.");
+    ezplot.ezset ("grid.");
+    ezplot.addCurve (plot_xaxis, v1[opt_columnPlot], im_in1.ny());
+    ezplot.addCurve (plot_xaxis, v2[opt_columnPlot], im_in2.ny());
+    ezplot.plot();
     cout << "Press enter to continue" << flush;
     cio_kb_getc();
 #endif
@@ -256,23 +259,24 @@ if2_main (int argc, char *const argv[])
     for (int i = 0; i < ny; i++)
       plot_xaxis[i] = i;
     for (int i = 0; i < nx; i++)
-      v1Row[i] = v1[opt_rowPlot][i];
+      v1Row[i] = v1[i][opt_rowPlot];
     for (int i = 0; i < nx2; i++)
-      v2Row[i] = v2[opt_rowPlot][i];
+      v2Row[i] = v2[i][opt_rowPlot];
 
 #if HAVE_SGP
-    SGPDriver driver ("Column Plot");
+    SGPDriver driver ("Row Plot");
     SGP sgp (driver);
     EZPlot ezplot (sgp);
-    ezplot.ezset  ("clear.");
-    ezplot.ezset  ("xticks major 5.");
-    ezplot.ezset  ("xlabel Column");
-    ezplot.ezset  ("ylabel Pixel");
-    ezplot.ezset ("curves 2");
-    ezplot.ezset  ("box.");
-    ezplot.ezset  ("grid.");
-    ezplot.addCurve (v1Row, plot_xaxis, im_in1.nx());
-    ezplot.addCurve (v2Row, plot_xaxis, im_in2.nx());
+    ezplot.ezset ("clear.");
+    ezplot.ezset ("xticks major 5.");
+    ezplot.ezset ("title Row Plot");
+    ezplot.ezset ("xlabel Row");
+    ezplot.ezset ("ylabel Pixel");
+    ezplot.ezset ("box.");
+    ezplot.ezset ("grid.");
+    ezplot.addCurve (plot_xaxis, v1Row, im_in1.nx());
+    ezplot.addCurve (plot_xaxis, v2Row, im_in2.nx());
+    ezplot.plot();
     cout << "Press enter to continue" << flush;
     cio_kb_getc();
 #endif