We use a line loop to approximate our circle that is centered at the origin. We determine the points on the circle by using polar coordinates (radius and angle). The points, in turn, become the vertices of our line loop.

To obtain a circle (versus an arc of the circle), we let the angle vary from 0 degrees to 360 degrees. Since a line loop is closed, our termination condition in the for loop is angle < 360. Next, the angle increment dictates the visual smoothness achieved by the approximating line loop. A relatively large increment (i.e., 15 degrees) is used here only to illustrate this point; a smaller value such as 5 will give a better approximation.

The equations in general for computing the x and y coordinates from polar coordinates (r, A) are

    x = r*cos(A)    y = r*sin(A)
Since the C++ math functions cos and sin require an angle measured in radians, we need to convert our loop control variable angle to radians. This is accomplished with the conversion factor PI/180.0. Thus, the angle measured in radians becomes
   angleInRadians = angle * PI/180.0