8 * -- created by Linas Vepstas October 1991
9 * -- heavily modified to draw more texas shapes, Feb 1993, Linas
10 * -- converted to use GLUT -- December 1995, Linas
14 #include "extrusion.h"
18 /* =========================================================== */
21 #define CONTOUR(x,y) { \
22 double ax, ay, alen; \
23 contour[i][0] = SCALE * (x); \
24 contour[i][1] = SCALE * (y); \
26 ax = contour[i][0] - contour[i-1][0]; \
27 ay = contour[i][1] - contour[i-1][1]; \
28 alen = 1.0 / sqrt (ax*ax + ay*ay); \
29 ax *= alen; ay *= alen; \
30 norms [i-1][0] = ay; \
31 norms [i-1][1] = -ax; \
38 static double contour [NUM_PTS][2];
39 static double norms [NUM_PTS][2];
41 static void init_contour (void)
45 /* outline of extrusion */
71 CONTOUR (1.0, 1.0); /* repeat so that last normal is computed */
74 /* =========================================================== */
76 /* controls shape of object */
80 void InitStuff_screw (void)
84 /* configure the pipeline */
86 style |= TUBE_CONTOUR_CLOSED;
87 style |= TUBE_NORM_FACET;
88 style |= TUBE_JN_ANGLE;
89 gleSetJoinStyle (style);
94 /* =========================================================== */
96 void DrawStuff_screw (void) {
98 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
99 glColor3f (0.5, 0.6, 0.6);
101 /* set up some matrices so that the object spins with the mouse */
103 /* glTranslatef (0.0, 0.0, -80.0); */
104 /* glRotatef (130.0, 0.0, 1.0, 0.0); */
105 /* glRotatef (65.0, 1.0, 0.0, 0.0); */
107 /* draw the brand and the handle */
108 gleScrew (20, contour, norms,
109 NULL, -6.0, 9.0, lasty);
114 /* ===================== END OF FILE ================== */