http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

TheGrumpyProgrammer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing a circle



Why don't you guys check Graphics Gems (there's a whole archive on the net
somewhere, do a search) for stuff like that, It has some on this subject
too.

----- Original Message -----
From: Kamel Serend <kserend@twowaytv.co.uk>
To: <gameprogrammer@gameprogrammer.com>
Sent: Friday, July 07, 2000 2:36 PM
Subject: RE: Drawing a circle


> Hi,
>
> Just a little question...
> Why nobody is using the Bresenham algorithm as applied to circles ?
> I thought it is the simpliest and fastest way to do the things, but I must
> be wrong...
> Any body ?
>
> Kamel
>
> > -----Original Message-----
> > From: Paul Robson [SMTP:probson@powerup.com.au]
> > Sent: Friday, July 07, 2000 12:44 PM
> > To: gameprogrammer@gameprogrammer.com
> > Subject: RE: Drawing a circle
> >
> > you could always do it using the circle formula.  It's a lot more
reliable
> > anyway, you don't get extra pixels being drawn on top of each other for
> > small circles or have large gaps for big circles (ie circles with a
radius
> > >
> > 360)
> >
> > the circle formula is r^2 = x^2 + y^2
> > this can be rearranged to be:  y = (plus-or-minus)sqrt(r^2-x^2)
> >
> > So, to implement this.. you would have something like this:
> >
> > void drawline(x1, y1, x2, y2);
> >
> > void drawcircle (x, y, r)
> > {
> >   int r2 = r*r;
> >   for (int i = x-r; i < x+r-1; i+=2)
> >   {
> >     j = i+1;
> >     drawline( i, sqrt( r2 - (i-x)*(i-x), j, sqrt( r2 - (j-x)*(j-x) );
> >     drawline( i, -sqrt( r2 - (i-x)*(i-x), j, -sqrt( r2 - (j-x)*(j-x) );
> >   }
> > }
> >
> > I think that should work.. i haven't actually typed it in or anything so
> > there's bound to be typos :)
> >
> > Paul Robson
> >
> > > -----Original Message-----
> > > From: gameprogrammer-owner@gameprogrammer.com
> > > [mailto:gameprogrammer-owner@gameprogrammer.com]On Behalf Of Kevin
Shea
> > > Sent: Friday, 7 July 2000 7:08 PM
> > > To: gameprogrammer@gameprogrammer.com
> > > Subject: Re: Drawing a circle
> > >
> > >
> > > On this whole subject of drawing circles, you simply don't want
> > > anything to do with sin()/cos() if you can avoid it.
> > >
> > > Since the original question was for c++/assembler, check out Michael
> > > Abrash's "Black Book of Graphics Programming" (something like that) -
> > > it has circle-drawing routines in C and assembly for (I think) various
> > > VGA modes.
> > >
> > > Kev
> > >
> > > Kevin Wolfskill wrote:
> > > >
> > >
> > > Lots cut out.
> > >
> > > > >----- Original Message -----
> > > > >From: Lionel Pinkhard <lionelpi@mweb.co.za>
> > > > >To: <gameprogrammer@gameprogrammer.com>
> > > > >Sent: Saturday, July 05, 1980 3:04 AM
> > > > >Subject: Drawing a circle
> > > > >
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > Can somebody please tell me how to draw a circle in
C++/Assembler
> > > > >without
> > > > >using any graphics libraries (so far my game's not using any)?
> > > (under DOS).
> > > > > >
> > > > > > Kind regards,
> > > > > >
> > > > > > Lionel Pinkhard
> > > > > >
=================================================================
> > > > > > The GameProgrammer.Com mailing list is for the open discussion
> > > > > > of any topic related to the art, science, and business of
> > > > > > programming games. This list is especially tolerant of
beginners.
> > > > > > We were all beginners once
> > > > > >
> > > > > > To SUBSCRIBE or UNSUBSCRIBE please visit:
> > > > > > http://gameprogrammer.com/mailinglist.html
> > > > >
> > > > >=================================================================
> > > > >The GameProgrammer.Com mailing list is for the open discussion
> > > > >of any topic related to the art, science, and business of
> > > > >programming games. This list is especially tolerant of beginners.
> > > > >We were all beginners once
> > > > >
> > > > >To SUBSCRIBE or UNSUBSCRIBE please visit:
> > > > >http://gameprogrammer.com/mailinglist.html
> > > >
> > > >
> > ________________________________________________________________________
> > > > Get Your Private, Free E-mail from MSN Hotmail at
> > http://www.hotmail.com
> > > >
> > > > =================================================================
> > > > The GameProgrammer.Com mailing list is for the open discussion
> > > > of any topic related to the art, science, and business of
> > > > programming games. This list is especially tolerant of beginners.
> > > > We were all beginners once
> > > >
> > > > To SUBSCRIBE or UNSUBSCRIBE please visit:
> > > > http://gameprogrammer.com/mailinglist.html
> > > > =================================================================
> > > > The GameProgrammer.Com mailing list is for the open discussion
> > > > of any topic related to the art, science, and business of
> > > > programming games. This list is especially tolerant of beginners.
> > > > We were all beginners once
> > > >
> > > > To SUBSCRIBE or UNSUBSCRIBE please visit:
> > > > http://gameprogrammer.com/mailinglist.html
> > > =================================================================
> > > The GameProgrammer.Com mailing list is for the open discussion
> > > of any topic related to the art, science, and business of
> > > programming games. This list is especially tolerant of beginners.
> > > We were all beginners once
> > >
> > > To SUBSCRIBE or UNSUBSCRIBE please visit:
> > > http://gameprogrammer.com/mailinglist.html
> > >
> >
> > =================================================================
> > The GameProgrammer.Com mailing list is for the open discussion
> > of any topic related to the art, science, and business of
> > programming games. This list is especially tolerant of beginners.
> > We were all beginners once
> >
> > To SUBSCRIBE or UNSUBSCRIBE please visit:
> > http://gameprogrammer.com/mailinglist.html
> =================================================================
> The GameProgrammer.Com mailing list is for the open discussion
> of any topic related to the art, science, and business of
> programming games. This list is especially tolerant of beginners.
> We were all beginners once
>
> To SUBSCRIBE or UNSUBSCRIBE please visit:
> http://gameprogrammer.com/mailinglist.html

=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html