chiark / gitweb /
Use XAllocNamedColor instead of assuming that pixels 0 and 1 are sensible (!)
[moebius.git] / main.cc
diff --git a/main.cc b/main.cc
index be3b53043fc73e9880e14b99c596ed70afa7c127..fbacbfb985846c958f9c517beab2c3b762d099b4 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -20,7 +20,9 @@
 
 static Parameter<int> tn("tn", "Number of sections around `strip'", 30, 1, 1, 500);
 static Parameter<int> un("un", "Number of sections across `strip'", 15, 1, 1, 500);
-static Parameter<int> orig("orig", "Use original strip (not reformulated)", 1, 0, 0, 1);
+static Parameter<int> version("version",
+                             "Version to use: 0=original strip, 1=reformulated,"
+                             " 2=reformulated again", 0, 1, 0, 2);
 static Parameter<double> theta("theta", "Angle of model rotation",
                               /*-PI/2.*/0, M_PI/8., -M_PI*2., M_PI*2.);
 static Parameter<double> eta("eta", "Angle of model elevation",
@@ -62,10 +64,11 @@ DualX11Output *dualx11= 0;
 void generate() {
   if (list) delete list;
   Moebius *strip;
-  if (orig) {
-    strip= new MoebiusStrip(width);
-  } else {
-    strip= new MoebiusEnfoldment(thickness,bottomportion);
+  switch (version) {
+  case 0: strip= new MoebiusStrip(width);                           break;
+  case 1: strip= new MoebiusEnfoldment(thickness,bottomportion);    break;
+  case 2: strip= new MoebiusEnfoldmentNew();                        break;
+  default: abort();
   }
   list= new SortedCellList;
   double t0= 0.0;
@@ -108,10 +111,9 @@ int main(int argc, char **argv) {
     if (x11) list->display(*x11);
     if (dualx11) list->display(*dualx11);
     for (;;) {
-      cin.get(buf,100,'\n');
-      char c;
-      if (!cin.get(c) || c!='\n') {
-        cerr << "error reading command input, giving up\n";
+      cin.getline(buf,sizeof(buf),'\n');
+      if (!cin.good()) {
+       cerr << "error reading command input, giving up\n";
         exit(1);
       }
       char *equals= strchr(buf,'=');