## Description

### Unformatted Attachment Preview

Purchase answer to see full attachment

Homework 2 - Transformations
1. Using the labels Translate, Rotation, Scale, or Reflect, label the transformation of
point p when multiplied by matrix M (p’ = Mp):
(a)
0 −1
M=
1 0
(b)
" √
M=
2
2√
√ #
2
√2
2
2
0
4
0
0
0
0
2
0
− 22
(c)
2
0
M =
0
0
0
0
0
1
(d)
−1 0
M=
0 1
(e)
1 0 3
M = 0 1 2
0 0 1
2. Find the matrix for a 120◦ rotation about the axis defined by the vector r = (1,1,0).
3. Match the following 2D homogeneous matrices to the transformations in the image:
√
√
−√ 23 − √21 0
1.5 0 0
1 0 4
a. 1 − 3 0 b. 0 −1 0 c. 0 1 1
2
2
0
0 1
0 0 1
0
0
1
1
4. Describe a sequence of Translate(x,y), Rotate(degrees), and/or Scale (by a value
of ) that when multiplied describe the below transformation to go from the ’Before’
to ’After’.
5. (a) Describe (using a sequence of (3 x 3) matrix multiplications) the transformations
needed to transform the triangle from A to B in the figure below:
(a)
0
x
x
4
∗
∗
∗ y
y0 =
B
w
w0
2
A
0
0
2
4
6
8
(b) Using the transformations found in part (a), multiply the following points with
the matrix.
P1 .(4, 1)P2 .(4, 3)
2
Homework 2 - Modeling
1. Define uniform, attribute and varying variables.
2. What type is the shader and describe its function?
(a)
attribute vec2 a_Position;
main() {
gl_Position = vec4(0.5 * a_Position, 0.0, 1.0);
}
(b)
main() {
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
}
3. Using linear interpolation, calculate the color of the following points that are on the
line defined by the 2D points p1 = [3,5] with color [255,0,0] and p2 = [10, 5] with
color [0,0,255].
(a) [4.8, 5]
(b)[7.5, 5]
(b)[9, 5]
4. Using barycentric coordinates, calculate the color for each of the following points
inside the triangle defined by points p1 = [0,0,0], p2 = [3,5,0] and p3 = [6,0,0] with
respective RGB colors c1 = [255, 0, 0], c2 = [0, 255, 0], c3 = [0, 0, 255].
(a) [1, 1, 0]
(b) [3, 4, 0]
(c) [5, 0.25, 0]
5. Calculate the RGB color value for point P in the diagram below using bilinear
interpolation. Show the intermediate values that you compute for interpolating
along one of the two axes. The colors of the points A, B, C and D are the following:
A = RGB(0, 0, 0)
B = RGB(200, 200, 200)
C = RGB(200, 0, 0)
D = RGB(200, 0, 0)
1
6. Given a polygon with vertices P1, P2, P3, each represented by a 3D vector [x y z],
what formula calculates the face’s normal?
2

Purchase answer to see full attachment

Purchase answer to see full attachment

Explanation & Answer:

5 pages

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous

Nice! Really impressed with the quality.