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
This is a discussion on Formula For Circle.. within the C Programming forums, part of the General Programming Boards category; Hi all, anyone haf formula for circle... not the pi*r*r one.... Is the formula to get every points on the ...
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
x^2 + y^2 = r^2
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
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.
Last edited by MrWizard; 11-17-2003 at 06:09 AM.
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
may i noe wat precision u refer to..??
const float PRECISION = 0.001f;Originally posted by xiao guang
may i noe wat precision u refer to..??
As per the posted code.
Quzah.
Hope is the first step on the road to disappointment.