Scan conversion of lines and Polygons
Scan conversion refers to the calculation of the pixels that best
approximate a geometric shape. The applets here attempt to
ilustrate the workings of several algorithms for scan conversion.
Drawing Lines
The DDA (Digital Differential Analyzer) algorithm just uses the
equation of the line.
Bresenham's algorithm is a more efficient
way of drawing lines.
Filling polygons
The simplest way to fill a polygon is to just look at each pixel on
the screen and calculate whether it is inside or outside the polygon.
The scanline algorithm is a much more
efficient way of filling polygons.
All these applets are subclasses of BigPixelApplet which contains all
the code they share. They all use BigPixelCanvas which displays
very big pixels so you can see what is going on.
You can browse all the Java source here.
Tim Lambert
Last modified: Thu Jan 20 02:46:51 EST 2000