Problem 1. Create a function called drawWireframeCylinder that takes as input a radius (float), a height (float) and a number of steps (int). The function should draw a series of circles stacked vertically as specified. Draw vertical lines between the circles to complete wireframe effect.
// place your drawing code here
for (int D = 0; D <= steps; D++){
glBegin(GL_LINE_LOOP);
glColor3f( 1,0,0 );
for (int A = 0; A < 30; A++){
float ang = A / 30.0 * PI * 2.0;
float x = radius*cos(ang);
float y = D*(height/steps) - 300;
float z = radius*sin(ang);
glVertex3f(x,y,z);
}
glEnd();
}
for (int D = 0; D <= steps; D++){
for (int A = 0; A < 30; A++){
glBegin(GL_LINE_STRIP);
glColor3f( 0,1,0 );
if (D%20 == 0){
float ang = A / 30.0 * PI * 2.0;
float x = radius*cos(ang);
float z = radius*sin(ang);
Problem 2. Create a function called drawWireframeExtrusion that takes as input an array of points (Vec2d*), the number of points (int), a height (float) and a number of steps (int). The function should draw a wireframe extrusion of the two-dimensional form that is passed in.
// place your drawing code here
for (int D = 0; D <= steps; D++){
glBegin(GL_LINE_LOOP);
glColor3f( 1,0,0 );
for (int i = 0; i < sizeof(pointList)*2; i++){
float x = pointList[i].x;
float y = pointList[i].y;
float z = D*(height/steps);
glVertex3f(x-300,y,z);
}
glEnd();
}
glPopMatrix();
}
glBegin(GL_LINE_LOOP);
glColor3f(1,1,0);
for (int i = 0; i < 8; i++){
glVertex2f(pointList[i].x-300, pointList[i].y);
}
glEnd();
drawWireframeExtrusion(pointList, mouseX, 10);
}
Problem 3. Create a function called drawWireframeRevolution that takes as input an array of points (Vec2d) and the number of points (int). The function should uses the array of points as a revolution profile. To do this, draw a circle for each point in the array where the circle's radius is equal to the point's X component, and the the circle's vertical height is equal to the circle's Y value. Complete the wireframe by drawing the vertical lines.
for (int i = 0; i < points; i++){
glBegin(GL_LINE_LOOP);
glColor3f( 1,0,0 );
for (int A = 0; A < 100; A++){
float ang = A / 100.0 * PI * 2.0;
float x = pointList[i].x * cos(ang) ;
float y = pointList[i].x * sin(ang);
float z = pointList[i].y;
for (int i = 0; i < points; i++){
glBegin(GL_LINE_LOOP);
for (int A = 0; A < 100; A++){
float ang = A / 100.0 * PI * 2.0;
float x = pointList[i].x * cos(ang) ;
float y = pointList[i].x * sin(ang);
float z = pointList[i].y;
for (int i = 0; i < points; i++){
for (int A = 0; A < mouseY; A++){
float ang = A / 100.0 * PI * 2.0;
float x = pointList[i].x * cos(ang) ;
float y = pointList[i].x * sin(ang);
float z = pointList[i].y;
for (int i = 0; i < points; i++){
for (int A = 0; A < 100; A++){
float ang = A / 100.0 * PI * 2.0;
float x = circlePoint[i].x * cos(ang) ;
float y = circlePoint[i].x * sin(ang);
float z = circlePoint[i].y;