Week 2 Assignment

Maria Mendez

Problem 2a

void drawCircle(void){

int angle;
int numPoints=30;
float Rad= 10;
float aRad= 10;
int i;

Vec2d P;
Vec2d center(100,200);
for(i=0; i<5; i++){
glBegin(GL_LINE_LOOP);
for(angle = 0; angle < numPoints; angle++){
float A = 2*PI /numPoints * angle;
P.x = cos(A) * Rad;
P.y = sin(A) * Rad;
P = P+ center;

glVertex2f(P.x, P.y);
}
glEnd();
aRad=Rad;
Rad+=10;
center.x+= Rad+aRad;
printf( "%f \n", center.x );

}

}

Problem 2b

void drawPolygons(void){

int angle;
int numPoints=3;
float Rad= 50;
int i;

Vec2d P;
Vec2d center(100,200);
for(i=0; i<5; i++){
glBegin(GL_LINE_LOOP);
for(angle = 0; angle < numPoints; angle++){
float A = 2*PI /numPoints * angle;
P.x = cos(A) * Rad;
P.y = sin(A) * Rad;
P = P+ center;

glVertex2f(P.x, P.y);
}
glEnd();
numPoints++;
center.x+= Rad*2 +20;
}

}