Sat Jul 21, 2012 2:14 pm
void CirclePolar(HDC hdc,int xc,int yc, int R)
{
int x=R,y=0;
double theta=0,dtheta=1.0/R;
Draw8Points(hdc,xc,yc,x,y );
while(x>y)
{
theta+=dtheta;
x=round(R*cos(theta));
y=round(R*sin(theta));
Draw8Points(hdc,xc,yc,x,y);
}
}
void Draw8Points(HDC hdc,int xc,int yc, int a, int b)
{
SetPixel(hdc, xc+a, yc+b, NULL);
SetPixel(hdc, xc-a, yc+b, NULL);
SetPixel(hdc, xc-a, yc-b, NULL);
SetPixel(hdc, xc+a, yc-b, NULL);
SetPixel(hdc, xc+b, yc+a, NULL);
SetPixel(hdc, xc-b, yc+a, NULL);
SetPixel(hdc, xc-b, yc-a, NULL);
SetPixel(hdc, xc+b, yc-a, NULL);
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.