Docsity

3 Problems on Computer Graphics I with Solution - Homework 5 | CS 4620, Assignments of Computer Graphics

Toggle sidebar
bg1
CS 465 Homework 5 Solutions
Problem 1: Rasterization. A particular triangle, when rasterized, produces the following fragments,
each with pixel coordinates (xs,y
s)and screen-space depth zs.
xsyszs
13 22 19.2000
14 22 19.4000
10 23 18.9000
11 23 19.1000
12 23 19.3000
13 23 19.5000
10 24 19.2000
11 24 19.4000
12 24 19.6000
10 25 19.5000
11 25 19.7000
12 25 19.9000
11 26 20.0000
Table 1: The fragments table
What are the (x, y )coordinates and depths of the triangle’s three vertices? Hint: The answer is not
unique.
Answer: All answers should satisfy:
(i) All of and only those segments lie in the triangle;
(ii) The depths of the coordinates satisfy zi=19.2+0.2(xi−13) + 0.3(yi−22) = 0.2xi+
0.3yi+10.
One possible solution is (9.5,23,18.8),(14.5,21.5,19.35 ) and (10.5,27.5,20.35).
The MATLAB script posted on the website is for viewingthe segments.
Problem 2: Mesh representations. The half-edge table in Table 2 represents a triangle mesh.
1. Express the same mesh as an indexed mesh.
2. What’s the shape of the mesh? The answer is not unique, but different answers have the same
topology.
Answer: Most simple meshes can be pushed down and drawn on to the plain. In this question,
we can also try to draw following triangles on the plane (Fig 1, in which the numbers repre-
sent the edges): (0,8,15),(1,22,16),(2,10,9),(3,17,18),(4,12,11),(5,19,20),(6,14,13) and
1
pf3
pf4

Partial preview of the text

Download 3 Problems on Computer Graphics I with Solution - Homework 5 | CS 4620 and more Assignments Computer Graphics in PDF only on Docsity!

Problem 1: Rasterization. A particular triangle, when rasterized, produces the following fragments, each with pixel coordinates (xs, ys) and screen-space depth zs.

xs ys zs 13 22 19. 14 22 19. 10 23 18. 11 23 19. 12 23 19. 13 23 19. 10 24 19. 11 24 19. 12 24 19. 10 25 19. 11 25 19. 12 25 19. 11 26 20.

Table 1: The fragments table

What are the (x, y) coordinates and depths of the triangle’s three vertices? Hint : The answer is not unique.

Answer: All answers should satisfy:

(i) All of and only those segments lie in the triangle; (ii) The depths of the coordinates satisfy zi = 19.2 + 0.2(xi − 13) + 0.3(yi − 22) = 0. 2 xi +

  1. 3 yi + 10.

One possible solution is (9. 5 , 23 , 18 .8), (14. 5 , 21. 5 , 19 .35) and (10. 5 , 27. 5 , 20 .35).

The MATLAB script posted on the website is for viewing the segments.

Problem 2: Mesh representations. The half-edge table in Table 2 represents a triangle mesh.

  1. Express the same mesh as an indexed mesh.
  2. What’s the shape of the mesh? The answer is not unique, but different answers have the same topology.

Answer: Most simple meshes can be pushed down and drawn on to the plain. In this question, we can also try to draw following triangles on the plane (Fig 1, in which the numbers repre- sent the edges): (0, 8 , 15), (1, 22 , 16), (2, 10 , 9), (3, 17 , 18), (4, 12 , 11), (5, 19 , 20), (6, 14 , 13) and

hedge pair next 0 1 8 1 0 22 2 3 10 3 2 17 4 5 12 5 4 19 6 7 14 7 6 21 8 9 15 9 8 2 10 11 9 11 10 4 12 13 11 13 12 6 14 15 13 15 14 0 16 17 1 17 16 18 18 19 3 19 18 20 20 21 5 21 20 23 22 23 16 23 22 7

Table 2: The half-edge table

(7, 21 , 23). The (0, 8 , 15), for instance, comes from the ring 0 → 8 → 15 → 0 in the table. Note all triangles except the (5, 19 , 20) are counterclockwise, and (5, 19 , 20) is clockwise because it is pointing back to us.

Now pull it up from the plane we can see the mesh is a octohedren (or any other shape with the same topology), as shown in Fig. 2 (the numbers represent the vertices). Table 3 shows one possible way of indexed mesh representation.

Problem 3: Triangle Strips. Given a cube, by dividing each face into two triangles, we could create a mesh with 12 triangles. Figure 3 illustrates one possible way of dividing the faces. We can use 3 triangle strips to represent the mesh: (3, 1 , 4 , 5 , 8 , 6 , 7 , 2 , 3 , 1), (1, 2 , 5 , 6) and (4, 8 , 3 , 7).

By changing how the cube is divided into triangles, you can get away with fewer strips. Find a triangulation and a set of triangle strips that represent the cube with as few strips as possible.

Answer: Figure 4 is a way to divide the faces, and the strip is (6, 1 , 2 , 3 , 6 , 7 , 8 , 3 , 4 , 1 , 8 , 5 , 6 , 1).

Figure 3: Triangle mesh of a cube

Figure 4: Solution to the cube triangle mesh