Drawing a Graphical Image in C++

I am going to draw a graphical image using Visual C++ Express 2008.

Nothing fancy just a stick figure.

Also I have an accompanying library so that will be easier.

But here is my question: I know how to draw the body but I have no idea how to draw a circle for the head.

Thank You

The answer would depend entirely on what library you are using. :P
Can you draw straight lines? Ok, then just do this, where x and y are the centre of your circle, r is the radius, and draw_line(x1,y1,x2,y2) draws a line from x1,y1 to x2,y2:
1
2
3
4
5
6
7
float theta=0;
float dth=0.1;//reduce this to get a better circle.
while(theta<2*M_PI){
	draw_line(x+r*cos(theta),y+r*sin(theta),
	x+r*cos(theta+dth),y+r*sin(theta+dth));//replace draw_line with whatever your library has
	theta += dth;
}

But you should also look for a special circle function.
Last edited on
Topic archived. No new replies allowed.