计算机图形代写 | ECS 175 Computer Graphics

这个作业是完成线条绘制和剪切算法
ECS 175 Computer Graphics

Part 1: Line drawing and clipping algorithms (25 points)
1. (6 points) Describe (words and illustration) the DDA algorithm! What is the input, what is the output,
and how does it work?
2. (4 points) Given the two pixels (i1, j1) = (1, 1) and (i2, j2) = (6, 5) (end points of a line segment), what
is the sequence of pixels generated by the DDA algorithm?
3. (8 points) Describe (words and illustration) the Cohen-Sutherland line clipping algorithm for clipping
a single line segment against the four edges of a 2D rectangular region! Which steps are performed when
clipping the line segment with end points p1 = (−0.5, −1.0)T and p2 = (2.5, 2.0)T against the unit square
[0, 1] × [0, 1]? Provide an illustration and give the end points of the line segment being drawn!
2
4. (7 points) Given the point set 
p1 = (−1.0, 0.5)T
, p2 = (0.5, 0.5)T
, p3 = (2.0, 0.5)T
, p4 = (2.0, −0.5)T
,
p5 = (0.5, −0.5)T
, p6 = (0.5, 0.25)T
, p7 = (−1.0, 0.25)T
, p8 = p1 = (−1.0, 0.5)T

defining a closed polygon
with line segments pipi+1, i = 1, …, 7, give the results (illustration and coordinates) of the SutherlandHodgman polygon clipping algorithm when clipping this polygon against the unit square [0, 1] × [0, 1]!
Part 2: Transformations (50 points)
5. (8 points) Give the resulting 3 × 3 transformation matrix for transforming a 2D point (x, y, 1)T
(homogeneous coordinates) by the following sequence of transformations: i.) “translate by the 2D vector (2, 2)T ”;
ii.) “rotate by −90 degrees about the origin”; and iii.) “reflect with respect to the x-axis.” Apply the
resulting 3 × 3 matrix to the 2D point (2, 2, 1)T
(homogeneous coordinates). What is this point’s image (in
homogeneous coordinates)?
3
6. (7 points) Give a sequence of 2D transformations that maps the triangle with vertices v1 = (0, 0)T
,
v2 = (1, 0)T
, and v3 = (0, 1)T
to the triangle with vertices v1
′ = (3, −1)T
, v2
′ = (1, −1)T
, and v3
′ = (3, 0)T
!
Provide an illustration and give the transformation matrices in the order they must be applied to the point
vi
, i = 1, 2, 3!
7. (5 points) Consider projections from 3D space into a 2D plane. What is a parallel projection? What is
an orthographic projection? What is an oblique projection? Illustrate and describe these three projections!
8. (10 points) Given the tetrahedron with vertices v1 = (0, 0, 0)T
, v2 = (1, 0, 0)T
, v3 = (0, 1, 0)T
, and
v4 = (0, 0, 1)T
, give the 4 × 4 transformation matrix that performs an oblique projection onto the plane
z = −2 using the 3D direction vector ~d = (1, 1, −1)T
! What are the x
′ and y

coordinates of the tetrahedron’s
vertices after mapping vi to vi
′ = (xi

, yi

, zi

)
T = (xi

, yi

, −2)T
in the projection plane?
4
9. (5 points) Let the 2D point p have coordinates (x, y)
T with respect to the orthonormal coordinate system
given by the origin o = (0, 0)T and the two basis vectors ~b1 = (1, 0)T and ~b2 = (0, 1)T
. The coordinate
system is rotated by +45 degrees. What are the new coordinates of the point p with respect to the new
coordinate system? Provide an illustration!