Vec2d a(100.0,400.0);
Vec2d b(200.0,800.0);
Vec2d c(300.0,0.0);
Vec2d d(400.0,400.0);
Vec2d e(400.0,400.0);
Vec2d f(500.0,800.0);
Vec2d g(600.0,0.0);
Vec2d h(700.0,400.0);
Vec2d varray[8]={a, b,c,d,e,f,g,h};
glPointSize(10.0);
glBegin(GL_LINE_STRIP);
drawBezs(varray, 8);
glEnd();
void bezier(Vec2d a,Vec2d b, Vec2d c,Vec2d d){
float points = 1000;
for (float p = 0; p < 1.0 ; p=(p+(1.0/points))){
Vec2d e=((a * pow(1.0-p,3.0 ))+ (b * 3.0 * pow(1.0-p,2.0)*p) +(c * 3.0 * pow(p,2.0)*(1.0-p)) + (d * pow(p,3.0)));
glVertex2f(e.x, e.y);
}
//A*b*b*b + B*3*b*b*p + C*3*b*p*p + D*p*p*p
}
void drawBezs(Vec2d * _a, int _b){
// printf( " hellowwwwww \n" );
for (int i =0; i < _b; i++){
if (i%4 == 0){
// printf( " hello %d \n",i );
bezier(_a[i],_a[i+1], _a[i+2],_a[i+3]);
}
}
}