/* Program: TempTabl.C */ /* Purpose: Generates a table of dimensions for makeing the envelope */ /* template. */ #include #include #define PI2 6.283185307 #define SECTIONS 10.0 double _h, _l, _x1; double x, y, ox, oy, oxo, oyo, step, increment, xp, dx, r, x2; double y_ellipse(double); double y_parabola(double); double y_ellipse(x) double x; { return(_h * sqrt(1 - x * x / (_l * _l))); } double y_parabola(x) double x; { return(_h * sqrt(1 + _x1 * _x1 / (_l * _l) - 2 * _x1 * x / (_l * _l))); } main() { _h = 103.0; _l = 250.0; _x1 = 97.4; x2 = (_l * _l + _x1 * _x1) / (2 * _x1); step = 0.001; increment = 10.0000; xp = 0.0; x = -_l; ox = -_l; oy = 0.0; dx = 0.0; y = 0.0; do { oxo = x; oyo = y_ellipse(x); xp += dx; r = y * PI2 / SECTIONS; printf("x = %3.1lf r = %3.1lf d = %3.1lf\n",xp,r,2.0 * r); dx = 0.0; do { y = y_ellipse(x); dx += sqrt((x-ox) * (x-ox) + (y-oy) * (y-oy)); ox = x; x += step; oy = y; } while(dx < increment); } while(x <= _x1); x = oxo; ox = oxo; oy = oyo; do { oxo = x; oyo = y_parabola(x); xp += dx; r = y * PI2 / SECTIONS; printf("x = %3.1lf r = %3.1lf d = %3.1lf\n",xp,r,2.0 * r); dx = 0.0; do { y = y_parabola(x); dx += sqrt((x-ox) * (x-ox) + (y-oy) * (y-oy)); ox = x; x += step; oy = y; } while((dx < increment) && (x <= x2)); } while(x <= x2); xp += dx; printf("x = %3.1lf w = %3.1lf\n",xp,0.0); }