SlideShare a Scribd company logo
1 of 80
Computer Graphics
Filling & Color
Basics Of Color
• elements of color:
Basics of Color
• Physics:
– Illumination
• Electromagnetic spectra
– Reflection
• Material properties
• Surface geometry and microgeometry
• Perception
– Physiology and neurophysiology
– Perceptual psychology
Electromagnetic Spectrum
How well do we see color?
• What color do we see the best?
–Yellow-green at 550 nm
• What color do we see the worst?
–Blue at 440 nm
• Flashback: Color tables (color maps) for
color storage
Humans and Light
• when we view a source of light, our eyes
respond to
– hue: the color we see (red, green, purple)
• dominant frequency
– saturation: how far is color from grey
• how far is the color from gray (pink is less
saturated than red, sky blue is less saturated than
royal blue)
– brightness: how bright is the color
• how bright are the lights illuminating the object?
Hue
• hue (or simply, "color") is dominant wavelength
– integration of energy for all visible wavelengths is
proportional to intensity of color
Saturation or Purity of Light
• how washed out or how pure the color of
the light appears
– contribution of dominant light vs. other
frequencies producing white light
Intensity, Brightness
• intensity : radiant energy emitted per unit
of time, per unit solid angle, and per unit
projected area of the source (related to the
luminance of the source)
• brightness : perceived intensity of light
Combining Colors
Additive (RGB)
Shining colored lights
on a white ball
Subtractive (CMYK)
Mixing paint colors and
illuminating with white light
Colour Matching Experiment
Target colour
Mixing of 3 primaries
Adjust intensities to match the colour
overlap
RGB Color Space (Color Cube)
• Define colors with (r, g, b) amounts of red,
green, and blue
CMY Color Model
CMY (short for Cyan, Magenta, Yellow,
and key) is a subtractive color model.
The CMY Color Model
• Cyan, magenta, and yellow are the
complements of red, green, and blue
– We can use them as filters to subtract from white
– The space is the same as RGB except the origin
is white instead of black
• This is useful for hardcopy
devices like laser printers
– If you put cyan ink on the page, no red light is
reflected
































B
G
R
Y
M
C
1
1
1
YIQ Color Space
•YIQ is the color model used for color TV
in America. Y is brightness, I & Q are
color
– Note: Y is the same as Color space XYZ
– Result: Use the Y alone and backwards
compatibility with B/W TV!
– I and Q are hue and purity
– These days when you convert RGB image to
B/W image, the green and blue components are
thrown away and red is used to control shades
of grey (usually)
Converting Color Spaces
• Y = 0.299 R + 0.587 G + 0.114 B
• I = R – Y
• Q = B – Y
• Converting between color models can
also be expressed as such a matrix
transform:
• Note the relative unimportance of blue
in computing the Y


































B
G
R
Q
I
Y
31
.
0
52
.
0
21
.
0
32
.
0
28
.
0
60
.
0
11
.
0
59
.
0
30
.
0
Converting Color Spaces

































Q
I
Y
B
G
R
1
0
1
194
.
0
509
.
0
1
0
1
1
HSV Color Space
• A more intuitive color space
– H = Hue
– S = Saturation
– V = Value (or brightness)
Value
Saturation
Hue
HSV Color Model
Figure 15.16&15.17 from H&B
H S V Color
0 1.0 1.0 Red
120 1.0 1.0 Green
240 1.0 1.0 Blue
* 0.0 1.0 White
* 0.0 0.5 Gray
* * 0.0 Black
60 1.0 1.0 ?
270 0.5 1.0 ?
270 0.0 0.7 ?
Intuitive Color Spaces
Halftoning
• A technique used in newspaper printing
• Only two intensities are possible, blob of ink and
no blob of ink
• But, the size of the blob can be varied
• Also, the dither patterns of small dots can be used
Halftoning
Halftoning – dot size
Spatial versus Intensity
Resolution
• Halftone Approximation: Dither
– n  n pixels encode n2 + 1 intensity levels
• The distribution of intensities is
randomized: dither noise, to avoid
repeating visual artifacts
Dithering
• Halftoning for color
images
Filling Polygons
• So we can figure out how to draw lines
and circles
• How do we go about drawing polygons?
• We use an incremental algorithm known
as the scan-line algorithm
27
Polygon
• Ordered set of vertices (points)
– Usually counter-clockwise
• Two consecutive vertices define an edge
• Left side of edge is inside
• Right side is outside
• Last vertex implicitly connected to first
• In 3D vertices are co-planar
Filling Polygons
• Three types of polygons
1. Simple convex 2. simple concave 3. non-simple
(self-intersection)
Convex polygons have the property that intersecting lines
crossing it either one (crossing a corner), two (crossing an edge,
going through the polygon and going out the other edge), or an
infinite number of times (if the intersecting line lies on an edge).
Convex
Does a straight line connecting ANY two
points that are inside the polygon intersect
any edges of the polygon?
Concave
The polygon edges may also touch each
other, but they may not cross one another.
Complex
Complex polygons are basically concave
polygons that may have self-intersecting
edges. The complexity arises while
distinguishing which side is inside the
polygon when filling it.
Some Problems
1. Which pixels should be filled in? 2. Which happened to the top
pixels? To the rightmost pixels?
Flood Fill
• 4-fill
– Neighbor pixels are only up, down, left, or
right from the current pixel
• 8-fill
– Neighbor pixels are up, down, left, right,
or diagonal
4 vs 8 connected
Define: 4-connected versus 8-connected,
its about the neighbors
4 vs 8 connected
 Fill Result: 4-connected versus 8-connected
