PDA

View Full Version : no idea how to create round 2d objects using vertices



mindkiller
07-02-2012, 11:12 AM
Like the title is telling...
I have no idea how to create that, can someone please help me or send a link where I can find this informations please, thank´s :)

thokra
07-03-2012, 02:10 AM
Circles? Ellipses? You need two things, a mathematical description of your problem, i.e. how can a circle be defined mathematically, and some algorithm to generate vertices. For a filled circle, in contrast to a circle only rendered as a a number if line segments, you'll need a center vertex and some vertices at distance r (where r is the radius of the circle). Then you simply define a series of triangles which describe the form of the circle. The more triangles you generate, the better the approximation of the circle.

Check out http://en.wikipedia.org/wiki/Circle and there especially the parametric form of a circle. Since you're in 2D you'll have it especially easy.

Kopelrativ
07-03-2012, 07:06 AM
There may be an easy solution in 2d, which is using a quad where you use a texture that is a picture of a circle, and transparent elsewhere.