Previous | Next --- Slide 49 of 78
Back to Lecture Thumbnails

Are there alternative rules out in the wild, or is this the industry standard?


This is the classic (and one of the most basic) line drawing algorithm, but there are others as well. One of the problems with the approach shown above is that the line looks a little jagged. Xiaolin Wu's line algorithm is another example of a line drawing algorithm that produces a smoother (i.e. higher-quality) result, and this might be the preferred way to go for some applications where visual quality is more important than performance (e.g., photoshop).


Using integer rounding for determining intersection with a pixel, is it possible for there to be "holes" so to speak? And kind of like flickering artifacts if using that kind of discretization in something like an animation?


If a line drawing algorithm produces a line with "holes", it's probably not a very good one. ;-) Applying this diamond rule produces lines where pixels are turned either "on" or "off", and animating this line will cause pixels values to jump from "off" to "on" or vice versa---which may be undesirable. Xiaolin Wu's line algorithm might be a nice alternative to avoid this "flickering" (for lack of a better word).