“seed pixel”
Flood Fill
• Algorithm:
1.Draw all edges into some buffer
2.Choose some “seed” position inside the area
to be filled
3.As long as you can
1.“Flood out” from seed or colored pixels
» 4-Fill, 8-Fill
Flood Fill Algorithm
void boundaryFill4(int x, int y, int fill, int boundary)
{
int curr;
curr = getPixel(x, y);
if ((current != boundary) && (current != fill))
{
setColor(fill);
setPixel(x, y);
boundaryFill4(x+1, y, fill, boundary);
boundaryFill4(x-1, y, fill, boundary);
boundaryFill4(x, y+1, fill, boundary);
boundaryFill4(x, y-1, fill, boundary);
}
}
Seed Position
Fill “Color”
Edge “Color”
Scan-Line Polygon Example
Polygon
Vertices
Maxima /
Minima
Edge
Pixels
Scan
Line Fill
Scan Line Algorithms
Create a list of vertex events (bucket sorted by y)
Initialize all of the edges
• For each edge, the following information needs to be
kept in a table:
1. The minimum y value of the two vertices
2. The maximum y value of the two vertices
3. The x value associated with the minimum y value
4. The slope of the edge
An Example
0 (10, 10)
1 (10, 16)
2 (16, 20)
3 (28, 10)
4 (28, 16)
5 (22, 10)
Scan-Line Polygon Fill
Algorithm
2
4
6
8
10 Scan Line
0
2 4 6 8 10 12 14 16
Scan-Line Polygon Fill
Algorithm
• The basic scan-line algorithm is as
follows:
– Find the intersections of the scan line with
all edges of the polygon
– Sort the intersections by increasing x
coordinate
– Fill in all pixels between pairs of
intersections that lie interior to the polygon
45
Scanline Algorithms
• given vertices, fill in the pixels
arbitrary polygons
(non-simple, non-convex)
• build edge table
• for each scanline
• obtain list of intersections, i.e., AEL
• use parity test to determine in/out
and fill in the pixels
triangles
• split into two regions
• fill in between edges
Scan-Line Polygon Fill Algorithm
(cont…)
Examples:
Solutions:
Scan Line Algorithms
Create a list of the edges intersecting the first scanline
Sort this list by the edge’s x value on the first scanline
Call this the active edge list
1. Horizontal Edges
Polygon Fill
B C
A
F
D
E
Parity
0 = even
1 = odd
Parity 0
1
0
Polygon Fill 2
B C
A
F
D
E
Parity
0 = even
1 = odd
Parity 0
1
0
1
0
2. Bottom and Left Edges vs. Top
and Right Edges
Edge Tables
• edge table (ET)
– store edges sorted by y in linked list
• at ymin, store ymax, xmin, slope
• active edge table (AET)
– active: currently used for computation
– store active edges sorted by x
• update each scanline, store ET values + current_x
– for each scanline (from bottom to top)
• do EAT bookkeeping
• traverse EAT (from leftmost x to rightmost x)
– draw pixels if parity odd
Scanline Rasterization Special
Handling
• Intersection is an edge end point, say: (p0, p1, p2) ??
• (p0,p1,p1,p2), so we can still fill pairwise
• In fact, if we compute the intersection of the scanline with
edge e1 and e2 separately, we will get the intersection
point p1 twice. Keep both of the p1.
Scanline Rasterization Special
Handling
• But what about this case: still (p0,p1,p1,p2)
Edge Table
Active Edge Table (AET)
• A list of edges active for current scanline,
sorted in increasing x
y = 9
y = 8
Edge Table Bookkeeping
• setup: sorting in y
– bucket sort, one bucket per pixel
– add: simple check of ET[current_y]
– delete edges if edge.ymax > current_y
• main loop: sorting in x
– for polygons that do not self-intersect, order of
edges does not change between two scanlines
– so insertion sort while adding new edges suffices
Parity (Odd-Even) Rule
Begin from a point outside
the polygon, increasing the x
value, counting the number of
edges crossed so far, a pixel
is inside the polygon if the
number of edges crossed so
far (parity) is odd, and
outside if the number of
edges crossed so far (parity)
is even. This is known as the
parity, or the odd-even, rule.
It works for any kind of
polygons.
Parity starting from
even
odd
odd
odd
odd
even
even
even
Polygon Scan-conversion
Algorithm
Construct the Edge Table (ET);
Active Edge Table (AET) = null;
for y = Ymin to Ymax
Merge-sort ET[y] into AET by x value
Fill between pairs of x in AET
for each edge in AET
if edge.ymax = y
remove edge from AET
else
edge.x = edge.x + dx/dy
sort AET by x value
end scan_fill
Rasterization Special Cases
-Edge Shortening Trick:
-Recall Odd-Parity Rule Problem:
-Implement “Count Once” case with edge shortening:
Count once
Count twice
or
or
Count once
Count twice
or
or
A
B
C
A
B
C
A
B
C
B'
A
B
C
B'
C
B
A
B
C
B
A
B'
B
B'
xA,yB’,1/mAB xC,yB’,1/mCB
Polygon
Rasterization
• Ignore horizontal lines
0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
Polygon
Rasterization
• Ignore horizontal
lines
• Sort edges by
smaller
y coordinate
0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
G
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Polygon
Rasterization
• For each
scanline…
• Add edges
where
y = ymin
• Sorted by x
• Then by dx/dy
0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
G
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
Polygon
Rasterization
Plotting rules for
when segments
lie on pixels
1.Plot lefts
2.Don’t plot rights
3.Plot bottoms
4.Don’t plot tops
0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
G
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
Polygon
Rasterization
• y = 1
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
G
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G 1 2/7 8
A 1 4/2 3
Polygon
Rasterization
• y = 2
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G 1 2/7 2/7 8
A 3 4/2 3
B 8 -3/1 3
C 8 0/3 5
G
Polygon
Rasterization
• y = 3
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G 1 4/7 2/7 8
C 8 0/3 5
G
Polygon
Rasterization
• y = 4
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G 1 6/7 2/7 8
C 8 0/3 5
G
Polygon
Rasterization
• y = 5
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G 2 1/7 2/7 8
D 8 1/4 9
G
Polygon
Rasterization
• y = 6
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G 2 3/7 2/7 8
F 4 -1/2 8
E 6 1/1 9
D 8 1/4 1/4 9
G
Polygon
Rasterization
• y = 7
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G 2 5/7 2/7 8
F 3 1/2 -1/2 8
E 7 1/1 9
D 8 2/4 1/4 9
G
E
Polygon
Rasterization
• y = 8
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
E 8 1/1 9
D 8 3/4 1/4 9
G
E
Polygon
Rasterization
• y = 9
• Delete y = ymax
edges
• Update x
• Add y = ymin
edges
• For each pair
x0,x1, plot from
ceil(x0)
to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9
0
1
2
3
4
5
6
7
8
9
A
B
C
D
F
Edg
e
ymi
n
A 1
G 1
B 2
C 2
D 5
E 6
F 6
Edge x dx/dy ymax
G
E
For each scanline:
1. Maintain active edge list (using vertex events)
2. Increment edge’s x-intercepts, sort by x-intercepts
3. Output spans between left and right edges
Scan Line Algorithms
delete insert replace
Penetrating Polygons
S
I
T
a
2
BG
b
c
3
d
e
1
False edges and new polygons!
Compare z value & intersection when AET is
calculated
Example
Let’s apply the rules to scan line 8 below. We fill in the pixels from
point a, pixel (2, 8), to the first pixel to the left of point b, pixel (4, 8),
and from the first pixel to the right of point c, pixel (9, 8), to one pixel
to the left of point d, pixel (12, 8). For scan line 3, vertex A counts
once because it is the ymin vertex of edge FA, but the ymax vertex of
edge AB; this causes odd parity, so we draw the span from there to
one pixel to the left of the intersection with edge CB.
odd
odd
even even
a b c d
A
B
C
D
E
F
Four Elaborations (cont.)
A B
C D
E
F
G
H
I
J
E
A B
C D
F
G
H
I
J
Halftoning
For 1-bit (B&W) displays, fill patterns with different fill densities can
be used to vary the range of intensities of a polygon. The result is
a tradeoff of resolution (addressability) for a greater range of
intensities and is called halftoning. The pattern in this case should
be designed to avoid being noticed.
These fill patterns are chosen to minimize banding.

