Edge-Walking Triangle Rasterizer
Notes on edge walking:
- Sort the vertices in both x and y
- Determine if the middle vertex, or breakpoint
lies on the left or right side of the polygon.
If the triangle has an edge parallel to the scanline
direction then there is no breakpoint.
- Determines the left and right extents for each scanline
(called spans).
- Walk down the left and right edges filling the pixels
in-between until either a breakpoint or the bottom vertex
is reached.
Advantages and Disadvantages:
- Generally very fast
- Loaded with special cases
(left and right breakpoints, no breakpoints)
- Difficult to get right
- Requires computing fractional offsets when
interpolating parameters across the triangle
The algorithm described in the book is an edge-walking algorithm.
|