Week 5 Assignment

 

Problem2

void drawStroke2(void){

glLineWidth(1);
//glBegin(GL_LINE_STRIP);

float strokeWidth=20;//module
glBegin(GL_TRIANGLE_STRIP);
for( int i=0; i<numPoint-1; i++){

Vec2d currentPoint= pointList[i];

glVertex2f(pointList[i].x, pointList[i].y);
Vec2d A= pointList[i-1];
Vec2d B = pointList[i+1];


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

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

strokeWidth= ((i/10)%6)*10 + 10;

Vec2d C= currentPoint + Vp*strokeWidth;
glVertex2f(C.x, C.y);


}

glEnd();

}