Week 6 Assignment

 

Problem1

void drawSmooth(void){

float smooth=0.4;
float Amp=20;
float Freq=40;

glLineWidth(6);
glBegin(GL_LINE_STRIP);

float strokeWidth=20;
for( int i=1; i<numPoint-1; i++){

Vec2d currentPoint= pointList[i];

Vec2d A= pointList[i-1];
Vec2d B = pointList[i+1];


Vec2d E= A*smooth+ currentPoint*0.2+ B*smooth;
glColor4f(1, 0,0,0.5);
Vec2d off (1,1);

glVertex2f(E.x, E.y);
pointList[i]=E;

Vec2d V= B-A;
V.normalize();

Vec2d Vp;
Vp.x = V.y * -1.0;
Vp.y= V.x;



}

glEnd();

}