delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/04/04:02:41

From: p DOT steiner AT t-online DOT de (Peter Steiner)
Newsgroups: rec.games.programmer,comp.os.msdos.djgpp
Subject: Re: bresenham's circle
Date: 2 Aug 1997 16:15:34 GMT
Organization: Telekom Online Internet Gateway
Lines: 32
Message-ID: <5rvmf7$bha$4@news00.btx.dtag.de>
References: <33DF4527 DOT 671 AT mindspring DOT com> <kn5WwGAfZ$3zEwbB AT jenkinsdavid DOT demon DOT co DOT uk>
Reply-To: p DOT steiner AT t-online DOT de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

That´s my circle proc. Circles are almost faster than lines...

Procedure Circle(x0,y0,r:Integer); 

Var
 x,y,b,h: Integer;

Begin
 x:=r; y:=r; b:=0; h:=0;

 Plot(x0+x,y0);  Plot(x0-x,y0);
 Plot(x0,y0+x);  Plot(x0,y0-x);

 while x>h do Begin
   inc(h); y:=y-h;

   if y<=0 then Begin  inc(b); x:=r-b; y:=y+x;  end;

   Plot(x0+x,y0+h);  Plot(x0-x,y0+h);
   Plot(x0+h,y0+x);  Plot(x0+h,y0-x);
   Plot(x0-x,y0-h);  Plot(x0+x,y0-h);
   Plot(x0-h,y0-x);  Plot(x0-h,y0+x);
 end;

End;


-- 
   _   x    ___
  / \_/_\_ /,--'  p DOT steiner AT t-online DOT de (Peter Steiner)
  \/>'~~~~//
    \_____/   signature V0.2 alpha

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019