/* surf3d.c */ /* plane at x, X, y, Y, z, Z */ /* We use the surf3d view function in the display callback to point the object, whose position can be altered by the x,X,y,Y,z and Z keys for object position r,R,p,P,h and H keys for rool, pitch and heading The perspective view is set in the reshape callback */ #include #include #include static GLfloat roll=0.0; static GLfloat pitch=90.0; static GLfloat heading=0.0; static GLfloat scale=4.0; /* initial object location */ static GLdouble object[]= {0.0, -2.0, 0.0}; void cyl_spiral(float a, float b, float c, float n) { struct point { float x, y, z; }; struct point raw[63][15]; struct tri_poly { int p1, p2, p3; }; int i, j; double x, y, z; struct point p1, p2, p3; int nx = 63; /* last == first */ int ny = 15; double pi = 3.141592653589793238462643383279502884197; double u = 0.0; /* parametric in u and v */ double du = 2.0*pi/(double)ny; double v = 0.0; double dv = 2.0*pi/(double)(nx-1); for(i=0; i