X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius.git;a=blobdiff_plain;f=main.cc;h=645d93a568db6c4df3907f622413631f9e62ca1b;hp=5a35b453737d4543413ca6793a331c0a8ff4f00b;hb=3341494a1fe1979641c49c65c7f09319b9eca659;hpb=b79a06937e1c65161f8e71fb48f30e7b473da023 diff --git a/main.cc b/main.cc index 5a35b45..645d93a 100644 --- a/main.cc +++ b/main.cc @@ -101,9 +101,11 @@ SortedCellList *list=0; X11Output *x11= 0; DualX11Output *dualx11= 0; +static Moebius *strip= 0; + void generate() { if (list) delete list; - Moebius *strip; + if (strip) { delete strip; strip= 0; } switch (version) { case 0: strip= new MoebiusStrip(width); break; case 1: strip= new MoebiusEnfoldment(thickness,bottomportion); break; @@ -130,11 +132,12 @@ void generate() { } t0= t1; } - delete strip; } int main(int argc, char **argv) { + static const char pointmap_cmd[]= "pointmap "; char buf[100]; + double pointmap_t, pointmap_u; for (;;) { Point::setobserver(theta,eta,planedistance,eyedistance,cutoffdistance); @@ -200,6 +203,15 @@ int main(int argc, char **argv) { AnyParameter::help(); } else if (!strcmp(buf,"help")) { AnyParameter::list(); + } else if (!strncmp(buf,pointmap_cmd,sizeof(pointmap_cmd)-1)) { + if (sscanf(buf+sizeof(pointmap_cmd)-1, "%lf %lf", + &pointmap_t, &pointmap_u) != 2) { + cerr << "failed to parse pointmap args\n"; + continue; + } + Point p= strip->middlepoint(pointmap_t,pointmap_u); + cout << "\n"; + for (int i=0; i<3; i++) cout << p.halftransformed()[i] << "\n"; } else if (!*buf) { break; } else {