LoginLogin

Xiaolin Wu's Anti-aliased Lines Algorithm

Root / Submissions / [.]

HackTheWorldsCreated:
Download:5R3358KV
Version:1.0.0Size:
Draw anti-aliased lines in SmileBASIC! This program draws anti-aliased lines using Xiaolin Wu's line algorithm. I copied it almost verbatim so there is no optimization as of yet. Future Plans
  • Color control
  • Speed optimization
  • Line thickness control

Instructions:

Run the example or use the command in your programs.

Fantastic! This is interesting However, it is very slow, I ran some tests: On average it takes 9.87 milliseconds to draw a line across the screen GLINE takes 0.019 milliseconds to do the same thing So AALINE is approximately 496.33 times slower than GLINE It is still very interesting I'll definitely be studying this code in the future.

Replying to:Simeon
Fantastic! This is interesting However, it is very slow, I ran some tests: On average it takes 9.87 milliseconds to draw a line across the screen GLINE takes 0.019 milliseconds to do the same thing So AALINE is approximately 496.33 times slower than GLINE It is still very interesting I'll definitely be studying this code in the future.
But Simeon, you didnt say that antialiasing was practically putting a 1pixel radius blur?

Replying to:Simeon
Fantastic! This is interesting However, it is very slow, I ran some tests: On average it takes 9.87 milliseconds to draw a line across the screen GLINE takes 0.019 milliseconds to do the same thing So AALINE is approximately 496.33 times slower than GLINE It is still very interesting I'll definitely be studying this code in the future.
¯\_(ツ)_/¯ Pass Lol jk, but that's slightly unrelated because actual developers have a huge advantage of resources as opposed to SmileBASICians

Replying to:Simeon
Fantastic! This is interesting However, it is very slow, I ran some tests: On average it takes 9.87 milliseconds to draw a line across the screen GLINE takes 0.019 milliseconds to do the same thing So AALINE is approximately 496.33 times slower than GLINE It is still very interesting I'll definitely be studying this code in the future.
drawing a line with GPSET is already around 100 time slower than GLINE, so there's an upper limit to the speed of any alternate line drawing programs. However, this algorithm actually draws TWO pixels in each position, so it would be 200x slower than GLINE, at best.

I actually made an anti - aliasing algorithm a few days ago and it was insanely fast, but used sprites to work. a line from (0,0) to (200,20) @~1ms