More Related Content

Similar to 14485616.ppt

B. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath YogiTekendra Nath Yogi
 
CS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxCS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxlara333479
 
06 image features
06 image features06 image features
06 image featuresankit_ppt
 
02 image processing
02 image processing02 image processing
02 image processingankit_ppt
 
machine learning.pptx
machine learning.pptxmachine learning.pptx
machine learning.pptxAbdusSadik
 
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICSATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICSnehrurevathy
 
lec08-numpy.pptx
lec08-numpy.pptxlec08-numpy.pptx
lec08-numpy.pptxlekha572836
 
Open GL T0074 56 sm3
Open GL T0074 56 sm3Open GL T0074 56 sm3
Open GL T0074 56 sm3Roziq Bahtiar
 
Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterizationMaaz Rizwan
 
Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterizationMaaz Rizwan
 
Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 
Pseudo and Quasi Random Number Generation
Pseudo and Quasi Random Number GenerationPseudo and Quasi Random Number Generation
Pseudo and Quasi Random Number GenerationAshwin Rao
 

Similar to 14485616.ppt (20)

B. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 1.3 By Tekendra Nath Yogi
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
 
CS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxCS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptx
 
Lecture24
Lecture24Lecture24
Lecture24
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
06 image features
06 image features06 image features
06 image features
 
