Hi all,
anyone haf formula for circle... not the pi*r*r one....
Is the formula to get every points on the circumferece of the circle...
Hope someone can help me....
Thanks in advance,
xiao guang:confused:
Printable View
Hi all,
anyone haf formula for circle... not the pi*r*r one....
Is the formula to get every points on the circumferece of the circle...
Hope someone can help me....
Thanks in advance,
xiao guang:confused:
x^2 + y^2 = r^2
Well it all depends on what you are going to use the points for. Are you planning on drawing them to the screen? If so you can use some circle drawing algorithms here:
http://www.cs.unc.edu/~mcmillan/comp...e7/circle.html
If you just want floating-point numbers you could use a very naive and slow brute force method with cosine and sine..
Code:
const float PRECISION = 0.001f;
const float RADIUS = 150.f;
float x, y;
for( float i = 0.f; i < 2*PI; i += PRECISION )
{
x = cosf( i ) * RADIUS;
y = sinf( i ) * RADIUS;
// Do something with this point...
}
EDIT:
I should've read your question more carefully, I assumed you wanted to know how to calculate points on a circle. I didn't even see where you had type "formula". Oh well maybe someone will find this of use.
may i noe wat precision u refer to..??
const float PRECISION = 0.001f;Quote:
Originally posted by xiao guang
may i noe wat precision u refer to..??
As per the posted code.
Quzah.