week9
problem 1

Vec3d problem1[200];
float time;
void drawProblem1(){
for(int i=0;i<200;i++){
problem1[i].x = abs(100*sin((float)i/50+time))+150;
problem1[i].y = i*5;
problem1[i].z = 0;
}
glPushMatrix();
glTranslatef(0,-1400,-2800);
glRotatef( 50, 1,0,0);\
glScalef (3,3,3);
myMesh->mousefeed(mouseX,mouseY);
myMesh->makeRevolution(problem1, 200);
myMesh->drawSolidShape();
glPopMatrix();
}
problem 2
Vec3d problem2[200];
void drawProblem2(){
for(int i=0;i<200;i++){
problem2[i].x = abs(100*sin((float)i/50+time))+150;
problem2[i].y = i*5;
problem2[i].z = 0;
}
glPushMatrix();
glTranslatef(0,-1400,-2800);
glRotatef( 50, 1,0,0);\
glScalef (3,3,3);
myMesh->mousefeed(mouseX,mouseY);
myMesh->makeRevolution(problem2, 200);
myMesh->calculateNormal();
myMesh->drawSolidShape2();
glPopMatrix();
}
problem 4

Vec3d problem4shape[200];
Vec3d problem4path[200];
float time4;
void drawProblem4(){
for(int i=0;i<200;i++)
{
problem4shape[i].x = 30*cos(2*PI*i/199);
problem4shape[i].y = 30*sin(2*PI*i/199);
problem4shape[i].z = 0;
problem4path[i].x = 350*cos(2*PI*i/100);
problem4path[i].y = 600*cos((float)(i)/(float)(22));
problem4path[i].z = 300*sin((float)(i)/(float)(10));
}
time+=0.003;
glPushMatrix();
glTranslatef( -100,-200,-300);
glRotatef( time*500, 0,1,0);
glRotatef( time*550, 1,0,0);
myMesh->makeExtrusionOnPath(problem4shape,problem4path);
myMesh->calculateNormal();
myMesh->drawSolidShape2();
glPopMatrix();
}
problem 5

float sizePoints[200];
Vec3d problem5shape[200];
Vec3d problem5path[200];
void drawProblem5(){
for(int i=0;i<200;i++)
{
sizePoints[i] = 2*sin((float)i/3)+sin((float)i/3)+5;
problem5shape[i].x = 30*cos(2*PI*i/199);
problem5shape[i].y = 30*sin(2*PI*i/199);
problem5shape[i].z = 0;
problem5path[i].x = i*30;
problem5path[i].y = 100*sin((float)(i)/(float)(10));
problem5path[i].z = 30*sin((float)(i)/(float)(10));
}
time+=0.001;
glPushMatrix();
glTranslatef( -700,-200,-300);
glRotatef( mouseX, 0,1,0);
myMesh->makeExtrusionOnPath2(problem5shape,problem5path,sizePoints);
myMesh->calculateNormal();
myMesh->drawSolidShape2();
glPopMatrix();
}
problem 6

float sizePoints2[200];
Vec3d problem6shape[200];
Vec3d problem6path[200];
void drawProblem6(){
for(int i=0;i<200;i++)
{
sizePoints2[i] = 1+i*0.002;
problem6shape[i].x = 20*cos(2*PI*i/199);
problem6shape[i].y = 20*sin(2*PI*i/199);
problem6shape[i].z = 0;
problem6path[i].x = i*1.3*cos(2*PI*(float)i/20.0)+60*sin((float)i/50);
problem6path[i].y = i*2;
problem6path[i].z = i*1.3*sin(2*PI*(float)i/20.0)+60*sin((float)i/50);
}
time+=0.003;
glPushMatrix();
glTranslatef( -100,-200,-300);
glRotatef( time*500, 0,1,0);
glRotatef( time*550, 1,0,0);
myMesh->makeExtrusionOnPath2(problem6shape,problem6path,sizePoints2);
myMesh->calculateNormal();
myMesh->drawSolidShape2();
//myMesh->drawWireframe();
glPopMatrix();
}