Check out the Graphics Gems series of books. The sources from them are
available for download from a number of places.
Yes, it is possible to draw a circle using the cos and sin functions.
However, this is not a recommended method since they are expensive
functions. There are a number of methods where the algorithm only process
90 or 45 degrees - depending on support for elipses or non-unity aspect
ratio - and where next pixel is found in an iterative loop through a DDA -
digital differential analysis - evaluation, i.e. given a specific pixel,
the algorithm just evaluates if next pixel should be one step right or one
step up.
/Per W
On Mon, 9 Feb 2004, Brian Wallace wrote:
> If anyone is wondering how to draw a circle pixel by pixel, use x=(Radius)*cos(Number increasing from 0-6.26 by small incraments) + xpos of center of circle,
> y=(radius)*sin(Number increasing from 0-6.26 by small incraments) + ypos
> Put that inside a loop where t increases by something like .01 and draw the point inside the loop also.
>
> _______________________________________________________________________________________________________________________________________________________________________
> Click here for a FREE online computer virus scan from McAfee. ------------------------------------------------------- The SF.Net email is sponsored by
> EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE:
> http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|