Problem Set - Collisions, Intersections, Perspective and More Transformations | CMSC 427, Assignments of Computer Graphics

Material Type: Assignment; Professor: Jacobs; Class: Computer Graphics; Subject: Computer Science; University: University of Maryland; Term: Spring 2005;

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-6lg-1
koofers-user-6lg-1 🇺🇸

8 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Problem Set 2
CMSC 427
Distributed Thursday, February 20, 2005
Due: Tuesday, March 6, 2005
Collisions, Intersections, Perspective and More Transformations
Programming
An executable for the finished version of this problem set is available on the class web
page. You can obtain code that satisfies the conditions of problem set 1 by sending email
to [email protected] (I’d prefer not to post it on the web). You can use this as a
starting point, or you can use your own implementation of PS 1 to start. This code, and
perhaps yours, handles the somersault. However, in this problem set, you don’t need to
worry about getting everything to interact properly with the somersault, in fact, feel free
to delete the somersault.
I have added a few features in the executable that you are not required to implement.
These include some print statements to indicate speed and intersections, and keyboard
functions for ‘d’, ‘e’, ‘r’, and ‘t’. I found these helpful for debugging purposes and you
might find similar functions useful.
Note that throughout the problem set you can assume that the rectanguloids in the scene
are axial aligned, and do not intersect each other. The car will not usually be axial
aligned, however. You can receive extra credit for handling more general rectanguloids
in the scene.
By the way, it is certainly possible that my code has bugs. If it does, this does not excuse
you if you have the same bugs. If you have any doubts about the program’s desired
performance, please ask.
1. 5 points. Fix up the scene so that it looks nice, with a few rectanguloids scattered
here and there. Make at least one rectanguloid tall, so that you can tip it over (see
part 5). Make the rectanguloids displayed with solid sides, instead of wire frames
(look at the command glPolygonMode).
2. 15 points. Add to the code so that the viewing position cannot go inside any of
the rectanguloids. If the viewing position attempts to go inside a rectanguloid, it
will remain outside, unmoving instead. When the viewer tries to enter the
rectanguloid, the rectanguloid will slowly turn yellow. Note that if you do part 4,
this part need not be present in your final code. However, doing this problem is a
good warm up for part 4, and you can get credit for this part even if you are
unable to get 4 working.
3. 15 points. Now, instead of considering the viewer as occupying a single point at
the viewing position, imagine that you are driving a rectanguloid car. This
rectanguloid is aligned with the viewing direction. So when you turn, the car
turns. The car is always pointing in the same direction in which you are viewing,
pf3
pf4

Partial preview of the text

Download Problem Set - Collisions, Intersections, Perspective and More Transformations | CMSC 427 and more Assignments Computer Graphics in PDF only on Docsity!

Problem Set 2 CMSC 427 Distributed Thursday, February 20, 2005 Due: Tuesday, March 6, 2005

Collisions, Intersections, Perspective and More Transformations

Programming

An executable for the finished version of this problem set is available on the class web page. You can obtain code that satisfies the conditions of problem set 1 by sending email to [email protected] (I’d prefer not to post it on the web). You can use this as a starting point, or you can use your own implementation of PS 1 to start. This code, and perhaps yours, handles the somersault. However, in this problem set, you don’t need to worry about getting everything to interact properly with the somersault, in fact, feel free to delete the somersault.

I have added a few features in the executable that you are not required to implement. These include some print statements to indicate speed and intersections, and keyboard functions for ‘d’, ‘e’, ‘r’, and ‘t’. I found these helpful for debugging purposes and you might find similar functions useful.

Note that throughout the problem set you can assume that the rectanguloids in the scene are axial aligned, and do not intersect each other. The car will not usually be axial aligned, however. You can receive extra credit for handling more general rectanguloids in the scene.

By the way, it is certainly possible that my code has bugs. If it does, this does not excuse you if you have the same bugs. If you have any doubts about the program’s desired performance, please ask.

  1. 5 points. Fix up the scene so that it looks nice, with a few rectanguloids scattered here and there. Make at least one rectanguloid tall, so that you can tip it over (see part 5). Make the rectanguloids displayed with solid sides, instead of wire frames (look at the command glPolygonMode ).
  2. 15 points. Add to the code so that the viewing position cannot go inside any of the rectanguloids. If the viewing position attempts to go inside a rectanguloid, it will remain outside, unmoving instead. When the viewer tries to enter the rectanguloid, the rectanguloid will slowly turn yellow. Note that if you do part 4, this part need not be present in your final code. However, doing this problem is a good warm up for part 4, and you can get credit for this part even if you are unable to get 4 working.
  3. 15 points. Now, instead of considering the viewer as occupying a single point at the viewing position, imagine that you are driving a rectanguloid car. This rectanguloid is aligned with the viewing direction. So when you turn, the car turns. The car is always pointing in the same direction in which you are viewing,

so the direction you move is the direction you look in. Display the outline of the car as a wire-frame (see glPolygonMode ). You can make the car any size you want, but part of the wireframe of it should be visible as you move around (as in the executable).

  1. 20 points. Now, instead of the viewing position not being allowed to intersect the rectanguloids, the whole car is not allowed to intersect a rectanguloid. If any point in the car intersects any point in the rectanguloid, you should stop moving (as in (2), the rectanguloid will slowly turn yellow if you keep trying to intersect it).
  2. 15 points. If a rectanguloid is tall and thin it can be tipped over. Specifically, if its height is more than twice as large as its length or width, it is tippable. When you hit the rectanguloid on any side, it will tip over in the opposite direction. That means the edge that is on the ground plane, opposite to where you hit it, will be fixed, and the rectanguloid will slowly rotate 90 degrees about this edge.

a. You should have the rectanguloid lie on its side once you are done. Future collisions with the car should be based on its new position. However, you will get partial credit if the rectanguloid goes back to its old position after it falls. b. You do not need to worry about what happens if the rectanguloid intersects other objects as it falls. c. You do not need to worry about the falling rectanguloid intersecting the car, until after it is done falling.

  1. Extra Credit, up to 20 points: Build a game out of this. You could make a game just using these tools. For example, you could create a track and time your speed around it, perhaps subtracting points for hitting obstacles. Or you could create a maze that contains something you need to find.

You will receive more credit if you add more features to the system to use in your game. For example:

  • When the car hits a rectanguloid, you can push the rectanguloid into a new position. This might be used to reveal hidden corridors. Special credit if the rectanguloids move in a physically realistic way, and/or are allowed to become non-axial.
  • Allow one falling rectanguloid to tip over another when it hits it. Make a set of falling dominoes.
  • Add moving objects to the scene. You might chase them in your game, or have them chase you.
  • Make up your own features!

If you do this part, please include a brief written description documenting your game, so that we can fully appreciate it.

  1. Visibility (2 ½ points each) Consider a triangle with vertices: (3,2,4), (5,8,6), and (6,3,5). a. Consider a point with x coordinate 4 on the line segment from (3,2,4) to (5,8,6). What is its y coordinate? b. What is the z coordinate of the point in the triangle with x=4 and y=4?

c. Consider the 2D scene:

Here is a possible BSP tree for this scene:

Explain how this BSP tree can be used to choose the order in which we will render these line segments, from the point of view of the viewer shown in the figure. Give the order in which they will be rendered.

d. Construct a BSP tree for this scene in which 2 is at the root.

Viewer