CMSC 425
Dave Mount & Roger Eastman
CMSC 425: Lecture 7
Geometric Programming: Sample SolutionsSamples:In the last few lectures, we have been discussing affine and Euclidean geometry, coordi-nate frames and affine transformations, and rotations. In this lecture, we work through a fewexamples of how to apply these concepts to solve a few concrete problems that might arise inthe context of game programming.Caveat: I have not tested the Unity code given here, sodon’t trust it!Shot-Gun Simulator:Problem:You have been asked to implement a new weapon that behaves something like ashot gun. It has a wide ange of effectiveness, but it is only effective at relatively smalldistances.Suppose that the end of the muzzle of the gun is located at a pointp(in3-dimensional space), and it has been aimed at a target pointt(see Fig. 1(a)). The gunshoots a spray of pellets within angleθthe central axis betweenpandt, but bullets areonly effective up to a distance ofrfrom the end of the muzzle. (Let’s assume thatθisgiven in degrees and is strictly smaller than 90◦.) Given a pointq, write a procedure todetermine whether the pointqwill be hit when the gun is fired.θprq(a)θcvprq(b)~ucuttFig. 1: Shot gun.
Lecture 7
1
Spring 2018

CMSC 425
Dave Mount & Roger Eastman

