Skip to main content

News

Topic: Wu Lines - better than Bresenham! (Read 5161 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Wu Lines - better than Bresenham!
An article and pseudocode implementation for Wu Anti-Aliased Lines, a fixed/floating point implementation of a line drawer from a Michael Abrash book:

http://freespace.virgin.net/hugo.elias/graphics/x_wuline.htm

I use it for my line function in my open-source phoenix tutorial app!


  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Wu Lines - better than Bresenham!
Reply #1
I dunno. You say it's better, but in your screenshot the lines look like dotted lines instead of straight, unbroken lines. The lines at the bottom of the linked page look good, though.

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Wu Lines - better than Bresenham!
Reply #2
I probably should've highlighted the fact that Wu lines are for anti-aliased lines. Re my specific implementation, I wouldn't be surprised if I screwed something up along the way. :/

Re: Wu Lines - better than Bresenham!
Reply #3
It looks like each row/collumn in the weaker direction is not heavy enough. Like it just needs a little tweaking.

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Wu Lines - better than Bresenham!
Reply #4
Indeed, I screwed up my implementation. I passed the wrong colors to the plot function assuming that the multiplication was going to work a certain way; everything else was fine, though.

It is now fixed!

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Wu Lines - better than Bresenham!
Reply #5
Sweet! That's some awesome stuff right there, :)
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Wu Lines - better than Bresenham!
Reply #6
Looks much better!