Fast filled circle
#8
(11-26-2022, 11:13 PM)mdijkens Wrote: Thanks bplus for the excellent example.
It got me thinking about BF option; why is it there? It seems unneeded.

After experimenting, I found that the BF option, even with single line makes drawing the line 5x faster!
Against common sense I added the BF option to the line statements in my code and surprise... it was 5x faster also.

As I've explained to bplus and a few others before, it makes perfect sense once you take a second to think about it...

How do you calculate a vertical line??   A horizontalntal line?  Or a box?

for y = start to finish
    memfill (xpos,y) to (xpos2, y), color
next

......

Now, how do you calculate and plot a sloped line?
for y = start to finish step yslope
   for x = start to finish step xslope
        plot x, y, color
   next
next 

.....  The first, you just fill a whole chunk of memory with one set of values in a single pass...   For the second, you do a lot of math to calculate your slope and plot each point as you move upon that slope.


Now, which is going to be faster than the other?  Smile
Reply


Messages In This Thread
Fast filled circle - by mdijkens - 11-26-2022, 03:20 PM
RE: Fast filled circle - by CharlieJV - 11-26-2022, 03:58 PM
RE: Fast filled circle - by bplus - 11-26-2022, 04:19 PM
RE: Fast filled circle - by dbox - 11-26-2022, 10:43 PM
RE: Fast filled circle - by bplus - 11-26-2022, 10:54 PM
RE: Fast filled circle - by mdijkens - 11-26-2022, 11:13 PM
RE: Fast filled circle - by bplus - 11-26-2022, 11:29 PM
RE: Fast filled circle - by SMcNeill - 11-27-2022, 01:44 AM
RE: Fast filled circle - by SMcNeill - 11-27-2022, 01:46 AM
RE: Fast filled circle - by gaslouk - 11-27-2022, 04:50 AM



Users browsing this thread: 2 Guest(s)