while(x<y)
{
plot_circle_points(xc,yc,x,y);
if(p<0)
p=p+4*x+6;
else
{
p=p+4*(x-y)+10;
y-=1;
}
x+=1;
}
if(x==y)
plot_circle_points(xc,yc,x,y);
}
void putpixel(int xc,int yc,int x,int y)//画椭圆
{
glBegin(GL_POINTS); glVertex3f(xc+x,yc+y,0);
glEnd();
}
void drawEllipse(int xc,int yc,int a,int b)
{
int x,y;
float d1,d2;
x=0; y=b; d1=b*b+a*a*(-b+0.25); putpixel(xc,yc,x,y); putpixel(xc,yc,-x,-y); putpixel(xc,yc,-x,y); putpixel(xc,yc,x,-y); while(b*b*(x+1)<a*a*(y-0.5)) { if(d1<0) { } else { d1+=b*b*(2*x+3)+a*a*(-2*y+2); d1+=b*b*(2*x+3); x++;