Solid Area Scan Conversion
Solid Area Scan Conversion
Mask
Shading Rule
Compute the intensity of each pixel inside
Color variation
Priority
If more than one solid area overlaps, the priority
defines which area should be on top
Polygons
Boundaries / Outlines
Ordered list of vertices
(1,7)(9,7)(9,2)(5,5)(1,1)
Start from any vertices
Adjacent vertices represent edges
Last vertex ?
Might be represented by list of edges
How to speed up ?
Coherence
x<1
1x 9
x>9
YX Algorithm
Build a list of all (x,y) intersections
Sort the list & Group together, as x value increases
For (x1,y1) and (x2,y2)
(x1,y1) should precede (x2,y2)
YX Algorithm
The order of x, y can be changed
Pixels are grouped based on
Topological properties ( in out )
Geometrical properties ( adj on the same scan line )
Solution
Adjust the vertex move up / down
Use only integer values for vertex representation
Singularities
Intersection must be recorded differently
Based on direction of successive edges
Up / down = only one intersection
Up down (or) down up = intersection must be
repeated.
Singularity Algorithm
Solution
Sampling
More precise calculations are needed at edges
To know what fraction of the pixel is covered
Based on the fraction, the pixels can be toned.
Where we can avoid/no need sampling ???
Four methods
Steep edge
Shallow angle Edge
Increased Resolution
Polygon Clipping
Sampling
Steep edge, |dx| < 1
If the edge is at the left of the polygon
= Floor(x) + 1 x
Here = ?
Right edge
= x - Floor(x)
Sampling
Shallow angle edge
If the edge passes at a shallow angle, |dx| > 1
Several pixels require fractional intensities
Fractional area
0 at xleft = x - |dx|/2
1 at xright = x + |dx|/2
= ((2i + 1) (2x dx)) / 2|dx|
If i = 3, = ?
Sampling Method 3
Consider a polygon with narrow edges
Sampling Method 4
Fraction Algorithm
1. Assume an array fraction(x) to hold fractional coverage for each
pixel x.
2. Set fraction (x) = 0 for all the pixels on the scan line
3. Set s = 1
4. Remove an interval [xl,xr] from intersection list
If Floor (xl) = Floor (xr), use method 1, x= floor(xl)
Fraction (x) = fraction (x) + s
Else
Fraction (x) = fraction (x) + s , Floor(xl) x Floor(xr)
For all x > floor(xr), update the fraction
Set s = -1
5. Goto Step 4
6. Stop when no intervals remain
Disadvantages
The object with highest priority comes last
Appear one-by-one in random order
Scan conversion must be row-by-row, not
polygon-by-polygon
Difficulties
Large list of triples
Causes the sorting slow down
Bucket sort
Elements are distributed among bins
P-Y-X
Polygons are sorted by priority first, then Y-X
simple
efficient, adv. Edge coherence
36
37
16.9
16.12
16.13
16.14
16.21
Principles of Interactive Computer Graphics
William M. Newman, Robert F. Sproull
McGraw-Hill, 1979
38