y--; } putpixel(xc,yc,x,y); putpixel(xc,yc,-x,-y); putpixel(xc,yc,-x,y); putpixel(xc,yc,x,-y); } d2=b*b*(x+0.5)*(x+0.5)+a*a*(y-1)*(y-1)-a*a*b*b; while(y>0) { } if(d2<=0) { } else { d2+=a*a*(-2*y+3); y--; d2+=b*b*(2*x+2)+a*a*(-2*y+3); x++; y--; } putpixel(xc,yc,x,y); putpixel(xc,yc,-x,-y); putpixel(xc,yc,-x,y); putpixel(xc,yc,x,-y);
}
void dda_line(int xa,int ya,int xb,int yb)//画直线
{
GLfloat delta_x,delta_y,x,y; int dx,dy,steps; dx=xb-xa; dy=yb-ya; if(abs(dx)>abs(dy)) steps=abs(dx); else steps=abs(dy); delta_x=(GLfloat)dx/(GLfloat)steps; delta_y=(GLfloat)dy/(GLfloat)steps; x=xa; y=ya;