11-27-2022, 01:44 AM
(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?