cg mod2.pdf
cg mod2.pdfcg mod2.pdf
cg mod2.pdf
 
02 image processing
02 image processing02 image processing
02 image processing
 
machine learning.pptx
machine learning.pptxmachine learning.pptx
machine learning.pptx
 
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICSATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
 
lec08-numpy.pptx
lec08-numpy.pptxlec08-numpy.pptx
lec08-numpy.pptx
 
Open GL T0074 56 sm3
Open GL T0074 56 sm3Open GL T0074 56 sm3
Open GL T0074 56 sm3
 
Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterization
 
Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterization
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Pseudo and Quasi Random Number Generation
Pseudo and Quasi Random Number GenerationPseudo and Quasi Random Number Generation
Pseudo and Quasi Random Number Generation
 
Displays and color system in computer graphics(Computer graphics tutorials)
Displays and color system in computer graphics(Computer graphics tutorials)Displays and color system in computer graphics(Computer graphics tutorials)
Displays and color system in computer graphics(Computer graphics tutorials)
 
testpang
testpangtestpang
testpang
 
Ch07 linearspacealignment
Ch07 linearspacealignmentCh07 linearspacealignment
Ch07 linearspacealignment
 
SVD.ppt
SVD.pptSVD.ppt
SVD.ppt
 

Recently uploaded

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 

Recently uploaded (20)

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 

