#include "graphics.hh"
#include "parameter.hh"
-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> 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",
- 0., M_PI/8., -M_PI*2., M_PI*2.);
-static Parameter<double> scale("scale", "Scale factor for resulting object",
- 1.0, 0.25, 0.001, 1000.);
-static Parameter<double> planedistance("plane",
- "Distance from projection plane to origin",
- 4., .25, 0., 100.);
-static Parameter<double> eyedistance("eye", "Distance from projection eye to origin",
- 1.5, .25, 0., 100.);
-static Parameter<double> cutoffdistance("cutoff",
- "Distance from projection cutoff to origin",
- 10., .25, -10., 100.);
-static Parameter<double> width("width", "Width of the `strip' before transformation",
- .4, .1, 0., 1.);
-static Parameter<double> thickness("thick", "Thickness of the `pancake'", 1., .1, 0., 1.);
-static Parameter<double> bottomportion("bp", "Proportion in the bottom half",
- .7, .1, 0., 1.);
-static Parameter<double> tear("tear", "Angle factor in tear-open",
- 0/*1.1*/, .1, -5., 5.);
-static Parameter<double> teary("teary", "Axis y coord in tear-open", 1.3, .1, -10., 10.);
-static Parameter<double> twist("twist", "Angle per length in twist",
- 0/*.8*/, .25, -5., 5.);
-static Parameter<double> twisty("twisty", "Axis y coord in twist", .85, .1, -10., 10.);
-static Parameter<double> bulge("bulge", "Amount of bulge", 0/*1.*/, .25, -15., 15.);
-static Parameter<double> bulgesd("bulgesd", "S.D. of bulge", 1., .2, .000001, 20.);
-static Parameter<double> bulgey("bulgey", "Axis y coord in bulge", .85, .1, -10., 10.);
-static Parameter<double> shearx("shearx", "Amount of shear (x)", 0., .1, -15., 15.);
-static Parameter<double> sheary("sheary", "Amount of shear (y)", 0/*1.*/, .1, -15., 15.);
-static Parameter<double> shearsdx("shearsdx", "S.D. of shear (x)", .5, .1, -15., 15.);
-static Parameter<double> shearsdy("shearsdy", "S.D. of shear (y)", .5, .1, -15., 15.);
-static Parameter<double> shearey("shearey", "Centre of shear (y)", 1.3, .1, -10., 10.);
+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>
+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",
+ 0., M_PI/8., -M_PI*2., M_PI*2.);
+
+static Parameter<double>
+scale("scale", "Scale factor for resulting object", 1.0, 0.25, 0.001, 1000.);
+
+static Parameter<double>
+planedistance("plane", "Distance from projection plane to origin",
+ 4., .25, 0., 100.);
+
+static Parameter<double>
+eyedistance("eye", "Distance from projection eye to origin",
+ 1.5, .25, 0., 100.);
+
+static Parameter<double>
+cutoffdistance("cutoff", "Distance from projection cutoff to origin",
+ 10., .25, -10., 100.);
+
+static Parameter<double>
+width("width", "Width of the `strip' before transformation", .4, .1, 0., 1.);
+
+static Parameter<double>
+thickness("thick", "Thickness of the `pancake'", 1., .1, 0., 1.);
+
+static Parameter<double>
+bottomportion("bp", "Proportion in the bottom half", .7, .1, 0., 1.);
+
+static Parameter<double>
+tear("tear", "Angle factor in tear-open", 0/*1.1*/, .1, -5., 5.);
+
+static Parameter<double>
+teary("teary", "Axis y coord in tear-open", 1.3, .1, -10., 10.);
+
+static Parameter<double>
+twist("twist", "Angle per length in twist", 0/*.8*/, .25, -5., 5.);
+
+static Parameter<double>
+twisty("twisty", "Axis y coord in twist", .85, .1, -10., 10.);
+
+static Parameter<double>
+bulge("bulge", "Amount of bulge", 0/*1.*/, .25, -15., 15.);
+
+static Parameter<double>
+bulgesd("bulgesd", "S.D. of bulge", 1., .2, .000001, 20.);
+
+static Parameter<double>
+bulgey("bulgey", "Axis y coord in bulge", .85, .1, -10., 10.);
+
+static Parameter<double>
+shearx("shearx", "Amount of shear (x)", 0., .1, -15., 15.);
+
+static Parameter<double>
+sheary("sheary", "Amount of shear (y)", 0/*1.*/, .1, -15., 15.);
+
+static Parameter<double>
+shearsdx("shearsdx", "S.D. of shear (x)", .5, .1, -15., 15.);
+
+static Parameter<double>
+shearsdy("shearsdy", "S.D. of shear (y)", .5, .1, -15., 15.);
+
+static Parameter<double>
+shearey("shearey", "Centre of shear (y)", 1.3, .1, -10., 10.);
+
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;
}
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);
if (x11) list->display(*x11);
if (dualx11) list->display(*dualx11);
for (;;) {
+ cerr << "> ";
cin.getline(buf,sizeof(buf),'\n');
if (!cin.good()) {
cerr << "error reading command input, giving up\n";
} else if (!strcmp(buf,"quit")) {
exit(0);
} else if (!strcmp(buf,"list")) {
+ 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 {