[SDL] fastest way to draw circles

St0fF 64 st0ff at gmx.net
Mon Mar 11 16:33:01 PST 2002


At 16:02 11.03.2002 -0800, you wrote:
>what's the fastest way to draw circles of varying radii to the screen?
>do it myself? if so, what drawing method should i use?

Hm, there are various ways ... whithout hardware, with hardware, the 
oldschool-way and so on...
the oldschool-way is with a variation of the Bresenham's 
algorithm.  Newschool is, you decide how many segments your circle will 
have, make a table of sines and a table of cosines of #segments length, and 
then your read costab, multiply with radius -> that's x_coordinate, read 
sintab, multiply with radius -> y_coord.  now you draw staight lines 
between two of those pairs of coordinates, then loop thru your segments in 
this manner. easy, isn't it?  Just simple math.
St0fF.





More information about the SDL mailing list