Title: Midterm Review
1Midterm Review
- Ceng 477
- Introduction to Computer Graphics
- Computer Engineering
- METU
2Review Topics
- The Graphics Pipeline
- Output primitives line drawing, circle drawing
algorithms - Filled Area Primitives polygon filling
algorithms - Geometric transformation 2D/3D transformation,
composite transformations - 2D Viewing Viewing transformations, line
clipping, polygon clipping algorithms
3The Graphics Pipeline
Modeling Transformations
Viewing Transformations
M1
V
M2
M3
WCS
VCS
MCS
Normalization Transformation and Clipping
Viewport Transformation
Projection Transformation
Normalized coordinates
Projection
DCS SCS
2D Image
Rasterization
4Midterm Review Exercise 1
- Using the Cohen-Sutherland line clipping
algorithm clip the following line
5Solution
6Midterm Review Exercise 2
- We want to put a mirror in a 3D scene. The mirror
is specified as a 3D rectangle specified with its
corner points and with one of its principle axes
parallel to the y axis and the other parallel to
the xz plane (illustrated below).
y
parallel to xz plane
x
z
Give the transformation matrix that will generate
mirror objects of all the objects in the scene
(you may assume all the objects are in front of
the mirror). And show the results as a product of
matrices.
7Solution
y
- Basically what we are asked is reflection with
respect to a plane. - We can formulate this with a composite
transformation - Align the mirror plane with one of the planes,
e.g., yz plane - Compute reflection wrt to yz plane
- Restore the mirror planes original position and
orientation
x
z
8Solution
- Align the mirror plane with one of the planes,
e.g., yz plane - Translate P1 onto the y axis.
- Rotate the plane so that P2 is on the z axis.
y
x
z
y
x
z
9Solution
- Reflection around yz plane is just inversion of x
coordinate - Reflection around yz.
- Do the reverse transformations rotate 45 degrees
counterclockwise and translate P1 back to
(3,10,-1) to finish the composite transformation.
y
x
z
Final Solution T(3,0,-1)Ry(45)Refyz(
)Ry(-45)T(-3,0,1)
10Midterm Review Exercise 3
- Write the contents of the sorted edge table for
the given polygon. Assume the scan conversion
starts from the bottom scan line. - Which edges are in the Active Edge List at scan
line 4? - Show the double or single counted vertices. But
you do not need to consider their updated values
when filling in the edge table
11Solution
- The vertex A is the bottommost vertex. Starting
from vertex A fill in the Sorted Edge table. - E is the only vertex that need to be counted
once, so we need update the edge FE to FE. The
other vertices are not need to be updated.
12Solution
The sorted edge table
Y E1 E2
1 AB AG
2 FG FE
3 CB CD
4 ED
13Solution
The contents of the sorted edge table
Y Xinit, Ymax,1/m Xinit, Ymax,1/m
1 AB 1,6,0 AG 1,3,1
2 FG 6,3,-3 FE 6,4,2
3 CB 6,6,-5/3 CD 6,6,2/3
4 ED 10,6,-1
At scanline 4 AB,CB,CD,ED are active (FE is
just dropped from the list)