The following describes the mathematics for the so called Bézier curve. It is attributed and named after a French engineer, Pierre Bézier, who used them for the body design of the Renault car in the 1970's. They have since obtained dominance in the typesetting industry and in particular with the Adobe Postscript and font products.

Consider N+1 control points pk (k=0 to N) in 3 space. The Bézier parametric curve function is of the form

B(u) is a continuous function in 3 space defining the curve with N discrete control points Pk. u=0 at the first control point (k=0) and u=1 at the last control point (k=N).

#include <graphics.h>  
#include <iostream.h>  
struct point  
{  
  int x,y;  
}*p;

void main()  
{  
  int gd=DETECT,gm=VGAHI;  
  initgraph(&gd,&gm,"");  
  cout<<"Enter control points ";  
  p=new point[4];  
  for (int i=0;i<4;i++)  
  {  
    cout<<"Enter point P"<<i<<"(x,y)";  
    cin>>p[i].x>>p[i].y;  
  }  
  for (float u=0;u<=1;u+=.001)  
  {  
    float x,y;  
    x=(1-u)*(1-u)*(1-u)*p[0].x+(1-u)*(1-u)*3*u*p[1].x+3*u*u*(1-u)*p[2].x+u*u*u*p[3].x;  
    y=(1-u)*(1-u)*(1-u)*p[0].y+(1-u)*(1-u)*3*u*p[1].y+3*u*u*(1-u)*p[2].y+u*u*u*p[3].y;  
    putpixel(x+getmaxx()/2,getmaxy()/2-y,7);  
  }  
  getch();
}