100% Guaranteed Results


VisComp – Visual Computing Solved
$ 25.00
Category:

Description

5/5 – (1 vote)

Exercise 08: Matrices & Quaternions

Goals

• Learning about transformations typically used in 3D graphics applications.
• Getting used to different representations of transformations.
• Implementing a series of transformations in a 3D scene.
Resources

The lecture slides and exercise slides are accessible via the Visual Computing Course Web Page.
Tasks

1. Theory
• Short Questions:
(i) What are the three coordinate systems used to describe the scene?
(ii) State one advantage of using homogeneous coordinates.
(iii) Given two homogeneous points p and p , compute the Euclidean displacement vector d ∈R3 from p1 to p2.
• Homogeneous Coordinates:
(i) Decompose the matrix
A
into a linear transformation L and a translation T, such that A = LT (Note: not TL).
(ii) Describe in words what the transformations L and T represent.
(iii) In which order are L and T processed, if applied to a point in 3D?
(iv) Let n be the normal of a plane H in “Hessian normal form”, i.e., H can be defined as ax + by + cz = −d. Thus, for all points p ∈ H, we have p = 0. The linear transformation A given above maps all p ∈ H to points p in a second plane H′ (p′ = Ap ∈ H′). Our goal is to compute a matrix B that maps n to the normal n′ of the plane H′ such that n′ = Bn (Hint: Compute B using the decomposition A = LT).
• Quaternions:
(i) Assemble the unit quaternion q = c + xi + yj + zk which describes a rotation of 60◦ around the rotation axis u . Simplify the quaternion as much as possible.
(ii) Directly compute the quaternion of the inverse rotation from q.
(iii) Which elementary quaternion operation have you used in (ii)?
(iv) Given the quaternion r . What rotation does r correspond to?
(v) Specify the rotation matrix that corresponds to r.
2. Practice
In this part, you will implement different transformations in code. First, you will construct the model matrix and the view matrix. In a second step, you will add functionality for handling user input (i.e., translations and rotations based on keyboard and mouse events). Download the code from the GitHub repository and get familiar with the code in ex08.js. Run the code in a browser (refer to the GitHub repository and the exercise slides for details). You should see a black screen with white text on the upper left explaining the key instructions.
• ModelView Transform: Find the part in the code marked as ”Task 1”. Your task is to complete the functions getCameraMatrix(), getViewMatrix(), and getModelMatrix().
(i) Implement the getCameraMatrix() function by following the code comments. The camera should look down the negative z-axis. Use the result in getViewMatrix() to compute the view matrix. If implemented correctly, you should see a tiled floor.
(ii) Next, implement the model matrix in getModelMatrix() using the described transformations. Make sure that the transformations are applied in the correct order. If implemented correctly, you will see the mesh from the previous exercise appear. Press the space key to rotate the mesh automatically.
• User Input: Find the part in the code marked as ”Task 2”. In this part, you will complete the functions needed to handle user input for translating and rotating the mesh and the camera, and changing the light position. The keyboard and mouse event handling is already implemented for you.
(i) First, complete moveCamera(…). The camera should move by a specific distance either forward/backward, or sideways, depending on the ’sideways’ flag.
(ii) Next, complete rotateCameraX(…) and rotateCameraY(…). Think about what the origin of rotation is before applying the rotation.
(iii) Finally, complete moveLight(…) by adding a displacement vector ’d’ to the light position.
If implemented correctly, you will be able to rigidly transform the mesh using the keyboard and the mouse as indicated by the instructions on the upper left of the screen.

Reviews

There are no reviews yet.

Be the first to review “VisComp – Visual Computing Solved”

Your email address will not be published. Required fields are marked *

Related products