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",
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;
// The first end is oriented towards [0,cos(theta),sin(theta)]
// The second end is oriented towards [0,-1,0]
-Point MoebiusEnfoldment::edgepoint(double t) {
+Point MoebiusEnfoldmentAny::edgepoint(double t) {
double theta= t*2.0*M_PI;
return Point(sin(theta),cos(theta),0);
}
return Point( bx(t), by(t), thickness * bz(t) );
}
}
+
+Point MoebiusEnfoldmentNew::middlepoint(double t, double u) {
+ if (u <= 0.5) {
+ if (t <= 0.5) {
+ double sin_pi_t= sin(M_PI*t);
+ double cos_pi_t= cos(M_PI*t);
+ double sin_2pi_t= sin(2.0*M_PI*t);
+ double cos_2pi_t= cos(2.0*M_PI*t);
+
+ double prop_circ= 0.5+0.5*cos(2.0*M_PI*u);
+ // double prop_circ= 1.0-2.0*u;
+
+ Point p_edge(-sin_pi_t,cos_pi_t,0);
+
+ double alpha_circ= (2.0*M_PI)*(2.0*t)*(2.0*u);
+ Point v_edge1(cos_2pi_t*sin_pi_t,-cos_2pi_t*cos_pi_t,sin_2pi_t);
+ Point v_edge2(sin_2pi_t*cos_pi_t,-sin_2pi_t*sin_pi_t,-cos_2pi_t);
+ Point p_circ_cent= p_edge + v_edge2*(2.0*t);
+ Point p_circ_pt= p_circ_cent + (v_edge1*sin(alpha_circ) + v_edge2*-cos(alpha_circ))*(2.0*t);
+ p_circ_pt[1]= p_edge[1];
+
+ Point v_line(-cos_pi_t,0,sin_pi_t);
+ Point p_line_start(0,1.0-2.0*t,0);
+ Point p_line_pt= p_line_start + v_line*(1.0-2.0*u)*(M_PI*t);
+
+ return p_circ_pt*prop_circ + p_line_pt*(1.0-prop_circ);
+ } else {
+ return middlepoint(0.5,u) + Point(0,0.5-t,0);
+ }
+ } else {
+ Point p_mirror= middlepoint(t,1.0-u);
+ return Point(-p_mirror[0], p_mirror[1], -p_mirror[2]);
+ }
+}
Point middlepoint(double t, double u);
};
-class MoebiusEnfoldment : public Moebius {
+class MoebiusEnfoldmentAny : public Moebius {
+public:
+ Point edgepoint(double t);
+};
+
+class MoebiusEnfoldment : public MoebiusEnfoldmentAny {
double thickness;
double bottomportion;
public:
MoebiusEnfoldment(double t=.35, double bp=.5) { thickness= t; bottomportion= bp; }
-
- Point edgepoint(double t);
+ Point middlepoint(double t, double u);
+};
+
+class MoebiusEnfoldmentNew : public MoebiusEnfoldmentAny {
+public:
+ MoebiusEnfoldmentNew() { }
Point middlepoint(double t, double u);
};