Computer Graphics in C,C++

Tuesday, 6 January 2009

Rectangle by polynomial method

#include"stdio.h"
#include"conio.h"
#include"graphics.h"
#define PI 3.1416
#include
void main()
{
int gd=DETECT,M;
int h,k,x,y;
float a,b;
clrscr();
initgraph(&gd,&M,"");
printf("Enter h,k,a,b;");
scanf("%d%d%f%f",&h,&k,&a,&b);
for(x=0;x {

y=b*sqrt((x*x/a*a)-1);
putpixel(x+h,y+k,4);
putpixel(-x+h,y+k,4);
putpixel(x+h,-y+k,4);
putpixel(-x+h,-y+k,4);
}
getch();
}

No comments:

Post a Comment