BEZIER CURVE IN COMPUTER GRAPHICS
#include<dos.h> #include<conio.h> #include<stdio.h> #include<graphics.h> #include<iostream.h> #include<stdlib.h> int gd,gm,maxx,maxy; float X[4][2]; void line(float x2,float y2) { line(X[0][0],X[0][1],x2,y2); X[0][0]=x2; X[0][1]=y2; } void bezier(float xb,float yb,float xc,float yc,float xd,float yd,int n) { float xab,yab,xbc,ybc,xcd,ycd; float xabc,yabc,xbcd,ybcd; float xabcd,yabcd; if(n==0) { line(xb,yb); delay(20); line(xc,yc); delay(20); line(xd,yd); delay(20); } else { xab=(X[0][0]+xb)/2 ; yab=(X[0][1]+yb)/2 ; xbc=(xb+xc)/2 ; ybc=(yb+yc)/2; xcd=(xc+xd)/2 ; ycd=(yc+yd)/2 ; xabc=(xab+xbc)/2; yabc=(yab+ybc)/2 ; xbcd=(xbc+xcd)/2; ybcd=(ybc+ycd)/2; xabcd=(xabc+xbcd)/2; n=n-1; bezier(xab,yab,xabc,yabc,xabcd,yabcd,n); bezier(xbcd,ybcd,xcd,ycd,xd,yd,n); } } void igraph() { detectgraph(&gd,&gm); if(gd<0) { printf("\n \t cannot detect a graphics card!!!"); exit(1); } initgraph(&am