Docsity

Computational Geometry Practice Problems, Assignments of Computer Graphics

Toggle sidebar
bg1
Practice problems - set 5
1. Let’s say that someone gave you a function LookU pColor(x1, y1, x2, y2) which, when called with floating
point arguments x1, y1, x2, y2, returns the intensity of light arriving at (x1, y1,0) from the direction of
(x2, y2,−1). How would you compute intensity for a pixel using that function? Focus on the work that
needs to be done for each pixel. Assume that the viewpoint is at e= (ex, ey, ez), with ez>0, and the
vector from the viewpoint throught the pixel has coordinates [vx, vy, vz], with vz>0. Give all necessary
formulas.
2. What is the result of clipping the line connecting (1,1,1) and (5,10,15) against the cube given by
0≤x, y, z ≤2?
3. Let’s say that each of the six faces of a cube environment map is of distinct solid color. Now, you apply
this cube environment map to a smooth mirror object (let’s say this is the only thing you are rendering
and it’s contained in the view volume). How many colors are you going to see on your image? Will that
depend on the viewpoint and, if so, how?
4. You are clipping a triangle with respect to a rectangular viewport. Can the result have:
a) 3 edges?
b) 4 edges?
c) 5 edges?
d) 6 edges?
e) 7 edges?
For each case, either explain why or draw an example.
5. Can one obtain an 8-gon as a result of clipping a triangle with respect to a rectangle (in 2D)? How
about an 10-gon resulting from clipping a triangle against a cube (in 3D)? Is it possible? Explain your
answers.
6. List (in counterclockwise order) the vertices of the polygon resulting from clipping the triangle with
vertices (0,−5), (5,0) and (−5,5) against the rectangle with vertices (±4,±4)
7. What is the area of the polygon with vertices (in order along the boundary) (0,5), (5,2), (10,1) and
(−2,−3)?
8. Let’s say you are given a hexagon in the plane. You draw intervals inside the hexagon. Together with
the edges of the hexagon, all intervals are such that:
(a) if two intervals share a point, it has to be an endpoint of both
(b) the intervals form a connected graph
(c) every endpoint of an interval is also an endpoint of another interval
(d) the intervals split the hexagon into 5500 regions, 3000 of which are triangles (have 3 edges), 2000 -
quads (4 edges) and 500 are pentagons (have 5 edges).
Calculate:
1
pf3
pf4

Partial preview of the text

Download Computational Geometry Practice Problems and more Assignments Computer Graphics in PDF only on Docsity!

Practice problems - set 5

  1. Let’s say that someone gave you a function LookU pColor(x 1 , y 1 , x 2 , y2) which, when called with floating point arguments x 1 , y 1 , x 2 , y2, returns the intensity of light arriving at (x 1 , y 1 , 0) from the direction of (x 2 , y 2 , −1). How would you compute intensity for a pixel using that function? Focus on the work that needs to be done for each pixel. Assume that the viewpoint is at e = (ex, ey , ez ), with ez > 0, and the vector from the viewpoint throught the pixel has coordinates [vx, vy , vz ], with vz > 0. Give all necessary formulas.
  2. What is the result of clipping the line connecting (1, 1 , 1) and (5, 10 , 15) against the cube given by 0 ≤ x, y, z ≤ 2?
  3. Let’s say that each of the six faces of a cube environment map is of distinct solid color. Now, you apply this cube environment map to a smooth mirror object (let’s say this is the only thing you are rendering and it’s contained in the view volume). How many colors are you going to see on your image? Will that depend on the viewpoint and, if so, how?
  4. You are clipping a triangle with respect to a rectangular viewport. Can the result have:

a) 3 edges?

b) 4 edges?

c) 5 edges?

d) 6 edges?

e) 7 edges?

For each case, either explain why or draw an example.

  1. Can one obtain an 8-gon as a result of clipping a triangle with respect to a rectangle (in 2D)? How about an 10-gon resulting from clipping a triangle against a cube (in 3D)? Is it possible? Explain your answers.
  2. List (in counterclockwise order) the vertices of the polygon resulting from clipping the triangle with vertices (0, −5), (5, 0) and (− 5 , 5) against the rectangle with vertices (± 4 , ±4)
  3. What is the area of the polygon with vertices (in order along the boundary) (0, 5), (5, 2), (10, 1) and (− 2 , −3)?
  4. Let’s say you are given a hexagon in the plane. You draw intervals inside the hexagon. Together with the edges of the hexagon, all intervals are such that:

(a) if two intervals share a point, it has to be an endpoint of both

(b) the intervals form a connected graph

(c) every endpoint of an interval is also an endpoint of another interval

(d) the intervals split the hexagon into 5500 regions, 3000 of which are triangles (have 3 edges), 2000 - quads (4 edges) and 500 are pentagons (have 5 edges).

Calculate:

(1) The number of edges that have been drawn (excluding the hexagon’s edges).

