OK, nobody replied, so I guess I'm the only person who found this little exercise interesting.
But I'll explain what I did anyway.
I essentially use the parametric definition of a circle, namely:
x = cos(theta) * Ty = sin(theta) * T
However, rather than directly calculating sine and cosine using a Taylor polynomial or the math.h function, I take advantage of a few facts.
1 - Sine/Cos y values in consecutive iterations (T values) are from consecutive evenly spaced x values.
2 - A Hookean spring oscillates sinusodially.
So I basically simulate two springs, one for sine, and one for cosine. These values are stored in x and y, respectively. The actual x and y coordinates are given by multiplying by r and adding an offset for the center of the circle.
To quickly explain what each variable is:
x = displacement of spring Ay = displacement of spring Bv1 = velocity of spring Av2 = velocity of spring Bk = spring constant for both springs A and B
K, the spring constant, determines the period of the oscillation. Obviously, I want the period to correspond to the number of iterations I want to do. The number of iterations desired is determined by the circumference. Knowing this and solving for k in terms of r (and then negating so I can cumulatively add rather than subtract), I arrive at the expression I used in the code, k=-1/r
2.
I still think this is a novel approach to circle drawing, which is why I made this explanatory post.
And now I'm done. 'Till next time, ta ta.
[edited by - TerranFury on March 27, 2002 4:53:09 PM]