CS 447/547: Computer Graphics Homework 1 solved




Question 1: Vectors are very important to computer graphics and they are used to represent both
locations in space (points) and directions. Assume you have three points in 2D space, represented
by a = [π‘Žπ‘₯, π‘Žπ‘¦], b = [𝑏π‘₯, 𝑏𝑦], and c = [𝑐π‘₯, 𝑐𝑦].
a. How do you find the direction vector v that points from a toward b?
b. How is the length,‖𝐯‖, of v computed?
c. A unit vector,𝐯̂, in the direction v is a vector in the same direction as v but with length 1.
How do you compute 𝐯̂? Computing 𝐯̂ is also referred to as normalizing v.
Question 2: Consider two vectors in 3D, a and b.
a. How is the dot product 𝐚 βˆ™ 𝐛 computed?
b. What is the relationship between 𝐚 βˆ™ 𝐛 and the angle between a and b?
c. How is the cross product vector 𝐜 = 𝐚 Γ— 𝐛 computed?
d. What is the geometric relationship between a, b and c?
e. What is the geometric relationship between 𝐚 Γ— 𝐛 and 𝐛 Γ— 𝐚?
f. What is the relationship between 𝐚 Γ— 𝐛 and the angle between a and b?
Question 3: What is the solution to the following quadratic equation?
2 + 3π‘₯ + 2 = 0
Question 4: What is the distance from a 2D point 𝐩 = [𝑝π‘₯,𝑝𝑦] to a line π‘Žπ‘₯ + 𝑏𝑦 + 𝑐 = 0?
Question 5: This question concerns the definition of a 3D parametric line.
a. What is the minimum number of points needed to define a unique line in 3D that passes
through all the points? What other conditions must the points satisfy for the line to be
b. Given more than the minimum number of points, is it in general possible to find one line
that passes through all of them?
c. A 3D parametric line is usually defined as 𝐩 = 𝐨 + 𝑑𝐝. Label your points p1, p2, etc. Find
two vectors o and d in terms of the points.
Question 6: What is the result of the following matrix multiplication of a vector?
1 2 5
4 1 12
3 1 15