-/* Make a revolved piece */
-void revolve_line(double *trace_r, double *trace_h, double max_iheight,
- int rot, int wire) {
- double theta, norm_theta, sin_theta, cos_theta;
- double norm_ptheta = 0.0, sin_ptheta = 0.0, cos_ptheta = 1.0;
- double radius, pradius;
- double max_height = max_iheight, height, pheight;
- double dx, dy, len;
- int npoints, p;
- double dtheta = (2.0*M_PI) / rot;
-
- /* Get the number of points */
- for(npoints = 0;
- fabs(trace_r[npoints]) > EPSILON || fabs(trace_h[npoints]) > EPSILON;
- ++npoints);
-
- /* If less than two points, can not revolve */
- if(npoints < 2)
- return;
-
- /* If the max_height hasn't been defined, find it */
- if(max_height < EPSILON)
- for(p = 0; p < npoints; ++p)
- if(max_height < trace_h[p])
- max_height = trace_h[p];
-
- /* Draw the revolution */
- for(theta = dtheta; rot > 0; --rot) {
- sin_theta = sin(theta);
- cos_theta = cos(theta);
- norm_theta = theta / (2.0 * M_PI);
- pradius = trace_r[0] * piece_size;
- pheight = trace_h[0] * piece_size;
-
- for(p = 0; p < npoints; ++p) {
- radius = trace_r[p] * piece_size;
- height = trace_h[p] * piece_size;
-
- /* Get the normalized lengths of the normal vector */
- dx = radius - pradius;
- dy = height - pheight;
- len = sqrt(dx*dx + dy*dy);
- dx /= len;
- dy /= len;
-
- /* If only triangles required */
- if (fabs(radius) < EPSILON) {
- glBegin(wire ? GL_LINE_LOOP : GL_TRIANGLES);
-
- glNormal3f(dy * sin_ptheta, -dx, dy * cos_ptheta);
- glTexCoord2f(norm_ptheta, pheight / max_height);
- glVertex3f(pradius * sin_ptheta, pheight, pradius * cos_ptheta);
-
- glNormal3f(dy * sin_theta, -dx, dy * cos_theta);
- glTexCoord2f(norm_theta, pheight / max_height);
- glVertex3f(pradius * sin_theta, pheight, pradius * cos_theta);
-
- glTexCoord2f(0.5 * (norm_theta + norm_ptheta),
- height / max_height);
- glVertex3f(0.0, height, 0.0);
-
- glEnd();
- }
-
- else {
- glBegin(wire ? GL_LINE_LOOP : GL_QUADS);
-
- glNormal3f(dy * sin_ptheta, -dx, dy * cos_ptheta);
- glTexCoord2f(norm_ptheta, pheight / max_height);
- glVertex3f(pradius * sin_ptheta, pheight, pradius * cos_ptheta);
-
- glNormal3f(dy * sin_theta, -dx, dy * cos_theta);
- glTexCoord2f(norm_theta, pheight / max_height);
- glVertex3f(pradius * sin_theta, pheight, pradius * cos_theta);
-
- glTexCoord2f(norm_theta, height / max_height);
- glVertex3f(radius * sin_theta, height, radius * cos_theta);
-
- glNormal3f(dy * sin_ptheta, -dx, dy * cos_ptheta);
- glTexCoord2f(norm_ptheta, height / max_height);
- glVertex3f(radius * sin_ptheta, height, radius * cos_ptheta);
-
- glEnd();
- }
-
- pradius = radius;
- pheight = height;
+#if 0
+/** draws cylindermodel */
+static int draw_model(int chunks, const GLfloat model[][3], int r)
+{
+ int i = 0;
+ int polys = 0;
+ glPushMatrix();
+ glRotatef(-90.0, 1.0, 0.0, 0.0);
+
+ for(i = 0; i < chunks; ++i) {
+ if(model[i][0] > EPSILON || model[i][1] > EPSILON) {
+ polys += tube (0, 0, 0,
+ 0, 0, model[i][1],
+ model[i][0], 0,
+ r, False, False, False);
+/* gluCylinder(quadric, model[i][0], model[i][1], model[i][2], r, 1);
+ polys += r;*/