#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
void drawellipse(float, float, float, float);
void main()
{
int gd=DETECT,gm;
float xc,yc,rx,ry;
initgraph(&gd,&gm,"c:\\tc\\bgi");
xc=200;
yc=200;
rx=150;
ry=100;
drawellipse(xc,yc,rx,ry);
getch();
closegraph();
}
void drawellipse(float xc,float yc,float rx,float ry)
{
float p,x,y;
x=0;
y=ry;
p=ry*ry-rx*rx*ry+rx*rx/4;
while(2*ry*ry*x<2*rx*rx*y)
{
putpixel(xc+x,yc-y,1);
putpixel(xc-x,yc+y,1);
putpixel(xc+x,yc+y,1);
putpixel(xc-x,yc-y,1);
if(p<0)
{
x=x+1;
p=p+2*ry*ry*x+ry*ry;
}
else
{
x=x+1;
y=y-1;
p=p+2*ry*ry*x+ry*ry-2*rx*rx*y;
}
}
p=ry*ry*pow(x+1/2,2)+rx*rx*pow(y-1,2)-rx*rx*ry*ry;
while(y>=0)
{
putpixel(xc+x,yc-y,1);
putpixel(xc-x,yc+y,1);
putpixel(xc+x,yc+y,1);
putpixel(xc-x,yc-y,1);
if(p>=0)
{
y=y-1;
p=p-2*rx*rx*y+rx*rx;
}
else
{
x=x+1;
y=y-1;
p=p-2*rx*rx*y+rx*rx+2*ry*ry*x;
}
}
}
Wgiomocpa_na_1986 Dana Head https://wakelet.com/wake/zYDnaEpFBQ-HjgXiEAhVf
ReplyDeletetawarmidisch
contreselze Dereck Goon ESET NOD32 Internet Security
ReplyDeleteCamtasia Studio
There
orestworun