UM EECS 487 Fall 2008 Homework Assignment 2: 3D Transformations and Perspective Projection, Assignments of Electrical and Electronics Engineering

Information about a homework assignment for the university of michigan eecs 487 course in fall 2008. The assignment covers topics such as generalized shear, advanced deformation, and perspective projection in 3d computer graphics. Students are required to solve problems related to shearing matrices, generating figures using canonical squares and transformations, and finding eye coordinates and projected points using perspective matrices.

Typology: Assignments

Pre 2010

Uploaded on 09/02/2009

koofers-user-xn9
koofers-user-xn9 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
UM EECS 487 Fall 2008
Homework Assignment 2
DUE DATE Mon, 10/06/2008, 1:40 pm in lab
September 22, 2008
Show your work for all the questions below. If you don’t show your work, you will get only a third
of the points if your answers are correct.
1. Generalized Shear (10 pts)
Consider a unit cube between (0,0,0) and (1,1,1).
(a) What is the matrix that shears the top surface by a displacement (∆x, y, 0) keeping the
bottom surface fixed? (2 pts)
(b) What is the matrix that shears the edge (1,1,0) (1,1,1) by a displacement (0,0,z)
keeping the edge (0,0,0) (0,0,1) fixed? (2 pts)
(c) What is the matrix that stretches the cube so that the point (0,0,0) is fixed, the point (1,1,1)
is displaced by (∆x, y, z)and all other vertices are displaced proportionally based on their
initial distance from the origin along the body diagonal (1,1,1), forming a 3D rhomboid? (6
pts)
2. Advanced Deformation (15 pts)
You are given a function named canonicalSquare() that draws a wire-frame square (using
GL LINES, for example) between (0,0,0) and (1,1,0).
(a) Using only this geometric primitive and transformation matrices, generate the figure shows in
Fig. 1. You may use any arbitrary 4×4matrix necessary. (12 pts)
(b) Having completed step 1, what is the quickest way to align the axis through the figure so that
it is now along the (1,1,1) direction instead of the zaxis as shown in the figure? (3 pts)
Note that the kind of deformation shown in Fig. 1 will only work if with the wire-frame and not with
a solid surfaces (created using GL QUADS, for example). Polygons must be decomposed into trian-
gles before rendering and for quadrilaterals, an arbitrary diagonal is picked to create 2 constituent
triangles per surface. In Fig. 1 the planarity of all quadrilateral surfaces and within each triangle
surfaces is destroyed in step 4. To get Fig 1 with lines only we only need transform the end-vertices
whereas while trying compose it using triangles, information about the new vertex at the intersec-
tion of the lines connecting the two square faces is missing. Without it a basic engine like OpenGL
will continue to draw triangles connecting the new vertex locations and we get a slightly different
solid that looks like the intersection of rectangles along face-diagonals and between opposite edges
in the original cube.
1
pf2

Partial preview of the text

Download UM EECS 487 Fall 2008 Homework Assignment 2: 3D Transformations and Perspective Projection and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

UM EECS 487 Fall 2008

Homework Assignment 2

DUE DATE Mon, 10/06/2008, 1:40 pm in lab

September 22, 2008

Show your work for all the questions below. If you don’t show your work, you will get only a third of the points if your answers are correct.

  1. Generalized Shear (10 pts) Consider a unit cube between (0, 0 , 0) and (1, 1 , 1).

(a) What is the matrix that shears the top surface by a displacement (∆x, ∆y, 0) keeping the bottom surface fixed? (2 pts) (b) What is the matrix that shears the edge (1, 1 , 0) −→ (1, 1 , 1) by a displacement (0, 0 , ∆z) keeping the edge (0, 0 , 0) −→ (0, 0 , 1) fixed? (2 pts) (c) What is the matrix that stretches the cube so that the point (0, 0 , 0) is fixed, the point (1, 1 , 1) is displaced by (∆x, ∆y, ∆z) and all other vertices are displaced proportionally based on their initial distance from the origin along the body diagonal (1, 1 , 1), forming a 3D rhomboid? ( pts)

  1. Advanced Deformation (15 pts) You are given a function named canonicalSquare() that draws a wire-frame square (using GL LINES, for example) between (0,0,0) and (1,1,0).

(a) Using only this geometric primitive and transformation matrices, generate the figure shows in Fig. 1. You may use any arbitrary 4 × 4 matrix necessary. (12 pts) (b) Having completed step 1, what is the quickest way to align the axis through the figure so that it is now along the (1, 1 , 1) direction instead of the z−axis as shown in the figure? (3 pts)

Note that the kind of deformation shown in Fig. 1 will only work if with the wire-frame and not with a solid surfaces (created using GL QUADS, for example). Polygons must be decomposed into trian- gles before rendering and for quadrilaterals, an arbitrary diagonal is picked to create 2 constituent triangles per surface. In Fig. 1 the planarity of all quadrilateral surfaces and within each triangle surfaces is destroyed in step 4. To get Fig 1 with lines only we only need transform the end-vertices whereas while trying compose it using triangles, information about the new vertex at the intersec- tion of the lines connecting the two square faces is missing. Without it a basic engine like OpenGL will continue to draw triangles connecting the new vertex locations and we get a slightly different solid that looks like the intersection of rectangles along face-diagonals and between opposite edges in the original cube.

Figure 1: Figure generated using canonical squares and transformations only

  1. Perspective projection (10 points)

Consider the perspective matrix set up by the call to gluPerspective() API of OpenGL:

P =

   

g/A 0 0 0 0 g 0 0 0 0 FN^ + −NF N^2 F N −F 0 0 − 1 0

    , withg = cotan(φy/2), (1)

where φy is the vertical field of view angle (vofy), A the aspect ratio of the viewport (width/height), and N and F the distances to the near and far planes respectively (given as absolute values, so that the near plane is at z = −N and the far plane at z = −F ).

(a) Find the eye coordinates of the point at the center of the near plan of the viewing frustum, and transform that point into the canonical view volume using matix P. Perform the computation in the homogenized form and then divide by w to obtain the 3D coordinate of the resulting projected point. (5 points) (b) Repeat the previous task for the top right corner of the far plane of the viewing frustum. ( points)