Click here to Skip to main content
16,018,818 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to draw a line using polar coordinates?
Posted
Updated 27-Feb-15 1:49am
v2

1 solution

Not sure what do you mean, dude.
Take a look at this example.
This way you can draw a circle using Polar based algorithm, HTH:
C++
 void CircleDirect(HDC hdc,int xc,int yc, int R)
 {
   int x=0,y=R;
   int R2=R*R;
   Draw8Points(hdc,xc,yc,x,y);
        while(x<y)>
         {
       x++;
           y=round(sqrt((double)(R2-x*x)));
         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);
}
 
Share this answer
 
v2
Comments
Richard MacCutchan 27-Feb-15 9:20am    
There are plenty of inbuilt graphics in Windows that will do this much easier.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900