14485616.ppt

  • 2. Basics Of Color • elements of color:
  • 3. Basics of Color • Physics: – Illumination • Electromagnetic spectra – Reflection • Material properties • Surface geometry and microgeometry • Perception – Physiology and neurophysiology – Perceptual psychology
  • 5. How well do we see color? • What color do we see the best? –Yellow-green at 550 nm • What color do we see the worst? –Blue at 440 nm • Flashback: Color tables (color maps) for color storage
  • 6. Humans and Light • when we view a source of light, our eyes respond to – hue: the color we see (red, green, purple) • dominant frequency – saturation: how far is color from grey • how far is the color from gray (pink is less saturated than red, sky blue is less saturated than royal blue) – brightness: how bright is the color • how bright are the lights illuminating the object?
  • 7. Hue • hue (or simply, "color") is dominant wavelength – integration of energy for all visible wavelengths is proportional to intensity of color
  • 8. Saturation or Purity of Light • how washed out or how pure the color of the light appears – contribution of dominant light vs. other frequencies producing white light
  • 9. Intensity, Brightness • intensity : radiant energy emitted per unit of time, per unit solid angle, and per unit projected area of the source (related to the luminance of the source) • brightness : perceived intensity of light
  • 10. Combining Colors Additive (RGB) Shining colored lights on a white ball Subtractive (CMYK) Mixing paint colors and illuminating with white light
  • 11. Colour Matching Experiment Target colour Mixing of 3 primaries Adjust intensities to match the colour overlap
  • 12. RGB Color Space (Color Cube) • Define colors with (r, g, b) amounts of red, green, and blue
  • 13. CMY Color Model CMY (short for Cyan, Magenta, Yellow, and key) is a subtractive color model.
  • 14. The CMY Color Model • Cyan, magenta, and yellow are the complements of red, green, and blue – We can use them as filters to subtract from white – The space is the same as RGB except the origin is white instead of black • This is useful for hardcopy devices like laser printers – If you put cyan ink on the page, no red light is reflected                                 B G R Y M C 1 1 1
  • 15. YIQ Color Space •YIQ is the color model used for color TV in America. Y is brightness, I & Q are color – Note: Y is the same as Color space XYZ – Result: Use the Y alone and backwards compatibility with B/W TV! – I and Q are hue and purity – These days when you convert RGB image to B/W image, the green and blue components are thrown away and red is used to control shades of grey (usually)
  • 16. Converting Color Spaces • Y = 0.299 R + 0.587 G + 0.114 B • I = R – Y • Q = B – Y • Converting between color models can also be expressed as such a matrix transform: • Note the relative unimportance of blue in computing the Y                                   B G R Q I Y 31 . 0 52 . 0 21 . 0 32 . 0 28 . 0 60 . 0 11 . 0 59 . 0 30 . 0
  • 18. HSV Color Space • A more intuitive color space – H = Hue – S = Saturation – V = Value (or brightness) Value Saturation Hue
  • 19. HSV Color Model Figure 15.16&15.17 from H&B H S V Color 0 1.0 1.0 Red 120 1.0 1.0 Green 240 1.0 1.0 Blue * 0.0 1.0 White * 0.0 0.5 Gray * * 0.0 Black 60 1.0 1.0 ? 270 0.5 1.0 ? 270 0.0 0.7 ?
  • 21. Halftoning • A technique used in newspaper printing • Only two intensities are possible, blob of ink and no blob of ink • But, the size of the blob can be varied • Also, the dither patterns of small dots can be used
  • 24. Spatial versus Intensity Resolution • Halftone Approximation: Dither – n  n pixels encode n2 + 1 intensity levels • The distribution of intensities is randomized: dither noise, to avoid repeating visual artifacts
  • 26. Filling Polygons • So we can figure out how to draw lines and circles • How do we go about drawing polygons? • We use an incremental algorithm known as the scan-line algorithm
  • 27. 27 Polygon • Ordered set of vertices (points) – Usually counter-clockwise • Two consecutive vertices define an edge • Left side of edge is inside • Right side is outside • Last vertex implicitly connected to first • In 3D vertices are co-planar
  • 28. Filling Polygons • Three types of polygons 1. Simple convex 2. simple concave 3. non-simple (self-intersection) Convex polygons have the property that intersecting lines crossing it either one (crossing a corner), two (crossing an edge, going through the polygon and going out the other edge), or an infinite number of times (if the intersecting line lies on an edge).
  • 29. Convex Does a straight line connecting ANY two points that are inside the polygon intersect any edges of the polygon?
  • 30. Concave The polygon edges may also touch each other, but they may not cross one another.
  • 31. Complex Complex polygons are basically concave polygons that may have self-intersecting edges. The complexity arises while distinguishing which side is inside the polygon when filling it.
  • 32. Some Problems 1. Which pixels should be filled in? 2. Which happened to the top pixels? To the rightmost pixels?
  • 33. Flood Fill • 4-fill – Neighbor pixels are only up, down, left, or right from the current pixel • 8-fill – Neighbor pixels are up, down, left, right, or diagonal
  • 34. 4 vs 8 connected Define: 4-connected versus 8-connected, its about the neighbors
  • 35. 4 vs 8 connected  Fill Result: 4-connected versus 8-connected “seed pixel”
  • 36. Flood Fill • Algorithm: 1.Draw all edges into some buffer 2.Choose some “seed” position inside the area to be filled 3.As long as you can 1.“Flood out” from seed or colored pixels » 4-Fill, 8-Fill
  • 37. Flood Fill Algorithm void boundaryFill4(int x, int y, int fill, int boundary) { int curr; curr = getPixel(x, y); if ((current != boundary) && (current != fill)) { setColor(fill); setPixel(x, y); boundaryFill4(x+1, y, fill, boundary); boundaryFill4(x-1, y, fill, boundary); boundaryFill4(x, y+1, fill, boundary); boundaryFill4(x, y-1, fill, boundary); } } Seed Position Fill “Color” Edge “Color”
  • 38. Scan-Line Polygon Example Polygon Vertices Maxima / Minima Edge Pixels Scan Line Fill
  • 39. Scan Line Algorithms Create a list of vertex events (bucket sorted by y)
  • 40. Initialize all of the edges
  • 41. • For each edge, the following information needs to be kept in a table: 1. The minimum y value of the two vertices 2. The maximum y value of the two vertices 3. The x value associated with the minimum y value 4. The slope of the edge
  • 42. An Example 0 (10, 10) 1 (10, 16) 2 (16, 20) 3 (28, 10) 4 (28, 16) 5 (22, 10)
  • 43. Scan-Line Polygon Fill Algorithm 2 4 6 8 10 Scan Line 0 2 4 6 8 10 12 14 16
  • 44. Scan-Line Polygon Fill Algorithm • The basic scan-line algorithm is as follows: – Find the intersections of the scan line with all edges of the polygon – Sort the intersections by increasing x coordinate – Fill in all pixels between pairs of intersections that lie interior to the polygon
  • 45. 45 Scanline Algorithms • given vertices, fill in the pixels arbitrary polygons (non-simple, non-convex) • build edge table • for each scanline • obtain list of intersections, i.e., AEL • use parity test to determine in/out and fill in the pixels triangles • split into two regions • fill in between edges
  • 46. Scan-Line Polygon Fill Algorithm (cont…)
  • 49. Scan Line Algorithms Create a list of the edges intersecting the first scanline Sort this list by the edge’s x value on the first scanline Call this the active edge list
  • 51. Polygon Fill B C A F D E Parity 0 = even 1 = odd Parity 0 1 0
  • 52. Polygon Fill 2 B C A F D E Parity 0 = even 1 = odd Parity 0 1 0 1 0
  • 53. 2. Bottom and Left Edges vs. Top and Right Edges
  • 54. Edge Tables • edge table (ET) – store edges sorted by y in linked list • at ymin, store ymax, xmin, slope • active edge table (AET) – active: currently used for computation – store active edges sorted by x • update each scanline, store ET values + current_x – for each scanline (from bottom to top) • do EAT bookkeeping • traverse EAT (from leftmost x to rightmost x) – draw pixels if parity odd
  • 55. Scanline Rasterization Special Handling • Intersection is an edge end point, say: (p0, p1, p2) ?? • (p0,p1,p1,p2), so we can still fill pairwise • In fact, if we compute the intersection of the scanline with edge e1 and e2 separately, we will get the intersection point p1 twice. Keep both of the p1.
  • 56. Scanline Rasterization Special Handling • But what about this case: still (p0,p1,p1,p2)
  • 58. Active Edge Table (AET) • A list of edges active for current scanline, sorted in increasing x y = 9 y = 8
  • 59. Edge Table Bookkeeping • setup: sorting in y – bucket sort, one bucket per pixel – add: simple check of ET[current_y] – delete edges if edge.ymax > current_y • main loop: sorting in x – for polygons that do not self-intersect, order of edges does not change between two scanlines – so insertion sort while adding new edges suffices
  • 60. Parity (Odd-Even) Rule Begin from a point outside the polygon, increasing the x value, counting the number of edges crossed so far, a pixel is inside the polygon if the number of edges crossed so far (parity) is odd, and outside if the number of edges crossed so far (parity) is even. This is known as the parity, or the odd-even, rule. It works for any kind of polygons. Parity starting from even odd odd odd odd even even even
  • 61. Polygon Scan-conversion Algorithm Construct the Edge Table (ET); Active Edge Table (AET) = null; for y = Ymin to Ymax Merge-sort ET[y] into AET by x value Fill between pairs of x in AET for each edge in AET if edge.ymax = y remove edge from AET else edge.x = edge.x + dx/dy sort AET by x value end scan_fill
  • 62. Rasterization Special Cases -Edge Shortening Trick: -Recall Odd-Parity Rule Problem: -Implement “Count Once” case with edge shortening: Count once Count twice or or Count once Count twice or or A B C A B C A B C B' A B C B' C B A B C B A B' B B' xA,yB’,1/mAB xC,yB’,1/mCB
  • 63. Polygon Rasterization • Ignore horizontal lines 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
  • 64. Polygon Rasterization • Ignore horizontal lines • Sort edges by smaller y coordinate 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F G Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6
  • 65. Polygon Rasterization • For each scanline… • Add edges where y = ymin • Sorted by x • Then by dx/dy 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F G Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax
  • 66. Polygon Rasterization Plotting rules for when segments lie on pixels 1.Plot lefts 2.Don’t plot rights 3.Plot bottoms 4.Don’t plot tops 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F G Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax
  • 67. Polygon Rasterization • y = 1 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F G Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G 1 2/7 8 A 1 4/2 3
  • 68. Polygon Rasterization • y = 2 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G 1 2/7 2/7 8 A 3 4/2 3 B 8 -3/1 3 C 8 0/3 5 G
  • 69. Polygon Rasterization • y = 3 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G 1 4/7 2/7 8 C 8 0/3 5 G
  • 70. Polygon Rasterization • y = 4 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G 1 6/7 2/7 8 C 8 0/3 5 G
  • 71. Polygon Rasterization • y = 5 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G 2 1/7 2/7 8 D 8 1/4 9 G
  • 72. Polygon Rasterization • y = 6 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D E F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G 2 3/7 2/7 8 F 4 -1/2 8 E 6 1/1 9 D 8 1/4 1/4 9 G
  • 73. Polygon Rasterization • y = 7 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G 2 5/7 2/7 8 F 3 1/2 -1/2 8 E 7 1/1 9 D 8 2/4 1/4 9 G E
  • 74. Polygon Rasterization • y = 8 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax E 8 1/1 9 D 8 3/4 1/4 9 G E
  • 75. Polygon Rasterization • y = 9 • Delete y = ymax edges • Update x • Add y = ymin edges • For each pair x0,x1, plot from ceil(x0) to ceil(x1) – 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 A B C D F Edg e ymi n A 1 G 1 B 2 C 2 D 5 E 6 F 6 Edge x dx/dy ymax G E
  • 76. For each scanline: 1. Maintain active edge list (using vertex events) 2. Increment edge’s x-intercepts, sort by x-intercepts 3. Output spans between left and right edges Scan Line Algorithms delete insert replace
  • 77. Penetrating Polygons S I T a 2 BG b c 3 d e 1 False edges and new polygons! Compare z value & intersection when AET is calculated
  • 78. Example Let’s apply the rules to scan line 8 below. We fill in the pixels from point a, pixel (2, 8), to the first pixel to the left of point b, pixel (4, 8), and from the first pixel to the right of point c, pixel (9, 8), to one pixel to the left of point d, pixel (12, 8). For scan line 3, vertex A counts once because it is the ymin vertex of edge FA, but the ymax vertex of edge AB; this causes odd parity, so we draw the span from there to one pixel to the left of the intersection with edge CB. odd odd even even a b c d A B C D E F
  • 79. Four Elaborations (cont.) A B C D E F G H I J E A B C D F G H I J
  • 80. Halftoning For 1-bit (B&W) displays, fill patterns with different fill densities can be used to vary the range of intensities of a polygon. The result is a tradeoff of resolution (addressability) for a greater range of intensities and is called halftoning. The pattern in this case should be designed to avoid being noticed. These fill patterns are chosen to minimize banding.