Post Reply 
Bresenham Circle VS others
07-04-2021, 06:41 AM (This post was last modified: 07-04-2021 07:03 AM by C.Ret.)
Post: #2
RE: Bresenham Circle VS others
Hi,

Nice implementation indeed, you now have an efficient way of filling your circles without lost of detail or no fill gaps !

Code:
EXPORT FCIRCLE_P(XC,YC,R,Col)
BEGIN
  LOCAL D:=3-2*R,  X:=0,    Y:=R;
  RECT_P(#0);
  WHILE Y>=X DO
     IF D>0   THEN   Y:=Y-1; D:=D+4*(X-Y)+10   ELSE   D:=D+4* X   + 6   END;
     LINE_P(XC+X,YC+Y,XC+X,YC-Y,Col);   LINE_P(XC-X,YC+Y,XC-X,YC-Y,Col);
     LINE_P(XC+Y,YC+X,XC+Y,YC-X,Col);   LINE_P(XC-Y,YC+X,XC-Y,YC-X,Col);
     X:=X+1    END;
  FREEZE
END;

But, you may have explained a bit more the trick you are using with the indicator variable D. Are the definition correct for any value of radius R or is there any hidden beast in the eke ?

It also a bit of a shame, you don't have post this related subject in your previous thread, since it is closely related, this will have help readers and subscribers to easier follow your progress.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Bresenham Circle VS others - matalog - 07-04-2021, 01:10 AM
RE: Bresenham Circle VS others - C.Ret - 07-04-2021 06:41 AM
RE: Bresenham Circle VS others - C.Ret - 07-04-2021, 03:05 PM



User(s) browsing this thread: 2 Guest(s)