Spherical forums

Creations => Programming => Topic started by: N E O on November 25, 2013, 02:08:08 pm

Title: Wu Lines - better than Bresenham!
Post by: N E O on November 25, 2013, 02:08:08 pm
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 (http://freespace.virgin.net/hugo.elias/graphics/x_wuline.htm)

I use it for my line function in my open-source phoenix tutorial app (https://github.com/apollolux/hello-phoenix)!

(http://i.imgur.com/02CVvh1.png)
Title: Re: Wu Lines - better than Bresenham!
Post by: DaVince on November 25, 2013, 02:52:01 pm
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.
Title: Re: Wu Lines - better than Bresenham!
Post by: N E O on November 25, 2013, 03:20:49 pm
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. :/
Title: Re: Wu Lines - better than Bresenham!
Post by: Flying Jester on November 25, 2013, 04:38:06 pm
It looks like each row/collumn in the weaker direction is not heavy enough. Like it just needs a little tweaking.
Title: Re: Wu Lines - better than Bresenham!
Post by: N E O on November 29, 2013, 02:04:42 am
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!
(http://i.imgur.com/OojgDtf.png)
Title: Re: Wu Lines - better than Bresenham!
Post by: Radnen on November 29, 2013, 02:35:38 pm
Sweet! That's some awesome stuff right there, :)
Title: Re: Wu Lines - better than Bresenham!
Post by: DaVince on November 30, 2013, 10:29:16 am
Looks much better!