(2) The number of endpoints of the intervals (including the hexagon’s vertices); if several edges share en endpoint, count it just once

  1. Imagine you are standing in the middle of a large cubical room. The floor of the room is white. The ceiling is black. The wall in front of you is red. The wall in the back is green. The walls on the left and on the right are blue and yellow (respectively). There is a small mirror ball hanging from the ceiling, right above you. Assume that it is so small that it obscures only a part of the ceiling and that you are very small compared to the size of the room (or, even better, invisible). How many and what colors can you see in the ball? Explain why

(a) Can a manifold mesh without boundary have 2005 edges? 2006 edges? Explain why.

(b) A manifold mesh with no handles has 3000 edges. How many triangles and vertices does it have?

  1. Compute the volume and surface area of the tetrahedron with vertices (0, 0 , 0), (1, 0 , 0), (0, 1 , 0) and (0, 0 , 1).
  2. Using the half-edge notation (f.h=a half edge bounding a face f, h.o, h.n, h.p = opposite, next, previous half-edge for h, h.s = starting vertex of h), write a pseudocode that would list all vertices on the outer loop of a face f (each one just once)
  3. Convert the following scene graph into OpenGL-like pseudocode. Use glPopMatrix(), glPushMatrix() and glMultMatrix(M) for a transformation M. Assume draw(i) draws part i.

M

M

M

M

M

  1. The Bunny model I gave you as Project 3 input has 69451 triangles. Every edge of the Bunny has either 2 incident triangles or 1 incident triangle. There are 223 edges with 1 incident triangle.

1 What is the total number of edges?

2 The Bunny has 4 holes. If you plug each of the holes by triangulating their boundary, you will get a manifold surface with no handles. Compute the number of vertices in the Bunny model using the Euler’s formula.

  1. Write a pseudocode of the procedure that lists all vertices adjacent to a vertex v in a planar sub- division represented using the half-edge datastructure. Use the standard half edge notation (h.n=next, h.p=previous, h.o=opposite, h.s=starting vertex, h.f=face, v.h=one of the half edges out of a vertex v)

(A) 3T = 2E (B) T = 2V (C) E = 3V (D) T − E + V = 0 (E) T − E + V = 2

  1. Compute volume of the tetrahedron with vertices (1, 1 , 1), (2, 2 , 2), (− 1 , 0 , 1) and (0, 1 , 0).
  2. Let x and y be two arbitrary numbers. Compute

det

1 x y 1 10 10 1 10 12

 (^) + det

1 x y 1 10 12 1 14 12

 (^) + det

1 x y 1 14 12 1 14 10

 (^) + det

1 x y 1 14 10 1 10 10

  1. What is the area of the polygon with vertices (in order along the boundary) (0, 5), (5, 2), (10, 1) and (− 2 , −3)?
  2. Using the standard half-edge notation (f.h=a half edge bounding a face f, h.o, h.n, h.p = opposite, next, previous half-edge for h, h.s = starting vertex of h, h.f=face containing the half-edge h and v.h=half- edge out of a vertex v), give a pseudocode for a function that outputs all faces meeting at a vertex v.
  3. Lets say that you have the following information about a function f with scalar values defined on the plane: f (0, 0) = 6, f (0, 1) = 12, f (1, 0) = 36, f (1, 1) = 48. Compute the value of f at (1/ 3 , 3 /4) using bilinear interpolation.
  4. Even though most of the time we dealt with triangle meshes in class, quadrilateral (quad-) meshes are also very common in graphics. Faces of a quadmesh are quads, not triangles. A manifold quadmesh is a quadmesh such that for each vertex the incident quad form a closed ’fan’ as shown in the figure below. In particular, every edge in such a mesh has two incident quads.

(i) What is the relationship between the number of quads Q and the number of edges E in a manifold quadmesh? Your answer should be an equation involving Q and E

(ii) Give a relationship between the number of vertices V and number of edges E in a connected manifold quad mesh of genus 0 (no handles). Your answer should be an equation involving V and E

(iii) Give a relationship between the number of vertices V and the number of quads Q in a connected manifold quad mesh of genus 0 (no handles). Your answer should be an equation involving V and Q

(iv) If a quadmesh is large, connected, manifold and has genus 0, what integer is the average degree of a vertex close to? By degree of a vertex we mean the number of edges meeting at that vertex.

fans of quads around a vertex

  1. What is the area of the polygon with vertices (in order along the boundary) (0, 4), (6, 3), (11, 5) and (2, 10)?
  2. Compute the volume of the tetrahedron with vertices (0, 0 , 1), (1, 1 , 1), (1, 2 , 3) and (5, 6 , 1).
  3. Give a formula for the distance of a point p = (x, y, z) from the plane containing points p 1 = (x 1 , y 1 , z 1 ), p 2 = (x 2 , y 2 , z 2 ) and p 3 = (x 3 , y 3 , z 3 ), assuming p 1 , p 2 and p 3 are not colinear. (hints: volume of the tetrahedron with vertices p, p 1 , p 2 and p 3 , area of the triangle ∆p 1 p 2 p 3 and the distance... how are they related?)