Mail Archives: djgpp/1999/08/07/11:12:30
| Message-ID: | <37AC37B8.B29A3614@unb.ca>
|
| From: | Endlisnis <s257m AT unb DOT ca>
|
| X-Mailer: | Mozilla 4.61 [en] (Win98; U)
|
| X-Accept-Language: | en
|
| MIME-Version: | 1.0
|
| Newsgroups: | comp.os.msdos.djgpp,comp.programming
|
| Subject: | Re: Circle Drawing Algorithms
|
| References: | <7oh04k$3vb$1 AT newsreader2 DOT core DOT theplanet DOT net>
|
| Lines: | 44
|
| Date: | Sat, 07 Aug 1999 13:43:40 GMT
|
| NNTP-Posting-Host: | 209.226.124.244
|
| X-Trace: | news20.bellglobal.com 934033420 209.226.124.244 (Sat, 07 Aug 1999 09:43:40 EDT)
|
| NNTP-Posting-Date: | Sat, 07 Aug 1999 09:43:40 EDT
|
| Organization: | Sympatico
|
| To: | djgpp AT delorie DOT com
|
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
| Reply-To: | djgpp AT delorie DOT com
|
Andy Kilner wrote:
> What is the fastest circle algorithm available at the moment?
This is a snip of code from my graphics library. It only draws 1/8th of the
circle and reflects the rest. Also, no multiplication or trig is done and
only integers are used.
void _GraphixBase::Circle(short X, short Y, short Radius, byte Clr)
{
short x=0;
short y=Radius;
short step=1-y;
while(y>=x)
{
Pset(X+x, Y+y, Clr);
Pset(X+y, Y+x, Clr);
Pset(X+y, Y-x, Clr);
Pset(X+x, Y-y, Clr);
Pset(X-x, Y-y, Clr);
Pset(X-y, Y-x, Clr);
Pset(X-y, Y+x, Clr);
Pset(X-x, Y+y, Clr);
if (step<0) step += x+x+3;
else
{
step += ((x-y)<<1)+5;
y--;
}
x++;
}
}
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT HotMail DOT com
ICQ: 32959047
- Raw text -