I am completely stuck on how to draw a circle in c++ any advice?
I am completely stuck on how to draw a circle in c++ any advice?
Need to be using a graphics library: DirectX, OpenGL, SDL, etc... There are some OpenGL tutorials on this site.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
trig man, trig
you know that unit circle thing they taught you? you need it.
Sines and Cosines are a wonderful thing
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
There are NO graphics in standard C++. Your compiler may have a graphics library (graphics.h or something). If not, like Zack L. said, you need an additonal 3rd-party library.
You should not have to use trigonometry to calculate a circle. And, that won't help if you can't "draw" on the screen. For example, I believe Windows has a DrawCircle() function... although I'm not sure if that's the correct name of the function.
ah, but you use trig indirectly when you use the library. I assumed that he is able in some form to draw graphics because of the nature of the post. If the method he's using does not include a circle routine he could easily write one.
Common method:
cosine table pre-calculated. You create a series of points around the circle and simply draw lines from point to point. since the cosine table is pre-generated you get to draw them with blazing speed.
Zach and Doug, your graphics library is doing the same thing I assure you.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
Of course you need trig, but chances are that the graphics library will contain either a draw_circle type function or a draw_ellipse with variable eccentricity, which you merely set to 0, and you're good.
By the way, here are some links:
www.opengl.org
www.libsdl.org
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
newx=x+cos(angle)*radius;
newy=y+sin(angle)*radius;
This is the general idea but you will need much more. Check out google - many many sites talk about several diff methods of doing this.