<< Chapter < Page Chapter >> Page >

A graphical representation of the trajectory

Figure 7 shows the trajectory of the arrow for firing angles of 45 degrees and 60 degrees. The vertical axisshows the height in feet and the horizontal axis shows the flight distance in feet.

Figure 7 - Trajectory for two different firing angles.

Missing image

Analysis of the output

Figure 6 shows the x and y coordinates of the arrow's position every 0.25 seconds from the time that it is released until it strikes the ground alittle less than 4.5 seconds later. This is the data for the case where the firing angle was 45 degrees.

Compute for a different angle

Next, I recommend that you modify the script by changing the value of the variable named ang from 45 degrees to 60 degrees and load the modified version of the html file into your browser. This should produce the output shown in Figure 8 . This output is also plotted in Figure 7 .

Which arrow went higher?

Which arrow went further along the horizontal axis?

Figure 8 . Screen output for Listing #4 at 60 degrees.
Start Script t = 0.00 seconds x = 0.0 feet y = 6.0 feett = 0.25 seconds x = 12.5 feet y = 26.7 feet t = 0.50 seconds x = 25.0 feet y = 45.3 feett = 0.75 seconds x = 37.5 feet y = 61.9 feet t = 1.00 seconds x = 50.0 feet y = 76.5 feett = 1.25 seconds x = 62.5 feet y = 89.1 feet t = 1.50 seconds x = 75.0 feet y = 99.7 feett = 1.75 seconds x = 87.5 feet y = 108.3 feet t = 2.00 seconds x = 100.0 feet y = 114.8 feett = 2.25 seconds x = 112.5 feet y = 119.4 feet t = 2.50 seconds x = 125.0 feet y = 121.9 feett = 2.75 seconds x = 137.5 feet y = 122.4 feet t = 3.00 seconds x = 150.0 feet y = 120.9 feett = 3.25 seconds x = 162.5 feet y = 117.4 feet t = 3.50 seconds x = 175.0 feet y = 111.9 feett = 3.75 seconds x = 187.5 feet y = 104.3 feet t = 4.00 seconds x = 200.0 feet y = 94.8 feett = 4.25 seconds x = 212.5 feet y = 83.2 feet t = 4.50 seconds x = 225.0 feet y = 69.7 feett = 4.75 seconds x = 237.5 feet y = 54.1 feet t = 5.00 seconds x = 250.0 feet y = 36.5 feett = 5.25 seconds x = 262.5 feet y = 16.9 feet t = 5.50 seconds x = 275.0 feet y = -4.7 feetEnd Script

Perhaps you could do the same thing for some other launch angles and determine which launch angle provides the greatest horizontal range and whichlaunch angle provides the greatest vertical height.

For example, how far does the arrow fly when launched at an angle of 0 degrees from a height of 6 feet?

Analysis of the code

The code in this script treats the horizontal and vertical components of motion independently and uses the equation given above to determine the position along that axis as a function of time every 0.25 seconds.

Common parameter values

The code in Listing 4 begins by defining common parameter values for the firing angle, the time increment at which coordinate values will be computed anddisplayed, and the initial velocity of the arrow in the firing direction.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Game 2302 - mathematical applications for game development. OpenStax CNX. Jan 09, 2016 Download for free at https://legacy.cnx.org/content/col11450/1.33
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Game 2302 - mathematical applications for game development' conversation and receive update notifications?

Ask