Beyond Bresenham
Most books would have you believe that the development of line drawing
algorithms ended with Bresenham's famous algorithm. But there has been
some signifcant work since then. The following 2-step algorithm, developed
by Xiaolin Wu, is a good example. The interesting story of this algorithm's development
is discussed in an article that appears in
Graphics Gems I
by Brian Wyvill.
The two-step algorithm takes the interesting approach of treating line
drawing as a automaton, or finite state machine. If one looks at the possible
configurations that the next two pixels of a line, it is easy to see that
only a finite set of possiblities exist.
The two-step algorithm also exploits the symmetry of line-drawing by
simultaneously drawn from both ends towards the midpoint.
The code, which is here, is a bit long to show an a slide.
|