The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Bresenham Circle VS others
07-04-2021, 01:10 AM
Post: #1
Bresenham Circle VS others
On the thoughts of Bresenham circles drawn in BASIC languages, I have taken the opportunity to create a VS here, and there is not a lot of difference.

What led me to show this, was my post on FILLPOLY_P(). Although, I suspect that Bresenham's method can't even help the FILLPOLY algorithm, because that algorithm seems to be flawed in some ways, especially for shapes described in more than a rough description of their outline.

Fillpoly() seems to need a distance farther than 2 horizontal or vertical pixels, while still connected by pixels, or it does not work correctly.

Code:
EXPORT BRES2()
BEGIN
RECT_P(0,0,320,240,0);
    LOCAL COORD:={};
  LOCAL A,R,ST;
LOCAL XC,YC,X,Y,R,D;
R:=100;
XC:=160;
YC:=120;
X:=0;
Y:=R;
D:=3-2*R;
ARC_P(160,120,100,RGB(255,0,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;
PIXON_P(XC+X,YC+Y,RGB(0,255,0,0));
PIXON_P(XC-X,YC+Y,RGB(0,255,0,0));
PIXON_P(XC+X,YC-Y,RGB(0,255,0,0));
PIXON_P(XC-X,YC-Y,RGB(0,255,0,0));
PIXON_P(XC+Y,YC+X,RGB(0,255,0,0));
PIXON_P(XC-Y,YC+X,RGB(0,255,0,0));
PIXON_P(XC+Y,YC-X,RGB(0,255,0,0));
PIXON_P(XC-Y,YC-X,RGB(0,255,0,0));
X:=X+1;
WAIT(0.05);
END;
REPEAT 
WAIT (-1);
  IF ISKEYDOWN(4) THEN BREAK(3); END;
 
UNTIL 0;
END;

Obviously the Bresenham method has been slowed down here to show the beautiful way that it draws.
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: 1 Guest(s)