Bresenham Circle VS others

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

07042021, 06:41 AM
(This post was last modified: 07042021 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) 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. 

07042021, 12:17 PM
Post: #3




RE: Bresenham Circle VS others
I find these graphics programs fascinating.
I had to grok m's code to figure out how to get an output from c's code. (eg. 160,120,100,255) gave me a blue circle. Explanations of bresenham's algorithm tend be very detailed. Meanwhile I found this link for the bitmap/midpoint circle algorithm: http://rosettacode.org/wiki/Bitmap/Midpo..._algorithm Thanks again. 

07042021, 03:05 PM
Post: #4




RE: Bresenham Circle VS others
(07042021 12:17 PM)Liamtoh Resu Wrote: [...]I had to grok m's code to figure out how to get an output from c's code. Sorry, I don't have commented the code in my previous post. The Col variable is expecting regular color code for the HP Prime. The best way is to use the RGB(r,b,g,α) function or a valid structured #rrggbbαα binary integer. Beware that in this code, I produce the method used by matalog and I am not sure that the variable D is correctly set. 

07072021, 09:13 PM
Post: #5




RE: Bresenham Circle VS others
The true beauty of Bresenham’s algorithm is that the calculations are limited to integer addition, integer subtraction and integer x4 which can be implemented as shift left by 2 bits. All of which means the algorithm can be implemented in assembly language/machine code for stunning speed on the most basic of processors.
If you want to see an HP48 implementation in assembly language have a look at glib. 

« Next Oldest  Next Newest »

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