Docsity

Practice Problems for Midterm Exam - Game Programming | CMSC 498M, Exams of Computer Science

Toggle sidebar
bg1
CMSC 498M:Fall 2006 Dave Mount
Practice Problems for the Midterm Exam
The midterm will be in class Thu, Nov 2. The exam will be closed-books, closed-notes, but you
will be allowed two sheets of notes, front and back to use for the exam. These practice problems
do not necessarily reflect the actual difficulty of problems on the exam or the total length of the
exam.
OpenGL and GPUs
Problem G1. Consider a regular pentagon (5-sided) in the xy-plane. Let the vertices in counter-
clockwise order be a,b,c,d,e. Let a= (a.x, a.y), and assume that the other vertices are
named analogously. You may assume that each coordinate is a float.
(a) Present the OpenGL commands for drawing this pentagon using GL TRIANGLES.
(b) Present the OpenGL commands for drawing this pentagon using GL TRIANGLE STRIP.
(c) Which of the two methods would be more efficient, and why?
Problem G2. What is double buffering? Why is it useful in interactive graphics? What OpenGL/GLUT
commands are used to support double buffering?
Problem G3. You are given a drawing function drawMe( ), which draws some shape, centered
at the origin. You want to use this function to draw two instances of the shape. One of the
instances should be rotated by 45 degrees about the z-axis and then translated so that it is
centered about the point (4,3,2). The other copy should be centered about this point, but
not rotated. Provide the OpenGL commands to achieve this. (They may be drawn in any
order.) For full credit, the matrix stack state should be unchanged when you are finished.
Problem G4. In class we mentioned that, although many lighting parameters can be set at any
time, the light positions should be set after setting the camera position. Briefly explain why
this so.
Modeling
Problem M1. Would a blob model be more accurately characterized as an example of implicit or
parametric modeling? Briefly explain.
Problem M2. What is meant by an indexed mesh representation. What is the principal advantage
of using an indexed representation for a mesh?
Problem M3. What is meant by static level of detail (static LOD)? State one advantage and one
disadvantage of using static LOD.
Problem M4. In the context of LOD, what is an imposter ? Would an imposter be more likely
used for a close or a distant object? Explain.
Problem M5. What is the difference between lerp (linear interpolation) and slerp (spherical linear
interpolation). Under what circumstances would slerp interpolation be preferred over lerp
interpolation, and why?
1
pf3

Partial preview of the text

Download Practice Problems for Midterm Exam - Game Programming | CMSC 498M and more Exams Computer Science in PDF only on Docsity!

CMSC 498M:Fall 2006 Dave Mount

Practice Problems for the Midterm Exam

The midterm will be in class Thu, Nov 2. The exam will be closed-books, closed-notes, but you will be allowed two sheets of notes, front and back to use for the exam. These practice problems do not necessarily reflect the actual difficulty of problems on the exam or the total length of the exam.

OpenGL and GPUs

Problem G1. Consider a regular pentagon (5-sided) in the xy-plane. Let the vertices in counter- clockwise order be a, b, c, d, e. Let a = (a.x, a.y), and assume that the other vertices are named analogously. You may assume that each coordinate is a float.

(a) Present the OpenGL commands for drawing this pentagon using GL TRIANGLES. (b) Present the OpenGL commands for drawing this pentagon using GL TRIANGLE STRIP. (c) Which of the two methods would be more efficient, and why?

Problem G2. What is double buffering? Why is it useful in interactive graphics? What OpenGL/GLUT commands are used to support double buffering?

Problem G3. You are given a drawing function drawMe( ), which draws some shape, centered at the origin. You want to use this function to draw two instances of the shape. One of the instances should be rotated by 45 degrees about the z-axis and then translated so that it is centered about the point (4, 3 , 2). The other copy should be centered about this point, but not rotated. Provide the OpenGL commands to achieve this. (They may be drawn in any order.) For full credit, the matrix stack state should be unchanged when you are finished.

Problem G4. In class we mentioned that, although many lighting parameters can be set at any time, the light positions should be set after setting the camera position. Briefly explain why this so.

Modeling

Problem M1. Would a blob model be more accurately characterized as an example of implicit or parametric modeling? Briefly explain.

Problem M2. What is meant by an indexed mesh representation. What is the principal advantage of using an indexed representation for a mesh?

Problem M3. What is meant by static level of detail (static LOD)? State one advantage and one disadvantage of using static LOD.

Problem M4. In the context of LOD, what is an imposter? Would an imposter be more likely used for a close or a distant object? Explain.

Problem M5. What is the difference between lerp (linear interpolation) and slerp (spherical linear interpolation). Under what circumstances would slerp interpolation be preferred over lerp interpolation, and why?

Physics

Problem P1. Suppose that we have a 3D rigid body of mass m whose center of mass coincides with the origin. Suppose further that we have computed its moment of inertia I 0 , assuming rotation about the z-axis.

(a) If the center of rotation is translated to a point p = (px, py, pz ), but the rotation vector is still parallel to the z-axis, can we infer the new moment of inertia from the information given? If so, explain how. (b) If the direction of the rotation vector changes to the x-axis, but the center of rotation is still the origin, can we infer the new moment of inertia from the information given? If so, explain how.

Problem P2. Recall the dropping bullet computation done in class. (Given a horizontally shot bullet at initial velocity vm that travels distance n before hitting a wall. How far does it drop in vertical distance before hitting the wall?) Redo this computation, but under the assumption that bullet is shot at a 45 degree angle upwards. (Assume no wind resistance.) In particular, assuming it is shot from ground level, how high on the wall does it hit? Recall that g = 9. 8 m/s^2 is the acceleration (downwards) due to gravity.

Problem P3. Consider a pilot sitting in a plane, and a coordinate system associated with the pilot where the x-axis points to the pilots right, the y-axis points forward, and the z-axis points up. Explain, in this system the meaning of pitch, roll, and yaw. In each case, a small positive (pitch/roll/yaw) results in what sort of change in orientation. (You may draw a figure if you like).

Problem P4. An object of mass m sits on top of a horizontal table. A force F is applied to the object downwards and two the object’s right at a 45 degree angle. (F does not include the force due to gravity.) Let μs = 0.5 and μd = 0.25 denote the coefficients of static and dynamic friction between the object and the table, respectively.

(a) Based on the laws of Coulomb friction, how large must the force F be for the object to start moving? (b) Suppose that the applied force Fapp is large enough to get the object moving at a current tangential velocity vt of 2 meters per second. What is the current net force acting tangentially on the object?

Problem P5.

(a) How are bounding enclosures, such as bounding boxes and bounding spheres used in collision detection between two objects? (b) Give one advantage and one disadvantage of using a bounding box rather than a bound- ing sphere for collision detection.

Problem P6. Consider an object (like a bullet) of mass m moving horizontally to the right from an initial position s 0 = (0, h) and starting at an velocity of v 0 at time t = 0. The object is subject to gravity, but no other forces.

(a) What is the exact position of the object at time t = 2 as predicted by Newton’s laws of motion? (Hint: Recall the bullet shooting problem.)