Scan Conversion Distillation

- Introduction (who am I)
- Review of definitions
- Polygon fill rules
- Two approaches to Scan Conversion
- Triangulate, render trangles
- General Purpose (e.g. Sample-Point algorithm)

- Assignment 3 - Interactive Viewer for 3-D Convex Objects

This discussion section is intended to distill some confusion that inevitably results when learning this topic for the first time. Let's first focus on some of the terminology that you've heard thrown around and make sure these are clear.

`number_of_edges_crossed_so_far`

to be zero. Increase the x value and add one to `number_of_edges_crossed_so_far`

for every edge we cross on that scan line. Then use the following criteria
for pixel inclusion or exclusion:A pixel is

`number_of_edges_crossed_so_far`

is `number_of_edges_crossed_so_far`

is Think of the polygon as a path in the snow that someone has left. There is a flagpole sitting on a point in the region in question, and a rubber band connecting you to the flagpole. You traverse the snow path completely and finish back at where you started. If when you look at the flagpole the rubber band has been wrapped around once, then you have a winding of one. The winding number is negative if it's wrapped clockwise. If its final position is the same as its initial position, then you have zero windings and it's outside the polygon! (remember

An easier way of thinking about the winding rule conceptually is to think
of putting your finger in the point in question. If it's possible to pull
the polygon away (imagine that the polygon's edges are traced in string
on a table) then the point is outside, otherwise it's inside. This is a
much faster method than the previous. Try this for several self-intersecting
polygons to convince yourself.

How does one implement a guy walking in the snow with a rubber band tied
to his behind in C? Aha! We're glad you asked. (This is paraphrased from
page 965 in **Computer Graphics: Principles and Practice**
if you are confused by my explanation). First, we must note that it's important
to order the directions of the edges so that you could walk around the snowy
path (in either direction) always going in the direction of the arrows.
I.e. every edge's ending vertex is another edge's starting vertex.

Instead of keeping track of `number_of_edges_crossed_so_far`

,
as in the even/odd method, keep track of the number of edges which point
upwards and downwards. Figure 7 shows examples of edges
which fulfill each criteria.

Every upward pointing edge gets a value of 1 and every downward pointing
edge gets a value of -1. The sum of these numbers for every edge in the
AEL is the winding number. If the sum is zero, as we recall from a couple
lines before, then the point is outside, otherwise it's not. How do we determine
if an edge is pointing upward or downward (think about the difference between
*y* value of the starting and ending vertices)? Again, convince yourself
of this using several small examples. Does it represent the same filling
pattern as the odd-even rule did? Compare figure 8 below
to figure 5 above.

It's important to note that the line in figure 7 doesn't
**have** to be a scan line. It can be any curve which starts
from infinitely far away and outside the polygon. Upward-pointing edges
are edges that begin from the left of the curve, cross the curve (Why did
the edge cross the curve? To get to the other side!), and end on the left
of the curve. Similarly for downward-pointing edges.

WWW Maven: Dan Garcia (ddgarcia@cs.berkeley.edu) Send me feedback