Generating a circle

I want to generate a circle of radius given by user.But I can't get the draft of circle on paper and hence can't proceed with the program.
I don't need full logic, I just need to know how will it look on paper and rest I can do myself. Please help!
To draw a circle draw all it's point from a given distance (the radius) from the center.
You can divide your circle in many little arches (created by an angle)
The x position for a circle point would be xcenter+radius*cos( angle ). For y is the same thing but with the sine of the angle
Can u illustrate it with an example of draft ?
You should just use a loop changing the angle
eg:
1
2
3
4
5
6
7
8
9
10
11
12
13
struct Point {
     Point( double X, double Y ): x(X), y(Y) {};
     double x;
     double y;
};//Simple Point structure

Point Center(/*Center Coordinates*/);
double radius = /*something*/;
const double PI = 3.14159;

for (double angle=0; angle<=2*PI; angle+=0.001)//You are using radians so you will have to increase by a very small amount
     //This will have the coordinates  you want to draw a point at
     Point( Center.x + radius*cos( angle ), Center.y + radius*sin( angle ) );
Last edited on
Thanks a lot!
Topic archived. No new replies allowed.