Docsity

Practice Problem Set 1 for Computer Graphics | CS 3451, Assignments of Computer Graphics

Toggle sidebar
bg1
Practice problems - set 1
some of these problems were already solved in class – make sure that you can recreate the solution
yourself without looking into your class notes
Allowed form of the answer(s):
-If a problem asks for a formula for something, your answer should be an expression depending on the
given data using the elementary algebraic operations (addition, subtraction, multiplication, division)
and any elementary functions you may need (square root, absolute value or like)
-If a problem asks for a statement, you can also use the comparison operators (less, greater, equal,
less/greater or equal) and logical operators (and,or,not)
-In problems 5-7, you can (in addition to the above) use vector operations (cross product, dot product,
vector length, addition, subtraction, negation) in your answer.
1. A planar triangle has vertices at (x1, y1), (x2, y2) and (x3, y3). Derive a formula for its area. Hint: add
zero z-coordinate to embed vertices in 3D and use cross product.
2. A planar triangle has vertices at (x1, y1), (x2, y2) and (x3, y3). You are also given a point (x, y). Write
a statement depending on the vertex coordinates and the point coordinates that is true if and only if the
point is inside the triangle (if it’s on one of the edges, it’s considered inside). Hint: same as in problem 1
3. Derive a formula for the distance of a point (x, y) from the line passing through two distinct points
(x1, y1) and (x2, y2). Hint: consider the triangle formed by the three points; you already have a formula
for its area (problem 1)...
4. You are given a 3D surface consisting of all points satisfying a quadratic equation
Ax2+By2+C z2+Dxy +E xz +F yz +Gx +Hy +I z +J= 0,
where A...J are some constants. Give a pseudocode of a function that returns the intersection point of the
surface and the ray with origin at o= (ox, oy, oz) and direction d= (dx, dy, dz) or returns ’no intersection’
if there is no intersection. This is a special case of ray-implicit intersection, see textbook, section 2.7 and
beginning of 10.3.1
5. Given points a1= (x1, y1, z1), a2= (x2, y2, z2), a3= (x3, y3, z3), p= (x, y, z) and q= (x0, y0, z 0) write a
statement that is true if and only if pand qare on the same side of the plane passing through the points
a1,a2and a3. You don’t need to worry about degenerate cases: assume the points a1,a2and a3are not
colinear and pand qare not on the plane defined by a1,a2and a3.
6. Consider a solid, opaque tetrahedron with vertices a1= (x1, y1, z1), a2= (x2, y2, z2), a3= (x3, y3, z3)
and a4= (x4, y4, z4). You are looking at it from a point pwith coordinates (x, y, z), known to be outside
the tetrahedron. Write a statement (of the form described in problem 5) that is true if and only if the
face of the tetrahedron with vertices a1,a2and a3is visible from p.Hint: try to reduce to problem 5
7. Consider a tetrahedron with vertices a1,a2,a3and a4. Think of the triangle ∆a1a2a3as its base.
(a) What is the area of the base?
(b) What is the height of the tetrahedron Hint: project vector from a1to a3onto the normal vector for
the base
(c) Give a formula for the volume of the tetrahedron.
(d) Argue that the the result you got in part (c) is equal to 1
6|(~a1a2×~a1a3)·~a1a4|
1

Partial preview of the text

Download Practice Problem Set 1 for Computer Graphics | CS 3451 and more Assignments Computer Graphics in PDF only on Docsity!

Practice problems - set 1

some of these problems were already solved in class – make sure that you can recreate the solution yourself without looking into your class notes

Allowed form of the answer(s):

  • If a problem asks for a formula for something, your answer should be an expression depending on the given data using the elementary algebraic operations (addition, subtraction, multiplication, division) and any elementary functions you may need (square root, absolute value or like)
  • If a problem asks for a statement, you can also use the comparison operators (less, greater, equal, less/greater or equal) and logical operators (and, or, not)
  • In problems 5-7, you can (in addition to the above) use vector operations (cross product, dot product, vector length, addition, subtraction, negation) in your answer.
  1. A planar triangle has vertices at (x 1 , y 1 ), (x 2 , y 2 ) and (x 3 , y 3 ). Derive a formula for its area. Hint: add zero z-coordinate to embed vertices in 3D and use cross product.
  2. A planar triangle has vertices at (x 1 , y 1 ), (x 2 , y 2 ) and (x 3 , y 3 ). You are also given a point (x, y). Write a statement depending on the vertex coordinates and the point coordinates that is true if and only if the point is inside the triangle (if it’s on one of the edges, it’s considered inside). Hint: same as in problem 1
  3. Derive a formula for the distance of a point (x, y) from the line passing through two distinct points (x 1 , y 1 ) and (x 2 , y 2 ). Hint: consider the triangle formed by the three points; you already have a formula for its area (problem 1)...
  4. You are given a 3D surface consisting of all points satisfying a quadratic equation

Ax^2 + By^2 + Cz^2 + Dxy + Exz + F yz + Gx + Hy + Iz + J = 0,

where A...J are some constants. Give a pseudocode of a function that returns the intersection point of the surface and the ray with origin at o = (ox, oy , oz ) and direction d = (dx, dy , dz ) or returns ’no intersection’ if there is no intersection. This is a special case of ray-implicit intersection, see textbook, section 2.7 and beginning of 10.3.

  1. Given points a 1 = (x 1 , y 1 , z 1 ), a 2 = (x 2 , y 2 , z 2 ), a 3 = (x 3 , y 3 , z 3 ), p = (x, y, z) and q = (x′, y′, z′) write a statement that is true if and only if p and q are on the same side of the plane passing through the points a 1 , a 2 and a 3. You don’t need to worry about degenerate cases: assume the points a 1 , a 2 and a 3 are not colinear and p and q are not on the plane defined by a 1 , a 2 and a 3.
  2. Consider a solid, opaque tetrahedron with vertices a 1 = (x 1 , y 1 , z 1 ), a 2 = (x 2 , y 2 , z 2 ), a 3 = (x 3 , y 3 , z 3 ) and a 4 = (x 4 , y 4 , z 4 ). You are looking at it from a point p with coordinates (x, y, z), known to be outside the tetrahedron. Write a statement (of the form described in problem 5) that is true if and only if the face of the tetrahedron with vertices a 1 , a 2 and a 3 is visible from p. Hint: try to reduce to problem 5
  3. Consider a tetrahedron with vertices a 1 , a 2 , a 3 and a 4. Think of the triangle ∆a 1 a 2 a 3 as its base.

(a) What is the area of the base?

(b) What is the height of the tetrahedron Hint: project vector from a 1 to a 3 onto the normal vector for the base

(c) Give a formula for the volume of the tetrahedron.

(d) Argue that the the result you got in part (c) is equal to 16 |( a 1 ~a 2 × a 1 ~a 3 ) · a 1 ~a 4 |