Problem of scan converting triangles. Now that we have converted our general polygon into a set of triangles, we can look at the problem of scan converting the triangle.
Start with top Scan Line: For each scan line, find intersection points with triangle, turn on pixels inside triangle. Note that there will be two intersection points for each scan line, so, one side of the triangle will not be intersected by any given scan line. If we keep track of the Ytop value for the edges, then only those edges for which Ytop <= current scan line may have intersections, e.g., for scan line 1 the only edges are ab and ac, not cb. we need to keep track of edges which can no longer be intersected by the current scan line, e.g., ac for scan line 2.
We could keep the bottom Y value for each edge and compare against the current scan line. Instead, we will keep the length (delta Y) of each polyline. We will decrement this each time we move down a polyline and the edge can no longer be intersected when delta Y = 0.
We need to keep the bottom Y value for the triangle to know when we are done. We also need to compute the intersection of each scan line with the edges. We could perform a brute force computation, i.e., for each scan line compute using:
but it is better to use coherence property (related properties), i.e., compute the intersection using the intersection value from the previous scan line.
For IBM CGA, EGA, VGA, and many other graphics boards:
So can find 1st pair x, y then use above to find intersections with other scan lines.
Data Structure: each entry in edge list contains
Top Level Algorithm:
Solid Polygon menu
HyperGraph Table of Contents.
HyperGraph Home page.