Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

If l want to draw a circle.How to do it?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 bluepig.man   Members   -  Reputation: 259

Like
0Likes
Like

Posted 30 October 2012 - 07:05 PM

l need draw many point for a circle,or have some simple ways?

#2 Nik02   Members   -  Reputation: 1990

Like
0Likes
Like

Posted 31 October 2012 - 02:56 AM

Everything you draw on a computer (other than a single point) ends up as many points.

Search for "Bresenham circle" for a discrete approach; alternatively, you can tessellate (or subdivide) your circle into line segments that approximate the circle and draw those with a line algorithm.
Niko Suni
Software developer

#3 skytiger   Members   -  Reputation: 199

Like
1Likes
Like

Posted 31 October 2012 - 08:34 AM

Or you can draw a quad and decide whether each pixel should be on or off based on an equation
which will give you scalable resolution for only 4 verts ...

#4 slayemin   Members   -  Reputation: 1054

Like
1Likes
Like

Posted 01 November 2012 - 01:58 PM

Every point on a circle can be calculated by:

x = radius * cos(theta);
y = radius * sin(theta);

Where, theta is all values between 0 and 2PI, and radius is greater than zero.

So, to draw a circle, you can could either plot a bunch of pixels to the screen at the X,Y coordinates as you loop through every value of theta...
or you could draw line segments between each of the X/Y value pairs for all values of theta.
Eric Nevala
Hobby: Game Developer
Currently employed as: Sr. Sharepoint Developer in Afghanistan

#5 phil67rpg   GDNet+   -  Reputation: 519

Like
0Likes
Like

Posted 01 November 2012 - 05:25 PM

you might want to search this site I have found quite a few threads that might help.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS