Unformatted text preview:

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). 4. 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). 5. 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. 6. 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.Pencil and Paper Exercises Each problem is worth only a small number of points. However, these are well worth doing because they will provide good practice for the midterm. 1. Perspective (2 points each) a. Suppose we have a perspective camera with a focal point at the origin. The image plane is the z=1 plane. We are looking at a point in the world located at (7,4,3). Where does this point appear in the image? (That is, give the 3D coordinates of a point in the image plane where this point will appear). b. Suppose the image plane were z=2. Now where would the point appear in the image? c. Suppose we are looking at the world with a perspective camera in which the focal point is not at the origin. The image plane is the z=1 plane. We are looking at a point in the world with coordinates (7,4,3). This appears in the image at (9,2,1). Give a possible location for the focal point. d. For problem (c), give equation(s) that describe all possible locations of the focal point. e. Suppose we have a perspective camera, with a focal point at the origin, and an image plane at the z=1 plane. We are looking at lines on the floor, which is the y = -5 plane. Give equations that describe the set of lines that have a vanishing point at (5,0,1). 2. Intersection (1 point each):


View Full Document

UMD CMSC 427 - Problem Set #2

Download Problem Set #2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Problem Set #2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Problem Set #2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?