Physics for Game Programmers

As you probably guessed from the title, this book is focuses on the physics needed by game programmers in order to add realism to their games.


Grant Palmer


458 Pages

22418 Reads

52 Downloads

English

PDF Format

6.48 MB

Game Development

Download PDF format


  • Grant Palmer   
  • 458 Pages   
  • 19 Feb 2015
  • Page - 1

    read more..

  • Page - 2

    Physics for Game Programmers GRANT PALMER read more..

  • Page - 3

    Physics for Game Programmers Copyright © 2005 by Grant P almer All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN (pbk): read more..

  • Page - 4

    This book is dedicated to my wonderful wife, Lisa. read more..

  • Page - 5

    v Contents at a Glance About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . read more..

  • Page - 6

    vii Contents About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . read more..

  • Page - 7

    viii ■CONTENTS ■CHAPTER 3 Basic Newtonian Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 A Short Biography of Sir Isaac Newton . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Newton’s First Law of Motion: Inertia. . . . . . . . . . . read more..

  • Page - 8

    ■CONTENTS ix ■CHAPTER 5 Projectiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . read more..

  • Page - 9

    x ■CONTENTS Details on Specific Types of Projectiles . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Bullets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Cannonballs. . . . . . . . . . read more..

  • Page - 10

    ■CONTENTS xi Basketball . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Equipment Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Modeling the Jump Shot . . read more..

  • Page - 11

    xii ■CONTENTS ■CHAPTER 9 Boats and Things That Float . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Some Nautical Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Boat Hull Types . . . . . . . . . . . . read more..

  • Page - 12

    ■CONTENTS xiii Lift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Airfoils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . read more..

  • Page - 13

    xiv ■CONTENTS General Force Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 Thrust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . read more..

  • Page - 14

    ■CONTENTS xv Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . read more..

  • Page - 15

    xvi ■CONTENTS Laser Damage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Laser Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 read more..

  • Page - 16

    xvii About the Author ■GRANT PALMER works for the ELORET Corporation, an engineering consulting company under contract to the NASA Ames Research Center in Moffett Field, CA. Grant develops computer programs to simulate the fluid dynamics, thermodynamics, and gas chemistry of spacecraft reentering planetary atmospheres. Grant has authored or coauthored eight books on computer read more..

  • Page - 17

    xix About the Technical Reviewers ■ALAN MCLEOD graduated from MIT with a doctorate in materials engineering, having previously gained bachelor and master’s degrees in metallurgical engineering from the University of Toronto. He then worked for Alcan International as a materials scientist. After several years in industry, he decided to follow his true passion and is now teaching read more..

  • Page - 18

    xxi Acknowledgments As anyone who writes a book knows, a lot of people have to work very hard to bring a book to print. I would like to thank my lead editor, Tony Davis, for always being in my corner during the writing of this book and for helping to formulate the vision for what this book would become. I would also like to thank the project manager, read more..

  • Page - 19

    xxiii Introduction Welcome to the wonderful world of physics. You may be thinking that “wonderful” an d “physics” don’t belong in the same sentence. Once you start to learn a little physics, however, you will find that it is a really interesting and rewarding subject because you will begin to gain an understanding of how things work. You will learn, for read more..

  • Page - 20

    xxiv ■INTRODUCTION What This Book Is Not This book primarily concerns itself with physics and is not a game programming book per se. There will be nothing in this book on game theory or how to render images on the screen. Many other good books on those elements of game programming are available, including Advanced Java Game Programming by David Croft (Apress, 2004). read more..

  • Page - 21

    ■INTRODUCTION xxv Tidbits Physics really is an interesting subject, and it is one that has been developing over thousands of years. The history of physics is full of many fascinating and quirky characters. Scattered throughout the book are Tidbit sections that provide historical trivia and other interesting information about the subjects being covered in the chapter. Did read more..

  • Page - 22

    1 ■ ■ ■ CHAPTER 1 Adding Realism to Your Games You’re a game programmer. You know how to render complex car chase scenes on the screen. You know about game theory and how to make your games interesting and strategy filled. But physics? Physics is for old guys in white lab coats working in secret laboratories. Game program- mers are—well, programmers. Why does read more..

  • Page - 23

    2 CH APTER 1 ■ A DDING RE ALISM TO YOUR GAMES If someone read a review like this, they might think “Hey, this game sounds cheesy. I don’t think I’ll buy it.” The point is that physics matters. It is one of the first things reviewers and potential users will look at when they are evaluating your game. Keep in mind when creating games (just like read more..

  • Page - 24

    CH A P T E R 1 ■ ADDING REALISM TO YOUR GAMES 3 The force of gravity will pull on the car down the ramp. The magnitude of the force is equal to the mass of the car, m, the acceleration due to gravity, g, and the sine of the angle of the ramp, q. Once again, Equation (1.2) is simple, and yet it accurately models the gravitational force acting read more..

  • Page - 25

    4 CH APTER 1 ■ A DDING RE ALISM TO YOUR GAMES Knowing Some Physics Will Make You a Better Game Programmer Having a physics-based understanding of how things work will make you a better game programmer in several ways. For one thing, having a physical understanding of what you are trying to simulate gives you the knowledge of what effects to read more..

  • Page - 26

    5 ■ ■ ■ CHAPTER 2 Some Basic Concepts After reading Chapter 1, you’re probably anxious to incorporate realistic physics into your game simulations. Before we get into specific physics models to model how airplanes fly or what happens when a bat hits a baseball, you need to have an understanding of some core concepts and definitions that will be used read more..

  • Page - 27

    6 CH APTER 2 ■ S O ME BAS IC CONCEPTS Systems of Units To describe the physical world, we need to measure things. We want to know how heavy some- thing is or how fast it is traveling. In order to measure things, a system of units is required. It would be nice if there were one universal system of units. Unfortunately, there are two widely used read more..

  • Page - 28

    CHAPTER 2 ■ SOM E BASIC C O NCEPTS 7 Over the centuries, many other types of units have been devised that you may come across from time to time. In the English system, some of the “other” units can seem a little strange. For example, a grain is a unit of mass in the English system, and there are 7024 grains to a pound. The SI system also read more..

  • Page - 29

    8 CH APTER 2 ■ S O ME BAS IC CONCEPTS For numbers with a magnitude of less than one, the number after the letter “e” is negative. For values with a magnitude greater than one, the number after the letter “e” is positive. The mass of Earth’s moon, for instance, is a very large number and would be expressed in scientific notation as 7.3483e+22 kg. An read more..

  • Page - 30

    CHAPTER 2 ■ SOM E BASIC C O NCEPTS 9 they are symbols generally used to represent a variable, constant, or mathematical operation. An equation written with Western alphabet letters: could have been written using Greek letters: and the meaning of the two equations would be the same. As a general rule, if you see a symbol in an equation in this read more..

  • Page - 31

    10 CH APTER 2 ■ S O ME BAS IC CONCEPTS defines the position of an object by a distance r from an origin and two angles q and j as shown in Figure 2-2. Figure 2-2. The spherical coordinate system The spherical coordinate system is useful for describing circular or rotational motion. There will be times in your game programming when the spherical read more..

  • Page - 32

    CHAPTER 2 ■ SOM E BASIC C O NCEPTS 11 each coordinate direction. For example, under the three-dimensional Cartesian coordinate system the velocity of an object could be separated into x-, y-, and z-components. The velocity vector, v, is on the left-hand side of Equation (2.8). The arrow symbol on top of the v, x, y, and z terms in Equation (2.8) is read more..

  • Page - 33

    12 CH APTER 2 ■ S O ME BAS IC CONCEPTS Vector Cross Product Vectors are two- or three-dimensional quantities, but standard mathematical operations can be performed on them. Two vectors can be added to or subtracted from each other. When you are incorporating physics into your game programs, there may be times you will need to find a vector that is normal or read more..

  • Page - 34

    CHAPTER 2 ■ SOM E BASIC C O NCEPTS 13 The matrix shown in Equation (2.13) is a two-dimensional matrix with three rows and three columns. Matrices can be of any dimension. In this book, we will use 1-, 2-, and 3-dimensional matrices. Matrices are commonly used in the development of mathematical and physics models. In this book, we will make use of matrices read more..

  • Page - 35

    14 CH APTER 2 ■ S O ME BAS IC CONCEPTS There are times, however, when you will need to temporarily rotate the coordinate axes to perform a calculation. This is required, for example, when modeling the collision of a golf club head and a golf ball. Coordinate axes rotations are typically performed two-dimensionally. The axis of rotation is taken to be one read more..

  • Page - 36

    CHAPTER 2 ■ SOM E BASIC C O NCEPTS 15 We won’t go into the problem of developing and displaying a three-dimensional rotation matrix here, but instead will defer that problem to Chapter 10, where we will use a three- dimensional rotation matrix to build an airplane flight simulator. We will use two-dimensional rotation matrices when we model collisions in read more..

  • Page - 37

    16 CH APTER 2 ■ S O ME BAS IC CONCEPTS Figure 2-6. The altitude of the snowboarder as a function of time You might think of modeling the rate of change of altitude of the snowboarder over time by simply subtracting the final altitude and time from the initial altitude and time. Using the Δ form shown in Equation (2.18) is the equivalent of drawing a read more..

  • Page - 38

    CHAPTER 2 ■ SOM E BASIC C O NCEPTS 17 Figure 2-7. Dz/Dt does not accurately predict the rate of fall at a given time. The derivative dz/dt can also be thought of as the slope of the curve shown in Figure 2-6, and its value will change over time. When the snowboarder starts his fall, the slope of the altitude vs. time curve is shallow, and the value read more..

  • Page - 39

    18 CH APTER 2 ■ S O ME BAS IC CONCEPTS Figure 2-8. Comparing acceleration, velocity, and altitude for the snowboarder The acceleration due to gravity is constant, so the acceleration line in Figure 2-8 is horizontal. The derivative of velocity with respect to time is equal to the acceleration. Since acceleration is constant, the velocity of the snowboarder increases read more..

  • Page - 40

    CHAPTER 2 ■ SOM E BASIC C O NCEPTS 19 An example of an ODE is shown in Equation (2.23). It models the motion of a spring and includes both first- and second-order derivatives. The quantity x represents the displacement of the spring from its resting position and m is the mass of a weight attached to the end of the spring. The m parameter read more..

  • Page - 41

    20 CH APTER 2 ■ S O ME BAS IC CONCEPTS Some of the specific points to remember from this chapter include the following: • It is important to be consistent with units when implementing physics models. • It is a standard convention to use Greek letters in physics equations. • Most programming languages recognize scientific notation. • We can use the vector read more..

  • Page - 42

    21 ■ ■ ■ CHAPTER 3 Basic Newtonian Mechanics People have been interested in the science of how objects move for thousands of years. The ancient Greeks, men like Aristotle, were responsible for many of the early theories on the causes of motion. Unfortunately, the ancient Greeks made a lot of mistakes. For instance, they thought that if two objects were dropped from read more..

  • Page - 43

    22 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS A Short Biography of Sir Isaac Newton Before we delve into the subject of Newtonian mechanics, let’s learn a little bit about the man behind them. Sir Isaac Newton (1642–1727) was an English mathematician, physicist, chemist, and one of the most brilliant men who ever walked the face of the earth. Newton developed the read more..

  • Page - 44

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 23 In other words, a body at rest will stay at rest unless acted upon by an external force. Similarly, a body traveling in a straight line, what Newton called a “right line,” will maintain a constant velocity unless acted upon by an external force. The ability of an object to resist a change in its motion read more..

  • Page - 45

    24 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS a rock will have a certain mass, and the mass of the rock is the same whether the rock is on the surface of the earth or on Jupiter. Weight, on the other hand, is the force of gravity that acts upon an object. It is equal to the mass of the object, m, times the gravitational acceleration, g. Weight is not read more..

  • Page - 46

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 25 In Equation (3.3a), the quantity ax is the acceleration in the x-direction. Dividing a force into directional components allows for a more refined analysis of the effects of the given force on an object. If the force is directed in the x-direction, the acceleration will be in the x-direction as well, and there will read more..

  • Page - 47

    26 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS The parameter G in Equation (3.5) is a constant value known as the gravitational constant. It has a value of 6.674e-11 N-m2/kg2. The gravitational constant is referred to as a fundamental physical constant because its value can be used to compute the gravitational force between any two objects. The distance r in read more..

  • Page - 48

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 27 Gravitational acceleration is typically represented by a lowercase g, and we will use that convention throughout this book. One characteristic of gravitational force is that it is always “turned on.” Every object on Earth is always subject to Earth’s gravitational force. Gravitational force and its corresponding acceleration read more..

  • Page - 49

    28 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS The Gravity Game is implemented in a class called GravityGame. Most of the program involves setting up the GUI elements of the game. We won’t cover the GUI aspects of the code in any detail. The first thing the program does is to declare the fields used in the class. The first group of fields declared in the read more..

  • Page - 50

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 29 Gravity Game, a Timer object is used to slow the game down. The GameUpdater class is a user- defined class that declares a method that the Timer object will call. We’ll discuss this method in more detail in a little bit. // These elements are used to control the execution // speed of the game. read more..

  • Page - 51

    30 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS // Determine which planet is selected and set // the gravitational acceleration accordingly. String planet = (String)planetComboBox.getSelectedItem(); if ( planet.equals("Earth") ) { g = 9.81; } else if ( planet.equals("Moon") ) { g = read more..

  • Page - 52

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 31 // If the ball hits the ground, stop the simulation // and determine if it landed in the box. if ( ballAltitude <= 0.0 ) { gameTimer.stop(); if ( ballLocation >= boxLocation && ballLocation <= read more..

  • Page - 53

    32 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS One of the consequences of friction is heat. When objects rub against each other, heat is generated. Rockets reentering a planetary atmosphere will heat up due to friction between the surface of the rocket and the colliding gas particles of the atmosphere. One reason your car engine needs a cooling system is the read more..

  • Page - 54

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 33 Figure 3-3. Normal force on a box resting on an inclined ramp ■Tidbit Did you ever wonder why snails and slugs emit their disgusting slime? Among other reasons, the slime helps the snail move by reducing the coefficient of friction between the snail and the ground. There are some other interesting read more..

  • Page - 55

    34 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS The Coefficient of Friction The value of frictional force between two objects depends on the coefficient of friction, m, between the contacting surfaces. If you’ve ever removed a cork from a bottle, you may have noticed that initially you have to exert a lot of force to get the cork to move, but once the cork read more..

  • Page - 56

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 35 shown in Figure 3-5. When the Start button is pressed, a black disk slides across the surface of the board with an initial velocity that is determined by the user. A friction force between the disk and the board resists the motion of the disk. When the disk comes to rest, the user is awarded the score according read more..

  • Page - 57

    36 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS The Timer is set up to call the actionPerformed method declared in the GameUpdater class (an inner class of the Shuffleboard class) every 0.05 seconds. Inside the method, the time, disk velocity, and disk location are updated. The display is then redrawn using the updateDisplay method to show the new location read more..

  • Page - 58

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 37 Exercise 2. An aluminum box with a mass of 2 kg is placed on a steel plate that is initially placed on a flat, level surface. One edge of the plate is lifted such that the plate is now at an inclined angle. If the edge of the plate is continually lifted thereby increasing the inclined angle, at read more..

  • Page - 59

    38 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS There are a couple of interesting things to note about spring forces. First of all, a spring exerts a restoring force, one that acts to restore the spring to its equilibrium position. If the spring at its equilibrium position is pulled to the right to a new length l, as shown in Figure 3-7, the spring force on read more..

  • Page - 60

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 39 Figure 3-8. An object traveling in circular motion has continually changing velocity vector. Even though the velocity magnitude of the object may be constant, the directional compo- nents of velocity are continually changing. If we consider the circular motion in a two-dimensional Cartesian coordinate system, when the object is read more..

  • Page - 61

    40 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS an applied force, the important thing to determine is the net force on the body. An object may have more than one force acting on it. We have seen multiple force situations already in this chapter in the schematics of the box on the inclined plane and in our discussion of springs. When analyzing the forces at work read more..

  • Page - 62

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 41 Figure 3-10. The force diagram for the box on a ramp Work So far in this chapter, we have introduced the concept of a force and how a force is character- ized by Newton’s three laws of motion. In the remaining sections of this chapter, we will look at some other fundamental physical concepts that are related to read more..

  • Page - 63

    42 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS For the box to move, the cow must push with a horizontal force, FC, equal to the coefficient of friction multiplied by the weight of the box. The work that the cow has done in moving the box, assuming that she only pushes with the minimum required force, is equal to the applied force times the distance that the read more..

  • Page - 64

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 43 Energy Energy is defined as the capacity for doing work. Energy is a state variable, meaning that it is used to characterize the physical state of an object. Energy, work, and force are closely related. We learned in the last section that it requires a force to perform work. Since energy is the capacity for doing read more..

  • Page - 65

    44 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS multiplied by its velocity magnitude squared. Work is performed on the projectile as it travels upwards. When the projectile reaches its highest point, its velocity is zero, meaning that all of its kinetic energy has been converted to work. The height, h, that the projectile will reach can be found by equating its read more..

  • Page - 66

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 45 Conservation of Energy We have already talked about how energy can be converted from one form into another. This concept can be expanded into one of the fundamental concepts of physics—conservation of energy, which states that energy can neither be created nor destroyed, only converted from one form into another. There are read more..

  • Page - 67

    46 CH APTER 3 ■ BASIC NEWTONIAN ME CHANICS known as a watt or W for short. A commonly used unit of power in the English system of units is the horsepower or hp. One hp is equal to 745.7 W. Power is also used to describe the performance of engines. We will use the concept of power when we simulate cars in Chapter 8, boats in Chapter 9, and read more..

  • Page - 68

    CHAPTER 3 ■ BASIC NEWTONIA N MECH ANICS 47 2. Referring to the schematic diagram shown in Figure 3-2 earlier in this chapter, the box will begin to slide when the force on the box parallel to the ramp is equal to the maximum static friction force. The angle at which the box begins to slide is therefore equal to the following: An interesting thing to note read more..

  • Page - 69

    49 ■ ■ ■ CHAPTER 4 Basic Kinematics The previous chapter introduced Newtonian mechanics and the subjects of force, work, energy, and power. We encountered Newton’s three laws of motion, which characterize the behavior of forces and relate a force applied to an object to the resulting acceleration of the object. In this chapter, we will expand the discussion of read more..

  • Page - 70

    50 CH APTER 4 ■ BASIC KINE MATIC S The Relationship Between Force, Acceleration, Velocity, and Location Newton’s second law, which was introduced in Chapter 3, relates the net external force on an object, F, to the mass and acceleration of the object. The arrows above the force and acceleration terms in Equation (4.1) indicate that they are vector quantities read more..

  • Page - 71

    CH APTER 4 ■ BASIC KIN E MATICS 51 The location of an object is a vector quantity, and Equation (4.6) can be divided into directional components. In the Cartesian frame of reference, Equation (4.6) would be split into x-, y-, and z-direction components. Since acceleration is the derivative of velocity with respect to time and velocity is the derivative of location read more..

  • Page - 72

    52 CH APTER 4 ■ BASIC KINE MATIC S of time. To obtain the velocity and location requires the solution of the corresponding differ- ential equations. For example, consider the relationship between the z-location of an object and the z-component of velocity. To determine the z-location at a given time, it is necessary to integrate the differential equation shown in read more..

  • Page - 73

    CH APTER 4 ■ BASIC KIN E MATICS 53 The quantity vz0 in Equation (4.14) is the initial velocity in the z-direction of the object at time t = 0. The z-location of the object as a function of time can be computed from Equations (4.14) and (4.7). The quantity z0 in Equation (4.16) is the initial z-location of the object at time t = read more..

  • Page - 74

    54 CH APTER 4 ■ BASIC KINE MATIC S Figure 4-2. A sample Beanbag Game screen shot In the vertical direction, the beanbag will be subject to gravitational acceleration. The vertical location of the beanbag at any point in time is a function of the gravitational accelera- tion, the initial vertical location, and the initial z-velocity component. The Beanbag Game is read more..

  • Page - 75

    CH APTER 4 ■ BASIC KIN E MATICS 55 The actionPerformed method itself is quite simple. The current time is incremented, and then the x- and z-locations of the beanbag are computed according to Equations (4.17) and (4.18). The display is then updated. If the beanbag has hit the ground, the simulation is stopped. The ground in this game is defined at a height read more..

  • Page - 76

    56 CH APTER 4 ■ BASIC KINE MATIC S Fortunately, a number of techniques can be used to solve differential equations when a closed-form solution is not possible. In the next section, a program called a Runge-Kutta ODE solver will be presented that you can use to solve the differential equations that you will encounter in your game programming. The Runge-Kutta read more..

  • Page - 77

    CH APTER 4 ■ BASIC KIN E MATICS 57 Figure 4-3. A general z-location vs. time curve The issue that remains is where should the velocity, vz(z,t), be evaluated. A natural choice would be to evaluate the velocity at the known conditions, zn and tn. This approach is known as Euler’s method. Unfortunately, Euler’s method is not accurate unless the slope of read more..

  • Page - 78

    58 CH APTER 4 ■ BASIC KINE MATIC S Clearly, a better way is needed to estimate the value of zn+1, and that’s where the fourth- order Runge-Kutta method comes into the picture. The essence of the fourth-order Runge-Kutta scheme is that a series of estimates are made for the z-location at the new time by evaluating the velocity at different values of x read more..

  • Page - 79

    CH APTER 4 ■ BASIC KIN E MATICS 59 In Equation (4.25), the derivative of vx is a function of vx and x. In Equation (4.26), the derivative of x is a function of vx. Because the solution of vx as a function of time depends on x and the solution of x as a function of time depends on vx, the two equations are said to be coupled and must read more..

  • Page - 80

    60 CH APTER 4 ■ BASIC KINE MATIC S The ODE Class We’ll start with the class that represents the ODE to be solved, which will be called the ODE class. This class will represent a generic ordinary differential equation. Classes to represent specific types of ODEs, to model spring or projectile motion for instance, will be written as subclasses of the read more..

  • Page - 81

    CH APTER 4 ■ BASIC KIN E MATICS 61 // These methods change the value of the dependent // or independent variables. public void setS(double value) { s = value; return; } public void setQ(double value, int index) { q[index] = value; return; } The final thing the ODE class does is to declare read more..

  • Page - 82

    62 CH APTER 4 ■ BASIC KINE MATIC S public class ODESolver { // Fourth-order Runge-Kutta ODE solver. public static void rungeKutta4(ODE ode, double ds) { // Define some convenience variables to make the // code more readable int j; int numEqns = ode.getNumEqns(); double s; double q[]; double read more..

  • Page - 83

    CH APTER 4 ■ BASIC KIN E MATICS 63 for(j=0; j<numEqns; ++j) { q[j] = q[j] + (dq1[j] + 2.0*dq2[j] + 2.0*dq3[j] + dq4[j])/6.0; ode.setQ(q[j], j); } return; } } The rungeKutta4 method is quite simple and takes only 38 lines of code including comment statements. To apply the Runge-Kutta solver to a specific read more..

  • Page - 84

    64 CH APTER 4 ■ BASIC KINE MATIC S // SpringODE constructor. public SpringODE(double mass, double mu, double k, double x0) { // Call the ODE constructor indicating that there // will be two coupled first-order ODEs. super(2); // Initialize fields declared in the class. read more..

  • Page - 85

    CH APTER 4 ■ BASIC KIN E MATICS 65 public double getX() { return getQ(1); } public double getTime() { return getS(); } The ODE solver will be used to update the location and velocity of the spring as a function of time. The SpringODE class declares a method called updatePositionAndVelocity that calls the Runge-Kutta solver. // read more..

  • Page - 86

    66 CH APTER 4 ■ BASIC KINE MATIC S The only thing that remains to be done is to write a driver program that will create a SpringODE object and compute its motion using the Runge-Kutta solver. The driver class is called RK4Spring, and it really is quite simple. Values for mass, damping coefficient, spring constant, and initial location are defined and read more..

  • Page - 87

    CH APTER 4 ■ BASIC KIN E MATICS 67 Figure 4-5. Spring location as a function of time One great thing about the ODE solver as we have written it is that it is completely general to virtually any time of initial boundary value ODE. You never have to change the code in the ODE or ODESolver classes. Whenever you have a need to solve an ODE in your read more..

  • Page - 88

    68 CH APTER 4 ■ BASIC KINE MATIC S fields representing the GUI components, the SpringSimulator class declares a SpringODE object as one of its fields. public class SpringSimulator extends JFrame implements ActionListener { private JTextField massTextField; private JTextField muTextField; private JTextField kTextField; private JTextField x0TextField; private read more..

  • Page - 89

    CH APTER 4 ■ BASIC KIN E MATICS 69 simple, consisting of only three lines of executable code. Every time the method is called, the updatePositionAndVelocity method is called on the SpringODE object to update the velocity and location of the spring. The update is performed using the Runge-Kutta ODE solver. Once the new values of velocity and location are read more..

  • Page - 90

    70 CH APTER 4 ■ BASIC KINE MATIC S make a ball “stick” on the green. A car engine uses the rotational motion of the driveshaft and gearbox to transmit power to the wheels. These are just two of the many examples where you will have to model rotational motion in your game programming. Let’s start our exploration of rotational motion by discussing some read more..

  • Page - 91

    CH APTER 4 ■ BASIC KIN E MATICS 71 The angular acceleration will have units of rad/s2. The tangential velocity, vr, of any point on the disk is equal to the angular velocity, w, multiplied by the distance, r, from the origin to the point. The tangential velocity will have units of m/s and will be in a direction perpendicular to the line drawn from read more..

  • Page - 92

    72 CH APTER 4 ■ BASIC KINE MATIC S Figure 4-9. If force is applied at an angle to the moment arm, torque is reduced. Torque and Angular Acceleration Newton’s second law relates a net external force to a translational acceleration by the equation F = ma. There is a corresponding equation in rotational motion that relates a net torque, t, on an object read more..

  • Page - 93

    CH APTER 4 ■ BASIC KIN E MATICS 73 Rigid Body Motion So far in this chapter, we have looked at translational and rotational motion separately. It’s time now to put the two together to describe what is known as rigid body motion—the general motion of an object that is traveling through space and rotating at the same time. Combined rotational and read more..

  • Page - 94

    74 CH APTER 4 ■ BASIC KINE MATIC S Because “size doesn’t matter” when it comes to Newton’s second law, the translational motion that results from an external force on an object can be modeled as if the object were shrunk to an infinitesimally small particle located at a point known as the center of mass of the object. For symmetrical objects made from read more..

  • Page - 95

    CH APTER 4 ■ BASIC KIN E MATICS 75 Figure 4-11. The center of mass can lie outside of an object. Rigid Body Motion Coordinate Axes The translational motion of an object can be modeled by treating the object as a particle located at the center of mass of the object. Any external forces on the object are assumed to act through the center of mass. The read more..

  • Page - 96

    76 CH APTER 4 ■ BASIC KINE MATIC S Figure 4-13. An object rolling down a ramp has both translational and rotational motion. As the object rolls down the ramp, it experiences both translational and rotational motion. If the object is symmetrical and has a uniform material distribution, the center of mass will be located in the center of the object, and as the read more..

  • Page - 97

    CH APTER 4 ■ BASIC KIN E MATICS 77 Equations (4.32) and (4.35) can be combined to express the rotational acceleration, a, as a function of the friction force. Because the object is rolling without slipping, the translational acceleration can be related to the angular acceleration by the expression a = r a. Replacing a with r a in Equation (4.36), an expression read more..

  • Page - 98

    78 CH APTER 4 ■ BASIC KINE MATIC S As was done with the previous problem, the analysis of this problem begins with a force diagram, shown in Figure 4-14. The bowling ball is sliding down the lane with a translational velocity, vx. The surface is horizontal, so the normal force, FN, between the ball and the lane is equal to the gravitational force, mg. A read more..

  • Page - 99

    CH APTER 4 ■ BASIC KIN E MATICS 79 Since the bowling ball is initially sliding without rolling, the initial angular velocity, w0, is equal to zero. The moment of inertia for the ball can be found earlier in Table 4-2. Inserting Equation (4.45) into Equation (4.44) results in an equation for angular velocity of the bowling ball at any time, t. The next read more..

  • Page - 100

    80 CH APTER 4 ■ BASIC KINE MATIC S Whether it’s modeling arrows, cars, boats, or airplanes, every physical model that describes a body in motion will use the basic kinematic relations. The chapter began with an examination of translational motion. If the forces acting upon an object can be determined, the acceleration, velocity, and position of the object can be read more..

  • Page - 101

    CH APTER 4 ■ BASIC KIN E MATICS 81 // Compute the intermediate values of the // dependent variables. for(int i=0; i<2; + +i) { newQ[i] = q[i] + qScale*deltaQ[i]; } // Compute right-hand side values. double G = -9.81; dq[0] = ds*G - ds*(mu*newQ[0] + k*newQ[1])/mass; dq[1] = read more..

  • Page - 102

    83 ■ ■ ■ CHAPTER 5 Projectiles The previous two chapters explored the subjects of Newtonian mechanics and kinematics, and presented the basic equations that govern linear and rotational motion. It’s time now to apply those basic relations to a more specific problem, namely modeling the flight of a projec- tile. You will probably work with projectiles quite a lot read more..

  • Page - 103

    84 CH APTER 5 ■ PROJEC TILES Basic Concepts The fundamental relations that govern projectile flight can be found in Newton’s laws of motion and basic kinematics. To determine the linear motion of a projectile requires an evaluation of the forces acting on the projectile. Generally speaking, projectiles will rotate as they fly through the air, so the projectile motion read more..

  • Page - 104

    CH APTER 5 ■ PROJE CTILES 85 Figure 5-2. Force diagram for the gravity-only model The advantage of the gravity-only model is its simplicity. As we saw in Chapter 4, if the force applied to an object is constant, then the velocity and location of the object as a function of time are described by simple algebraic equations. There is no need to use an ODE read more..

  • Page - 105

    86 CH APTER 5 ■ PROJEC TILES As shown in Equation (5.1) the derivative of velocity with respect to time is equal to accel- eration. As we saw in Chapter 4, if an expression for the acceleration is known, then the velocity of the projectile can be found by integrating Equation (5.1). The quantity v0 is the initial velocity of the projectile. If the read more..

  • Page - 106

    CH APTER 5 ■ PROJE CTILES 87 Let’s see what a typical trajectory under the gravity-only model looks like. We’ll assume that the y-components of motion are zero, so the trajectory will be restricted to the x-z plane. Here are the initial conditions that will be used: The x- and z-locations as a function of time are computed using Equations (5.8a) and (5.8c). read more..

  • Page - 107

    88 CH APTER 5 ■ PROJEC TILES If you look at the expressions in Equations (5.6) and (5.8), you will see that the location and velocity in each coordinate direction is independent of the other directions. For example, there are no x- or y-components in the z-direction equations of motion. Another important point to note about the equations of motion under the read more..

  • Page - 108

    CH APTER 5 ■ PROJE CTILES 89 When designing the SimpleProjectile class, we need to think a little bit about the future. One of the central goals of object-oriented programming in a language such as Java is to reuse as much code as possible. The equations of motion for the gravity-only model can be solved directly using simple algebraic equations. However, read more..

  • Page - 109

    90 CH APTER 5 ■ PROJEC TILES The SimpleProjectile class declares a series of methods to return the current location, velocity, and time values for the projectile. Since these quantities are stored in the s field and q[] array of the ODE class, the get methods in the SimpleProjectile class simply call the getS or getQ methods from the ODE class. read more..

  • Page - 110

    CH APTER 5 ■ PROJE CTILES 91 double time = getS(); double vx0 = getQ(0); double x0 = getQ(1); double vy0 = getQ(2); double y0 = getQ(3); double vz0 = getQ(4); double z0 = getQ(5); // Update the xyz locations and the z-component // of velocity. The x- and y-velocities don't read more..

  • Page - 111

    92 CH APTER 5 ■ PROJEC TILES components that are used to input the initial velocity components of the golf ball. These values can be changed to adjust the trajectory of the ball. Another text field adjusts the distance from the tee to the flag, and a combo box lets the user select either a side or top-down view. Figure 5-4. A sample Golf Game screen read more..

  • Page - 112

    CH APTER 5 ■ PROJE CTILES 93 public class GolfGame extends JFrame implements ActionListener { private JTextField vxTextField; private JTextField vyTextField; private JTextField vzTextField; private JTextField distanceTextField; private JLabel vxLabel; private JLabel vyLabel; private JLabel vzLabel; private JLabel distanceLabel; private JComboBox axesComboBox; read more..

  • Page - 113

    94 CH APTER 5 ■ PROJEC TILES public GolfGame() { // Create a SimpleProjectile object. golfball = new SimpleProjectile(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // Initialize the distanceToHole field. distanceToHole = 200.0; // Create a Timer object that will be used // to slow the action down read more..

  • Page - 114

    CH APTER 5 ■ PROJE CTILES 95 // Create a SimpleProjectile object. golfball = new SimpleProjectile(0.0, 0.0, 0.0, vx0, vy0, vz0, 0.0); // Update the display. updateDisplay(); // Start the box sliding using a Timer object // to slow down the action. gameTimer.start(); } The read more..

  • Page - 115

    96 CH APTER 5 ■ PROJEC TILES // Determine if ball is on the green. if ( golfball.getX() > distanceToHole - 10.0 && golfball.getX() < distanceToHole + 10.0 && golfball.getY() < 10.0) { g.drawString("You're on the green", 100, 30); read more..

  • Page - 116

    CH APTER 5 ■ PROJE CTILES 97 Summary: Gravity-Only Projectile Trajectory Model A very simple projectile model that we call the gravity-only model can be formulated if it is assumed that the only net force on the projectile is due to gravity. Here are some of the key outcomes of the gravity-only model: • The only force on the projectile is due to gravity, read more..

  • Page - 117

    98 CH APTER 5 ■ PROJEC TILES Aerodynamic Drag Aerodynamic drag is the resistance that air or any other type of gas exerts on a body traveling through it. If you stick your hand out of the window of a moving car or try to ride your bicycle into the wind, you can feel the drag force on your body. Drag is an important physical effect, particularly for read more..

  • Page - 118

    CH APTER 5 ■ PROJE CTILES 99 In Equation (5.12) the quantity A is a characteristic body area. Its definition will differ depending on the body geometry. For most objects, the characteristic area is taken to be the frontal area. For a sphere, the frontal area would be the cross-sectional area, pr2. Density is a measure of how heavy the fluid is and is read more..

  • Page - 119

    100 CH APTER 5 ■ PROJEC TILES Figure 5-6. The drag coefficient of a sphere as a function of Reynolds number In addition to Reynolds number, the drag coefficient is strongly influenced by the geometry and orientation of an object. Table 5-2 shows the drag coefficient of some basic two-dimensional shapes in air at a Reynolds number of 1.0e+5. The drag read more..

  • Page - 120

    CH APTER 5 ■ PROJE CTILES 101 Table 5-2. Drag Coefficients of Simple Two-Dimensional Shapes (Re = 1.0e+5) Shape Picture C D Flat plate 2.0 Square cylinder 2.1 Rotated square cylinder 1.6 Solid half-cylinder 1.7 Solid half-cylinder 1.2 Circular cylinder 1.2 2:1 Elliptical cylinder 0.6 Hollow half-cylinder 2.3 Hollow half-cylinder 1.2 read more..

  • Page - 121

    102 CH APTER 5 ■ PROJEC TILES Drag coefficient is also influenced by whether a shape is two- or three-dimensional. Table 5-3 shows drag coefficients for a Reynolds number of 1.0e+5 for some typical three- dimensional shapes. The drag coefficient for a three-dimensional shape is less than that for the corresponding two-dimensional shape. For example, the drag coefficient read more..

  • Page - 122

    CH APTER 5 ■ PROJE CTILES 103 reasonable to assume that the drag coefficient for a projectile is constant. You could also take the more rigorous approach and build a variable drag coefficient into your projectile model. As a game programmer, you will have to decide whether it is necessary to add this extra complexity to your simulation. Altitude Effects on read more..

  • Page - 123

    104 CH APTER 5 ■ PROJEC TILES number is increased, there is a point where the smooth laminar flow over the object transitions to an agitated, chaotic condition known as turbulent flow. Modeling the physics of turbulent flow and the transition from laminar to turbulent flow is a very complex subject. Even today, there is no generally applicable model for read more..

  • Page - 124

    CH APTER 5 ■ PROJE CTILES 105 Figure 5-7. The force diagram with gravity and drag effects The value of drag force for a given object can be computed from Equation (5.12). What is required to evaluate that expression is the density of the fluid, a characteristic area, the velocity magnitude of the object, and the drag coefficient. The velocity magnitude, or speed, read more..

  • Page - 125

    106 CH APTER 5 ■ PROJEC TILES Since drag force acts in the opposite direction to velocity, the general effect of drag is that it reduces the projectile velocity. Looking at the z-direction force equation shown in Equation (5.17c), when the projectile is climbing, drag will slow down the rate of climb. When the projectile is falling back down to Earth, drag read more..

  • Page - 126

    CH APTER 5 ■ PROJE CTILES 107 To determine the velocity components as a function of time, the differential equations shown in Equation (5.19) must be integrated. For the gravity-only model, the velocity differential equations were simple enough to be solved directly into simple algebraic equations. Unfortu- nately, this simplicity is not the case when aerodynamic drag is read more..

  • Page - 127

    108 CH APTER 5 ■ PROJEC TILES Terminal Velocity Before we start to code up aerodynamic drag effects, let’s take a little detour to discuss an inter- esting feature of aerodynamic drag. As we have seen, aerodynamic drag resists the motion of an object through the air and is proportional to the square of the velocity of the object. Because aerodynamic drag read more..

  • Page - 128

    CH APTER 5 ■ PROJE CTILES 109 public DragProjectile(double x0, double y0, double z0, double vx0, double vy0, double vz0, double time, double mass, double area, double density, double Cd) { // Call the SimpleProjectile class constructor. super(x0, y0, z0, vx0, vy0, vz0, time); // read more..

  • Page - 129

    110 CH APTER 5 ■ PROJEC TILES combination of the four guesses. The first thing the getRightHandSide method does is to compute the intermediate values of location, velocity, and time. // The getRightHandSide() method returns the right-hand // sides of the six first-order projectile ODEs // q[0] = vx = dxdt // q[1] = x // q[2] = read more..

  • Page - 130

    CH APTER 5 ■ PROJE CTILES 111 dQ[3] = ds*vy; dQ[4] = ds*(G - Fd*vz/(mass*v)); dQ[5] = ds*vz; return dQ; } } Because it can reuse so much code from the SimpleProjectile and ODE classes, the DragProjectile class is quite short, only requiring 90 lines of code including comment state- ments. In the next section, the read more..

  • Page - 131

    112 CH APTER 5 ■ PROJEC TILES The GolfGame2 class is quite similar to the GolfGame class, so rather than discuss the entire code, we’ll only focus on the differences. As always, the entire code listing can be downloaded from the Apress website. In addition to declaring fields for the four new text fields, the GolfGame2 class also declares a read more..

  • Page - 132

    CH APTER 5 ■ PROJE CTILES 113 The actionPerformed method called by the Timer is exactly the same as the version in the original Golf Game. Because the projectile trajectory classes have been created sequentially using a common data structure, no changes need to be made to this method. Play around with the Golf Game version 2 by adjusting the variables that read more..

  • Page - 133

    114 CH APTER 5 ■ PROJEC TILES trajectory model. Simple closed-form solutions to the equations of motion are no longer possible, but the equations can be solved using an ODE solver. Some of the key points of the projectile trajectory model with drag effects are as follows: • Drag force acts in the opposite direction to the velocity. The magnitude of the read more..

  • Page - 134

    CH APTER 5 ■ PROJE CTILES 115 The presence of wind changes the apparent velocity seen by a projectile. In Figure 5-10, a projectile travels with a velocity, v. There is a wind present with a velocity, vw. The apparent velocity, va, seen by the projectile is the vector sum of the projectile and wind velocities. The directional components of apparent velocity are read more..

  • Page - 135

    116 CH APTER 5 ■ PROJEC TILES divided by the projectile mass, and the velocity and position components would be found by integrating the acceleration and velocity equations. An interesting thing to note about Equation (5.25c) is that while there is no wind velocity component in the z-direction, the drag force in the z-direction is affected by wind, because the read more..

  • Page - 136

    CH APTER 5 ■ PROJE CTILES 117 public DragProjectile(double x0, double y0, double z0, double vx0, double vy0, double vz0, double time, double mass, double area, double density, double Cd, double windVx, double windVy) { // Call the DragProjectile class constructor. read more..

  • Page - 137

    118 CH APTER 5 ■ PROJEC TILES public double[] getRightHandSide(double s, double q[], double deltaQ[], double ds, double qScale) { double dQ[] = new double[6]; double newQ[] = new double[6]; // Compute read more..

  • Page - 138

    CH APTER 5 ■ PROJE CTILES 119 Golf Game Version 3 With the WindProjectile class available to us, we can modify the Golf Game to incorporate wind effects. The class that will implement the new version of the game is called GolfGame3. A typical screen shot for the game is shown in Figure 5-11. Two new text fields have been added to the GUI that allow the read more..

  • Page - 139

    120 CH APTER 5 ■ PROJEC TILES The actionPerformed method that is called when the Fire button is pressed extracts the input values from all of the text fields including the input values for the x- and y-components of wind velocity. A WindProjectile object is created and initialized with the input values. The start method is called to begin the simulation. // read more..

  • Page - 140

    CH APTER 5 ■ PROJE CTILES 121 Play around with Golf Game version 3 and you will discover that wind has a strong effect on the flight of a golf ball. Figure 5-12 shows the trajectory of a golf ball under a 10 m/s (36 km/hr) headwind, a 10 m/s tailwind, and under a zero wind condition. If there is no wind, the golf ball travels 126 m. In the read more..

  • Page - 141

    122 CH APTER 5 ■ PROJEC TILES Figure 5-13. The effect of crosswind on golf ball flight Summary: Adding Wind Effects to the Projectile Trajectory Model Adding wind effects to the projectile trajectory model required changing the way the drag force components were evaluated. To account for the effects of wind, the apparent velocities, rather than the translational read more..

  • Page - 142

    CH APTER 5 ■ PROJE CTILES 123 Before we can come up with an equation that describes the force due to spinning, we need to back up a bit and talk about an expression known as Bernoulli’s equation. It is an equation that relates the pressure, p, of a fluid to the kinetic and potential energy of the fluid. In Equation (5.27), r is the fluid read more..

  • Page - 143

    124 CH APTER 5 ■ PROJEC TILES ■Tidbit In 1672, Sir Isaac Newton was the first to note in writing that the flight of a tennis ball was affected by its spin. Apparently even when he was exercising, Newton’s mind was on physics. The size of the Magnus force exerted on an object depends on the characteristics of the fluid, the geometry of the object, read more..

  • Page - 144

    CH APTER 5 ■ PROJE CTILES 125 Figure 5-15. The projectile force diagram including gravity, drag, and Magnus force The Magnus force effect is very important in the sporting world. Golfers make use of back- spin to increase the length of their golf shots. Putting the proper spin on a baseball is what makes curveballs curve and sliders slide. Tennis players, on read more..

  • Page - 145

    126 CH APTER 5 ■ PROJEC TILES In Equation (5.31), rx, ry, and rz are unit vectors that define the axis of rotation. Equation (5.31) is the general equation for the Cartesian components of Magnus force. The equations simplify considerably if the axis of rotation is parallel to one of the coordinate axes. For a sphere with an axis of rotation parallel read more..

  • Page - 146

    CH APTER 5 ■ PROJE CTILES 127 // Initialize variables declared in the SpinProjectile class. this.rx = rx; this.ry = ry; this.rz = rz; this.omega = omega; this.radius = radius; } A series of get methods are declared to return the values of the fields declared in the SpinProjectile class. The read more..

  • Page - 147

    128 CH APTER 5 ■ PROJEC TILES // The getRightHandSide() method returns the right-hand // sides of the six first-order projectile ODEs. // q[0] = vx = dxdt // q[1] = x // q[2] = vy = dydt // q[3] = y // q[4] = vz = dzdt // q[5] = z public double[] getRightHandSide(double s, double q[], read more..

  • Page - 148

    CH APTER 5 ■ PROJE CTILES 129 The method now turns to the computation of the Magnus force. The velocity magnitude is computed and the overall Magnus force is computed from Equation (5.28). The lift coefficient is calculated from Equation (5.29). This particular lift coefficient equation is valid only for a sphere. If the shape of the projectile being modeled is read more..

  • Page - 149

    130 CH APTER 5 ■ PROJEC TILES Figure 5-16. A typical Golf Game version 4 screen shot Since much of the GolfGame4 code is the same as the previous versions of the Golf Game, only a couple of aspects of the code will be discussed. A SpinProjectile object is declared as a field of the GolfGame4 class and will be used to model the golf ball. import read more..

  • Page - 150

    CH APTER 5 ■ PROJE CTILES 131 When the Fire button is pressed, the actionPerformed method declared in the GolfGame4 class is called. The method extracts the values in the text fields and creates a SpinProjectile object based on these initial values. // The actionPerformed() method is called when // the Fire button is pressed. public void read more..

  • Page - 151

    132 CH APTER 5 ■ PROJEC TILES Just as was the case with drag and wind, spin can have a significant effect on the flight of a golf ball. Two golf ball trajectories are shown in Figure 5-17. The first trajectory is computed for a golf ball with a 300 rad/s backspin. The golf ball travels a distance of 170.5 m. The second golf ball has identical read more..

  • Page - 152

    CH APTER 5 ■ PROJE CTILES 133 Figure 5-18. A tilt in the spin axis causes the ball to curve. Summary: Adding Spin Effects to the Projectile Trajectory Model In this section, you learned that a spinning object develops a lifting force known as Magnus force. The magnitude of Magnus force is proportional to the rate at which the object is spinning, and the read more..

  • Page - 153

    134 CH APTER 5 ■ PROJEC TILES Details on Specific Types of Projectiles So far in this chapter, the discussion has focused on the general physics of projectile trajecto- ries. The equations that we explored to model drag, wind, and spin can be applied to any type of projectile. In the last main section of this chapter, we will turn our attention to the specific read more..

  • Page - 154

    CH APTER 5 ■ PROJE CTILES 135 • The density of the air in which the bullet is fired • The direction and velocity of the wind There are many types of bullets in the world today, and they vary in terms of mass, diameter, and muzzle velocity. Table 5-6 lists specifications for some representative types of bullets. The abbreviation FMJ stands for Full read more..

  • Page - 155

    136 CH APTER 5 ■ PROJEC TILES ■Tidbit Cannons have been used in warfare since the early 14th century. Early cannons fired hand-cut stone balls because it was too expensive to smelt iron cannonballs. Cannons were used to fire large arrows as well as cannonballs. As they became more sophisticated and reliable, cannons revolutionized warfare on land and read more..

  • Page - 156

    CH APTER 5 ■ PROJE CTILES 137 Using Equation (5.34), an expression can be derived for the initial velocity, va, of an arrow when the bow is released. Arrows are long, fairly light objects, and as such the flight of an arrow will be strongly influ- enced by wind and drag effects. The drag experienced by an arrow in flight has been measured experimentally, and read more..

  • Page - 157

    138 CH APTER 5 ■ PROJEC TILES Answers to Exercises 1. The time of impact is the time when the vertical or z-position of the projectile will be zero. The time of impact can be determined from Equation (5.8c). The z-component of velocity at the time of impact can be found from Equation (5.8b). The x-component of velocity using the gravity-only model is constant read more..

  • Page - 158

    139 ■ ■ ■ CHAPTER 6 Collisions In Chapter 5, you learned how to model a projectile flying through the air. Eventually all projectiles, whether they are bullets or baseballs, are going to hit something. An important aspect of physics modeling for games is what happens when two objects collide. Do they bounce off each other or stick and travel together? If read more..

  • Page - 159

    140 CH APTER 6 ■ C O LLISIONS Linear Momentum and Impulse In Chapter 2, you learned about force, mass, acceleration, and velocity and used these concepts to model the motion of an object. In modeling a collision between two objects, another physical quantity needs to be introduced—momentum. Momentum is another way to characterize the state of an object in read more..

  • Page - 160

    CHAPTER 6 ■ COL LIS IO NS 141 Combining Equations (6.5) and (6.6) results in an equation relating a linear impulse of force to the resulting change in linear momentum. Let’s apply Equation (6.7) to the collision of a moving object with something solid such as a wall. When the object strikes the wall, it will change the direction of its flight and therefore its read more..

  • Page - 161

    142 CH APTER 6 ■ C O LLISIONS One area where the principle of conservation of linear momentum of a system of objects appears is in the analysis of two-body linear collisions—a subject we will explore a little later in the chapter. Elastic and Inelastic Collisions An analysis of the collision between two objects depends on the momentum of the objects, but read more..

  • Page - 162

    CHAPTER 6 ■ COL LIS IO NS 143 Generally speaking, the harder the objects are that collide, the closer the collision will be to being elastic. The collision of two marbles, for instance, will be a nearly elastic collision. On the other hand, the collision of a beanbag on the floor will be an inelastic collision. Figure 6-2. If the relative pre- and read more..

  • Page - 163

    144 CH APTER 6 ■ C O LLISIONS When they collide, the two objects will experience an impulse of force due to the collision. The magnitude of the impulse will be equal for both objects but will act in opposing directions. The geometric line along which the impulse acts is called the line of action for the collision. The line of action of the collision is read more..

  • Page - 164

    CHAPTER 6 ■ COL LIS IO NS 145 If you look at Equation (6.12), you will see that momentum is conserved in both the x- and y-directions, but only the velocities in the x-direction change as a result of the collision. If you recall, the line of action for this analysis was taken to be parallel to the x-axis. This observation highlights a general rule read more..

  • Page - 165

    146 CH APTER 6 ■ C O LLISIONS Exercise 1. A solid sphere with a mass of 1 kg and with velocity components v 1x = 20 m/s and v 1y = 4 m/s strikes a second sphere with a mass of 9 kg and velocity components of v 2x = 5 m/s and v 2y = -3 m/s. Assuming that the line of action for the impact is parallel to the x-axis and that read more..

  • Page - 166

    CHAPTER 6 ■ COL LIS IO NS 147 Figure 6-5. A typical screen shot for the Linear Collision Simulator The spheres are modeled such that they are not subject to gravity or any other force. In addition to fields representing the GUI components, the SphereCollision class declares fields that represent the location, velocity, and mass of the spheres and the coefficient read more..

  • Page - 167

    148 CH APTER 6 ■ C O LLISIONS When the Start button is pressed, the actionPerformed method declared in the SphereCollision class is called. The values in the text fields are used to update the velocity, mass, and coefficient of restitution values. As with the other programs presented in this book, the SphereCollision class uses a Timer object to control the read more..

  • Page - 168

    CHAPTER 6 ■ COL LIS IO NS 149 if ( distance <= 2.0*sphereRadius ) { double newVx1 = (mass1 - e*mass2)*vx1*tmp + (1.0 + e)*mass2*vx2*tmp; double newVx2 = (1.0 + e)*mass1*vx1*tmp + (mass2 - e*mass1)*vx2*tmp; read more..

  • Page - 169

    150 CH APTER 6 ■ C O LLISIONS and concepts developed in the previous section can be applied to a general two-body collision. In this section, the equations will be developed to model two-dimensional collisions. • The collision will affect the velocity components along (that is, parallel to) the line of action of the collision. • Velocity components perpendicular read more..

  • Page - 170

    CHAPTER 6 ■ COL LIS IO NS 151 Figure 6-7. Rotating a coordinate system by an angle If you recall from Chapter 1, to determine the velocity components in the rotated (line-of- action-aligned) coordinate system, the original velocity components vx and vy are multiplied by the rotation matrix shown in Equation (6.17). The velocity vn is the velocity component read more..

  • Page - 171

    152 CH APTER 6 ■ C O LLISIONS The accent marks, as in v ′ x, in Equations (6.19) and (6.20), indicate the post-collision velocities. The velocity normal to the line of action, vn, is not the post-collision value because that velocity component doesn’t change due to the collision. You might be asking yourself why you need to bother with rotating the coordinate read more..

  • Page - 172

    CHAPTER 6 ■ COL LIS IO NS 153 Step 3 in the process is to compute the post-collision velocities for the two spheres according to Equation (6.14). The final step in the process is to rotate the post-collision velocities back to the standard Cartesian coordinate system using Equation (6.20) to obtain the post-collision x- and y- components of velocity. read more..

  • Page - 173

    154 CH APTER 6 ■ C O LLISIONS Figure 6-9. A typical Paddle Game screen shot Implementing the collision model for the Paddle Game is quite simple. Because the paddle face and game walls are horizontal or vertical surfaces, the line-of-action vector for the collisions will always be parallel to the horizontal or vertical axis. For the purposes of the collision read more..

  • Page - 174

    CHAPTER 6 ■ COL LIS IO NS 155 As with the games in the earlier chapters of this book, when the Start button is pressed, the actionPerformed method declared in the PaddleGame class is called. The method is quite simple. The horizontal and vertical components of the ball velocity are set according to the values inside the text fields. The GUI display is read more..

  • Page - 175

    156 CH APTER 6 ■ C O LLISIONS // Determine if ball collides with the top wall. // If it does, change the z-velocity of the ball. if ( ballVz > 0.0 && ballZ + ballRadius >= height ) { ballVz = -ballVz; } // Determine if ball collides with the bottom wall. read more..

  • Page - 176

    CHAPTER 6 ■ COL LIS IO NS 157 The Paddle Game as it is presented here models the collision between the paddle and the ball as if the ball hits the flat face. If you wanted to get more sophisticated, you could account for the possibility that the ball would collide with the corner of the paddle. In this case, the line of action for the collision read more..

  • Page - 177

    158 CH APTER 6 ■ C O LLISIONS Figure 6-10. Collision between spheres is a function of the distance between their centers. The collision determination is simple if the class that represents the sphere declares fields that store the location of the center of the sphere. In terms of computer code, the conditional statement to evaluate is the following: if ( d read more..

  • Page - 178

    CHAPTER 6 ■ COL LIS IO NS 159 equal to the distance from the center of the parallelogram to the corresponding face, then a collision has occurred. Because determining whether a collision has occurred with a complicated, asymmetric shaped object is difficult, for the purposes of collision modeling you might want to model the objects in your simulations as simple read more..

  • Page - 179

    160 CH APTER 6 ■ C O LLISIONS Combining Equations (6.5) and (6.6) results in an equation relating an angular impulse to a resulting change in angular momentum. Equation (6.30) states that in the absence of a net applied torque, angular momentum of an object, or of a system of objects, is constant. This concept is known as the conservation of angular momentum. read more..

  • Page - 180

    CHAPTER 6 ■ COL LIS IO NS 161 Figure 6-13. Velocity doesn’t line up with line of action for oblique impacts. When two objects collide obliquely, they will slide against each other for a brief period of time. In Chapter 3, you learned that when objects slide against each other, a frictional force is generated between the contacting surfaces, which resists the read more..

  • Page - 181

    162 CH APTER 6 ■ C O LLISIONS The frictional impulse acts in the direction normal to the line of action and will change the velocity components, vn, normal to the line of action. In Equation (6.33), vn0 is the pre-collision normal to the line of action, and vn1 is the normal velocity after the frictional impulse has been applied. In the first part of the read more..

  • Page - 182

    CHAPTER 6 ■ COL LIS IO NS 163 Figure 6-15. A frictional impulse causes a rotation. It is assumed that the object is not rotating when it collides with the ramp, so the initial angular velocity, w0, is equal to zero. The angular impulse, frictional impulse, and final angular velocity, w1, are related by Equation (6.30). The quantity, r, is the distance from the read more..

  • Page - 183

    164 CH APTER 6 ■ C O LLISIONS Let’s apply Equations (6.37) and (6.38) to the specific case of a sphere. The moment of inertia for a sphere is given by Equation (6.39). When the moment of inertia for a sphere is inserted into Equations (6.37) and (6.38), the result is two simple equations that determine the angular velocity and velocity normal to the line read more..

  • Page - 184

    CHAPTER 6 ■ COL LIS IO NS 165 Summary In this chapter, you learned the basics of the physics of colliding bodies. Starting with the concepts of linear momentum and impulse of force, equations were developed that compute the post-collision velocities from a linear collision. You learned about how a coefficient of resti- tution is used to characterize the efficiency read more..

  • Page - 185

    166 CH APTER 6 ■ C O LLISIONS 2. The time it will take for the object to reach the ground can be found from Equation (5.8c). The velocity when the object strikes the ground is equal to the product of the gravita- tional acceleration and the time. Because the object is striking the ground vertically, its rebound velocity is equal to the impact velocity read more..

  • Page - 186

    167 ■ ■ ■ CHAPTER 7 Sports Simulations The first six chapters of the book have been pretty generic. You have learned the basics of Newtonian mechanics, kinematics, projectile motion, and collisions. Now it’s time to take what you’ve learned and apply it to specific problems. In this chapter, we will explore the physics of sports simulations. You will learn how to read more..

  • Page - 187

    168 CH APTER 7 ■ SP O R TS SI M U L A T I O N S The good news is that we have already learned the basic concepts we need to know to create a golf simulation in Chapters 5 and 6. A golf ball in flight is simply a projectile that is subject to the forces of gravity, aerodynamic drag, wind, and spin. In order to create a golf simulation, read more..

  • Page - 188

    CHAPTER 7 ■ SPORTS SIMULATIO NS 169 reducing the aerodynamic drag of the golf ball in flight. There are several commonly used dimple patterns for golf balls, and typically there are 350–500 dimples on the surface of a golf ball. The coefficient of drag of a golf ball is a function of Reynolds number and how fast the ball is spinning. For a Reynolds read more..

  • Page - 189

    170 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Just as there are a lot of different golf balls on the market today, so are there a lot of different golf clubs. The club head mass and loft angle for a given club can vary from manufacturer to manufacturer, but some typical values of these quantities are shown in Table 7-2.1 The length of read more..

  • Page - 190

    CHAPTER 7 ■ SPORTS SIMULATIO NS 171 When modeling the impact between the club face and ball, we will make some simplifying assumptions: • Any effects due to the club shaft or the golfer holding the club will be ignored. The club head will treated as if it is moving through the air by itself. • At the point of impact, the club head will be traveling read more..

  • Page - 191

    172 CH APTER 7 ■ SP O R TS SI M U L A T I O N S For the “ideal” impact shown in Figure 7-4, the line of action of the collision is along a vector whose angle is equal to the loft of the club, α. The club head velocity along the line of action, vcp, is normal to the club head face and is therefore equal to the velocity in the x-direction read more..

  • Page - 192

    CHAPTER 7 ■ SPORTS SIMULATIO NS 173 Figure 7-5. Friction between the ball and club face causes the ball to spin. When analyzing the friction effects on a golf ball, there are two questions to answer: what is the resulting velocity of the golf ball parallel to the club face, and what is the spin rate that is imparted to the golf ball? Both questions can be read more..

  • Page - 193

    174 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Combining Equations (7.6) and (7.7) results in an expression for the post-collision velocity of the golf ball normal to the line of action of the collision. As before, the result is independent of the coefficient of friction between the ball and club face. One thing to keep in mind about the read more..

  • Page - 194

    CHAPTER 7 ■ SPORTS SIMULATIO NS 175 The angles in Equations (7.13) and (7.14) have been converted from degrees to radians. The post-collision velocity of the golf ball along the line of action can be obtained from Equation (7.3). The post-collision velocity normal to the line of action and the spin rate can be found using Equations (7.4) and (7.8). read more..

  • Page - 195

    176 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Modeling the Golf Ball in Flight The impact with the golf club determines the initial velocity (both angular and translational) of the golf ball. Once the ball is in flight, it behaves like a projectile. The force diagram for the golf ball is shown in Figure 7-6. It will experience acceleration read more..

  • Page - 196

    CHAPTER 7 ■ SPORTS SIMULATIO NS 177 The ratio in Equation (7.22) is also known as the rotational spin ratio. According to Bernoulli’s equation, the Magnus force lift coefficient is equal to the rotational spin ratio. But how good is this approximation? The results from Equation (7.22) can be compared against experimental measurements of the lifting force exerted read more..

  • Page - 197

    178 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Let’s use Equations (7.21) and (7.23) to compute the Magnus force and acceleration on the golf ball analyzed in the “A Sample Collision Analysis” section. The golf ball had post-collision x- and z-components of velocity equal to 70.6 and 10.4 m/s. The post-collision angular velocity of the ball read more..

  • Page - 198

    CHAPTER 7 ■ SPORTS SIMULATIO NS 179 Figure 7-8. Golf simulator screen shot Let’s start the discussion with the GolfBall class. The only reason to even write a GolfBall class is to use Equation (7.23) to compute the lift coefficient for the Magnus force term. Every- thing else about the class will be the same as in the SpinProjectile class. The GolfBall read more..

  • Page - 199

    180 CH APTER 7 ■ SP O R TS SI M U L A T I O N S The GolfBall class declares its own version of the getRightHandSide method. The only significant difference between this method and the one declared in the SpinProjectile class is that the lift coefficient is computed according to Equation (7.23). // The getRightHandSide() method returns read more..

  • Page - 200

    CHAPTER 7 ■ SPORTS SIMULATIO NS 181 // Compute the total drag force and the dirctional // drag components. double Fd = 0.5*getDensity()*getArea()*getCd()*va*va; double Fdx = -Fd*vax/va; double Fdy = -Fd*vay/va; double Fdz = -Fd*vaz/va; // Compute the velocity magnitude. double v = Math.sqrt(vx*vx + read more..

  • Page - 201

    182 CH APTER 7 ■ SP O R TS SI M U L A T I O N S // Get some initial quantities from the text fields. double velocity = Double.parseDouble(velocityTextField.getText()); double density = Double.parseDouble(densityTextField.getText()); distanceToHole = Double.parseDouble(distanceTextField.getText()); double windVx = read more..

  • Page - 202

    CHAPTER 7 ■ SPORTS SIMULATIO NS 183 // Convert the loft angle from degrees to radians and // assign values to some convenience variables. loft = loft*Math.PI/180.0; double cosL = Math.cos(loft); double sinL = Math.sin(loft); // Calculate the pre-collision velocities normal // and parallel to the line read more..

  • Page - 203

    184 CH APTER 7 ■ SP O R TS SI M U L A T I O N S When you play the Golf Game, select different clubs and impact velocities and see what happens. Keep in mind that because the clubs are different lengths that a realistic impact velocity will be different for different clubs. A professional golfer might be able to swing a driver such that the read more..

  • Page - 204

    CHAPTER 7 ■ SPORTS SIMULATIO NS 185 The Impact Phase The impact of the putter and golf ball can be modeled in exactly the same way as the impact of the ball and any other club. For the time being, we will assume that the green is horizontal and at the point of impact the head of the putter is in the x-direction. The line of action for the colli- read more..

  • Page - 205

    186 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Figure 7-10. The forces and velocities at the beginning of the skid phase We want to determine the time it takes until the golf ball is rolling without skidding and the distance it travels during that time. To determine these results, a process similar to the one discussed in the “Collisions with read more..

  • Page - 206

    CHAPTER 7 ■ SPORTS SIMULATIO NS 187 In looking at Equation (7.37), we see that the distance traveled during the skid phase does depend on the coefficient of friction between the ball and putting green. The coefficient of sliding friction between the ball and green will typically range from 0.4 to 0.5.3 The Rolling Phase After the skid is complete, we can assume read more..

  • Page - 207

    188 CH APTER 7 ■ SP O R TS SI M U L A T I O N S The coefficient of rolling friction, mr, depends on the height of the grass, the type of grass, and the relative dampness of the green. Typically, the value of mr might range from 0.05 to 0.075.4 A dry, tightly mowed green is considered “hard” and would have a lower coefficient of rolling read more..

  • Page - 208

    CHAPTER 7 ■ SPORTS SIMULATIO NS 189 The distance the ball will travel during its skid can be determined from Equation (7.37). The ball is now rolling, and the distance the ball will travel when it is rolling can be computed from Equation (7.40). We’ll assume a medium-hard green with a coefficient of rolling friction of 0.065. The final distance the putt read more..

  • Page - 209

    190 CH APTER 7 ■ SP O R TS SI M U L A T I O N S sport of soccer quickly spread outside Great Britain to Europe, South America, and eventually all over world. While there are a lot of other aspects to the game of soccer, such as headers, throw ins, and the like, in this chapter we will focus on the physics of a kicked soccer ball and how read more..

  • Page - 210

    CHAPTER 7 ■ SPORTS SIMULATIO NS 191 Modeling the Impact of Ball and Foot The initial phase of the flight of a soccer ball is conceptually similar to the flight of a golf ball. In soccer, there is an initial impact of the player’s foot with the ball, creating a force impulse along the line of action of the collision. The ball will also be given a spin read more..

  • Page - 211

    192 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Figure 7-13. Drag coefficient of a nonspinning soccer ball The question now becomes which drag coefficient should be used—the laminar one or the turbulent one? The answer is maybe one, maybe the other depending on the velocity of the soccer ball. As we saw in Chapter 5, the Reynolds number is the read more..

  • Page - 212

    CHAPTER 7 ■ SPORTS SIMULATIO NS 193 In comparing the values shown in Table 7-3 with the drag coefficient data shown in Figure 7-11, it is clear that at ball velocities of greater than 9.0 m/s the flow around the ball will be fully turbulent, and the lower drag coefficient value of approximately 0.22 can be applied. At velocities between 9.0 and read more..

  • Page - 213

    194 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Figure 7-14. A linear approximation to soccer drag coefficient data Magnus Force Just as it is with golf balls, the force due to spinning, or Magnus force, is very important in modeling the flight of a soccer ball. Players use spin to bend the ball around defenders on penalty or corner kicks. For read more..

  • Page - 214

    CHAPTER 7 ■ SPORTS SIMULATIO NS 195 Figure 7-15. Experimental and computed soccer ball lift coefficients Free-Kick Game Let’s use what we know about the flight of a soccer ball to create a “free kick” game. You have been given a free kick at a spot 20 m for your opponent’s goal. Five defenders (represented by black dots) will attempt to block your read more..

  • Page - 215

    196 CH APTER 7 ■ SP O R TS SI M U L A T I O N S As was the case with the golf simulator we developed earlier in this chapter, the Free-Kick Game requires two classes—the SoccerBall class that represents a soccer ball and a FreeKick class that defines the GUI. We’ll start by looking at the SoccerBall class. Like the GolfBall class, the read more..

  • Page - 216

    CHAPTER 7 ■ SPORTS SIMULATIO NS 197 // First part of the method code listing not shown … // Compute the drag coefficient, which depends on // the Reynolds number. double viscosity = 1.458e-6*Math.pow(temperature,1.5)/ (temperature + 110.4); double Re = read more..

  • Page - 217

    198 CH APTER 7 ■ SP O R TS SI M U L A T I O N S The GUI class for the Free-Kick Game is named FreeKick and is very similar to the GUI for the Golf Game presented earlier in the chapter. When the Fire button is pressed, the actionPerformed method declared in the FreeKick class is called. The first thing the method does is to extract input read more..

  • Page - 218

    CHAPTER 7 ■ SPORTS SIMULATIO NS 199 // Create a SoccerBall object representing the soccer ball. soccerBall = new SoccerBall(x0, y0, z0, vx0, vy0, vz0, 0.0, ballMass, area, density, cd, windVx, windVy, rx, ry, rz, omega, radius, temperature); // Update the display. updateDisplay(); read more..

  • Page - 219

    200 CH APTER 7 ■ SP O R TS SI M U L A T I O N S men’s basketballs. The regulation ball for women is slightly smaller and lighter. The exact spec- ifications for women’s balls can be found at the WNBA, FIBA, and NCAA websites. Figure 7-17. An NBA regulation basketball The Court Basketball is played on a rectangular area known as the court. In read more..

  • Page - 220

    CHAPTER 7 ■ SPORTS SIMULATIO NS 201 The Basket and Backboard The objective in basketball is to shoot or dunk the ball through a basket that consists of a metal ring, also known as the hoop, and a net that is suspended below the hoop. The basic schematic of the basket and backboard is shown in Figure 7-19. The basket is attached to a backboard that read more..

  • Page - 221

    202 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Modeling the Jump Shot The jump shot is the most common shot in basketball. The shooter jumps in the air and the ball is released above the shooter’s head towards the basket. In this section, we develop a model to simulate the flight of a jump shot. Creating a basketball simulation is similar read more..

  • Page - 222

    CHAPTER 7 ■ SPORTS SIMULATIO NS 203 hoop and background. The spin reduces the rebound angle and makes it more likely that the ball will bounce into the basket. Determining If a Shot Is Good One element that is important to a basketball simulation is a way to determine whether a shot is good. One way to accomplish this objective is by the knowledge that if read more..

  • Page - 223

    204 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Figure 7-21. A screen shot of the Free-Throw Game The hoop is assumed to have a radius of 0.23 m and the ball a radius of 0.12 m. For a shot to be good, the center of the ball must travel to within 0.14 m of the center of hoop. This value represents the difference in radius read more..

  • Page - 224

    CHAPTER 7 ■ SPORTS SIMULATIO NS 205 Figure 7-22. An official MLB baseball The mass and dimensions of an official baseball, as defined by Major League Baseball (MLB), are shown in Table 7-8. As was the case with soccer, there is some range of possible mass and dimension values. The coefficient of restitution for a baseball is somewhat dependent on the velocity read more..

  • Page - 225

    206 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Modeling the Pitch In the movie Bull Durham, Kevin Costner summed up the game of baseball: “You throw the ball, you hit the ball, you catch the ball.” One of the key elements of the game is that the pitcher, who stands 18.44 m (60 ft 6 in) from home plate, has to throw the baseball read more..

  • Page - 226

    CHAPTER 7 ■ SPORTS SIMULATIO NS 207 The curveball shown in Figure 7-24 will break downwards and to the right. The spin on the fast- ball will tend to loft the flight of the pitch. It will show less break than any of the other types of pitches. To evaluate the Magnus force on a fastball according to Equation (7.55), we must deter- mine the lift read more..

  • Page - 227

    208 CH APTER 7 ■ SP O R TS SI M U L A T I O N S Figure 7-25. A schematic of the collision of a baseball and bat Simulating Other Sports The list of sports is endless, and there is not room in this chapter to cover the modeling aspects of all of them. The good news is that many of the concepts covered in this chapter are appli- cable to many read more..

  • Page - 228

    CHAPTER 7 ■ SPORTS SIMULATIO NS 209 Hockey One of the unique aspects about hockey is that it is played on ice. The puck used in hockey is not round, but instead is a hard rubber cylindrical disk. Most of the time the puck will either be sliding over the ice or flying through the air. To model the sliding puck requires accounting for the friction between read more..

  • Page - 229

    210 CH APTER 7 ■ SP O R TS SI M U L A T I O N S 3. A. Weber, “Green Speed Physics,” USGA Green Section Record, March/April 1997, http://turf.lib.msu.edu/1990s/1997/970312.pdf. 4. K. Tanner, Probable Golf Instruction, www.probablegolfinstruction.com. 5. University of Sheffield Sports Engineering Research Group, www.shef.ac.uk/mecheng/sports. 6. G. Sawicki, Hubbard, M., and read more..

  • Page - 230

    211 ■ ■ ■ CHAPTER 8 Cars and Motorcycles Car racing games are a lot of fun. You can drive high-powered vehicles that you couldn’t possibly afford in real life, and you can drive them into trees. Between the speed, the power, and the spectacular fiery crashes, you can create a lot of exciting game scenarios using cars, motorcycles, and other motorized vehicles. read more..

  • Page - 231

    212 CH APTER 8 ■ C ARS AND MOTORCYCLE S Cars You can create a lot of exciting game simulations involving cars, whether it’s car races, car chases, or just simulating the life of a taxi driver. Putting realistic physics into a car simulation really just involves applying some basic concepts from Newtonian mechanics and kinematics with a little knowledge about read more..

  • Page - 232

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 213 Figure 8-1. Force balance on a car driving in a straight line on a horizontal surface As you can see from Figure 8-1, there are quite a few forces acting on the car, so let’s go over them one by one. The force of gravity pulls the car towards the earth. It acts both normal to the slope with a read more..

  • Page - 233

    214 CH APTER 8 ■ C ARS AND MOTORCYCLE S As was the case with projectiles, aerodynamic drag acts in the opposite direction to the velocity of the vehicle. We’ll discuss aerodynamic drag in more detail a little later in this chapter. The final force in the basic force diagram is due to rolling friction, which was introduced in Chapter 7. This force acts on read more..

  • Page - 234

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 215 Figure 8-2. A typical torque curve The 2004 Porsche Boxster S To help you understand how to apply the equations presented in this chapter, we will use as a test case the 2004 Porsche Boxster S sports car, a picture of which is shown in Figure 8-3. The Boxster S was chosen because it is a fast, read more..

  • Page - 235

    216 CH APTER 8 ■ C ARS AND MOTORCYCLE S The torque curve for a 2004 Porsche Boxster S is the one shown in Figure 8-2 and is based on data obtained from the Porsche website at www.porsche.com. The peak engine torque value of 309.2 N-m occurs when the engine is turning over at 4600 rpm. The torque curve will be used a little later on to develop a read more..

  • Page - 236

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 217 Gears and Wheel Torque The torque applied to the wheels of a car determines its acceleration. In general, the torque applied to the wheels is not the same as the engine torque because before the engine torque is applied to the wheels it passes through a transmission. A typical transmission cross-section is shown read more..

  • Page - 237

    218 CH APTER 8 ■ C ARS AND MOTORCYCLE S So what the transmission does is to (generally) increase the torque that comes out of the engine at the cost of reducing the gear turnover rate. To determine the acceleration of the car, we need the torque applied to the wheels. The wheel torque, Tw, is equal to the engine torque, Te, multiplied by the gear read more..

  • Page - 238

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 219 Determining Wheel Radius The acceleration and velocity expressions shown in Equations (8.11) and (8.13) are functions of the wheel radius, but how can this quantity be determined? Fortunately, the wheel radius can be calculated from information on the tire itself. Every tire will have a series of letters and numbers read more..

  • Page - 239

    220 CH APTER 8 ■ C ARS AND MOTORCYCLE S Keep in mind that the values in Table 8-2 are theoretical maximum velocities. The Boxster S can’t really reach 299.3 km/hr in sixth gear. According to the manufacturer’s specifications, the top speed of the car is “only” 266 km/hr. The reason the car can’t reach the theoretical maximum velocity in sixth gear read more..

  • Page - 240

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 221 Drag Coefficients for Motor Vehicles The drag coefficient for a car or other motor vehicle will depend on the shape of the vehicle. A sports car will have a lower drag coefficient than will a garbage truck. Typical drag coefficient ranges for several vehicle types1 are shown in Table 8-3. While there may read more..

  • Page - 241

    222 CH APTER 8 ■ C ARS AND MOTORCYCLE S The value of the coefficient of rolling friction tends to be significantly lower than the coef- ficients of static or kinetic friction for the same object. For car tires, the coefficient of rolling friction ranges from 0.01 to 0.02.2 Computing Acceleration and Velocity In order to create a car simulation, it is read more..

  • Page - 242

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 223 Using the simplified torque curve, the torque for the Boxster S can be modeled by three equations. The units for engine torque in all three equations are in N-m. All three of the lines described by Equations (8.17a) through (8.17c) are specific cases of the general equation for a straight line. The b parameter read more..

  • Page - 243

    224 CH APTER 8 ■ C ARS AND MOTORCYCLE S In looking at Equation (8.20), we can observe what parameters influence the acceleration value of the car. Some conclusions are pretty obvious—the heavier the car, the lower the accel- eration. If the gear and final drive ratios are increased, the acceleration is increased. Reducing the rolling friction of the wheels read more..

  • Page - 244

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 225 The maximum velocity can be found using the standard equation for finding the roots of a quadratic equation. Let’s use Equation (8.25) to compute the maximum velocity of the Porsche Boxster S when the car is in sixth gear. The drag coefficient of the car is 0.31, the empty mass is 1323 kg, and the radius read more..

  • Page - 245

    226 CH APTER 8 ■ C ARS AND MOTORCYCLE S The force of rolling friction can be computed from Equation (8.4). In comparing the results from Equations (8.28) and (8.29), the aerodynamic drag force is 10 times as large as the rolling friction force when the car is traveling at 271.5 km/hr. The rolling friction force is not a function of velocity. If the read more..

  • Page - 246

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 227 A Car Simulator Let’s take what we’ve learned about modeling the physics of cars and develop a car simulator. The GUI display for the car simulator is shown in Figure 8-8. At the top of the simulator is a display area that shows a picture of the car. Above the car are two rectangular markers. When the read more..

  • Page - 247

    228 CH APTER 8 ■ C ARS AND MOTORCYCLE S Figure 8-9. If the rpm exceeds 8000, you’ve blown the engine. The GUI for this car simulation is pretty primitive, but the physics inside it are real and are based on the equations developed in this chapter. The effects of aerodynamic drag and rolling friction are included in the model. Some simplifications were made, read more..

  • Page - 248

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 229 velocity, or braking. The omegaE field is the engine turnover rate in rpm. The names of the other Car class fields are self-explanatory. The Car constructor is used to initialize the fields in the Car, DragProjectile, SimpleProjectile, and ODE classes. The first thing the constructor does is to call the read more..

  • Page - 249

    230 CH APTER 8 ■ C ARS AND MOTORCYCLE S After the constructor, the Car class declares a series of get/set methods to access or change the value of the fields declared in the class. Only some of the get/set methods are shown here. Download the complete code listing from the Apress website to see all of the get/set methods. // These methods read more..

  • Page - 250

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 231 Since the ODE solver will be used to update the position and velocity of the car, the Car class has to declare a getRightHandSide method to define the right-hand sides of the equations to be solved. The first part of the getRightHandSide method is similar to that found in many of the classes we’ve read more..

  • Page - 251

    232 CH APTER 8 ■ C ARS AND MOTORCYCLE S // Compute velocity magnitude. double vx = newQ[0]; double vy = newQ[2]; double vz = newQ[4]; double v = Math.sqrt(vx*vx + vy*vy + vz*vz) + 1.0e-8; // Compute the total drag force. double Fd = 0.5*getDensity()*getArea()*getCd()*v*v; // Compute the read more..

  • Page - 252

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 233 dQ[1] = ds*newQ[0]; dQ[2] = 0.0; dQ[3] = 0.0; dQ[4] = 0.0; dQ[5] = 0.0; return dQ; } } The Car class represents a generic car and declares the fields and methods common to all cars. Classes for specific car types can be written as subclasses of the read more..

  • Page - 253

    234 CH APTER 8 ■ C ARS AND MOTORCYCLE S Now that the Car and BoxsterS classes are defined, they can be incorporated into the Car Simulator GUI. The class that implements the GUI is named CarSimulator. As with the other GUIs in this book, we will not go over every detail of the CarSimulator class, but you are encour- aged to download the source code read more..

  • Page - 254

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 235 The new rpm value of the engine is computed using Equation (8.13). If the value exceeds the redline value for the car, a warning message is displayed. If the rpm value exceeds 8000, the engine is blown and the simulation stops. // Compute the new engine rpm value. double rpm = read more..

  • Page - 255

    236 CH APTER 8 ■ C ARS AND MOTORCYCLE S the car is. Then select the “brake” mode and watch the car slow down. If you want to play with shifting gears up and down, you can set the mode to “cruise”, which will hold the velocity constant. If for some reason the entire GUI is not rendered, press the Reset button to redraw the GUI. Keep in mind that read more..

  • Page - 256

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 237 Next we compute the maximum frictional force from Equation (8.32). If the engine torque force is less than the maximum frictional force, the engine torque force is used in the equations of motion. If the engine torque force is greater than the maximum frictional force, then the wheels are sliding, and the read more..

  • Page - 257

    238 CH APTER 8 ■ C ARS AND MOTORCYCLE S The center of the circle that the car is traveling on is located at the intersection of lines drawn perpendicular to the front and rear right wheels. The radius of the circle can be found from trigonometric relations. The distance from the centers of the front and back wheels, l, is known as the wheelbase. The read more..

  • Page - 258

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 239 about the center of mass of the car, causing the entire vehicle to rotate. You have probably seen this effect in watching a car take a high-speed turn where the back end of the car slides outward or “fishtails.” The simplest way to model high-speed turns is to compute the lateral force, Flateral, on the read more..

  • Page - 259

    240 CH APTER 8 ■ C ARS AND MOTORCYCLE S is equal to zero. In this case, the car and the object it collided with would stick together, and they would have the same post-collision velocity shown in Equation (8.43). In most cases, the collision won’t be completely inelastic, and the coefficient of restitution will have some nonzero value. The car will suffer a read more..

  • Page - 260

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 241 Turning a Motorcycle Turning a car is pretty straightforward. The wheels are turned in the direction of the turn. If you try to turn in this manner on a motorcycle, except at very low speeds, you will crash the bike. The reason is an effect called gyroscopic precession. When the wheel of the bike is turned read more..

  • Page - 261

    242 CH APTER 8 ■ C ARS AND MOTORCYCLE S countersteering is probably more as a visual effect than anything else. When the motorcycle riders in your games make a turn, have the motorcycle lean into the turn. Adding Sophisticated Effects to the Car or Motorcycle Models This chapter has covered the basics of modeling the motion of cars and motorcycles. As you read more..

  • Page - 262

    CH APTER 8 ■ CA RS AND M O TO RC YCLES 243 References 1. B. Bowling, “Air Drag Coefficients and Frontal Area Calculation,” www.bgsoflex.com/ airdragchart.html. 2. C.E. Mungan, “Rolling Friction of a Free Wheel,” http://usna.edu/Users/physics/mungan/ Scholarship/RollingFriction.pdf. 3. R. van Gaal, “Car Physics Basics,” www.racer.nl/reference/carphys.htm#enginebraking. read more..

  • Page - 263

    245 ■ ■ ■ CHAPTER 9 Boats and Things That Float So far in this book we’ve focused on land-based activities. It’s time to hit the water. In this chapter, we will explore the basic physics behind boats and things that float. As with the chapters on sports and car simulations, we’ll start armed with an understanding of Newtonian mechanics and kinematics. The read more..

  • Page - 264

    246 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT There are specialized terms for just about every piece of the boat geometry. Some of the more commonly used terms are shown in Figure 9-1. The arrow in Figure 9-1 indicates the direction of forward travel for the boat. Figure 9-1. Boat geometry terminology Here are definitions for the terms shown in Figure 9-1 read more..

  • Page - 265

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 247 traveling and plows its way through the water. The cross-section of a displacement hull has a relatively constant U shape from bow to stern. Displacement hulls are used in long-distance powerboats such as cruise liners and trawlers. They are the most fuel-efficient type of hull, but they also experience the read more..

  • Page - 266

    248 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT There are four forces that we will consider to act upon the boat. You are already well acquainted with the force due to gravity. It pulls the boat downward. In order for the boat to float on the water, another force must be there to counteract the force of gravity. This force is referred to as the read more..

  • Page - 267

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 249 The buoyancy force acts through the geometrical center of an object, which is not always the same as the center of mass of an object. If the geometrical center and center of mass are in different locations, the buoyancy force and gravitational force will create a torque that will cause the object to read more..

  • Page - 268

    250 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT Exercise 1. A canoe has a volume of 0.5 m3 and has a mass of 30 kg. What is the total mass of passengers and cargo that can be loaded into the canoe before it will sink? Buoyancy and Density Another way to think of buoyancy and whether a boat or other object will float is in terms of density. read more..

  • Page - 269

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 251 Figure 9-5. Drive system types Because the weight of the engine is moved forward and because the propeller thrust is directed upward with the direct drive system, a direct drive boat will have a lower planing angle at high speed and will experience more hull drag. The most commonly used type of drive read more..

  • Page - 270

    252 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT the boat forwards or backwards. Let’s take a little time now to understand how a boat propeller works. When the propeller rotates, as shown in Figure 9-6, the underside of each propeller blade pushes the water next to it down and back, similar to the hand motion of a swimmer doing the backstroke. Because read more..

  • Page - 271

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 253 The ratio of the wake velocity to the boat velocity is called the wake fraction, wf. The boat velocity and speed of advance of the propeller can be related using the wake fraction. In looking at Equation (9.6), we see it doesn’t really provide the velocity of the boat because the wake velocity at a read more..

  • Page - 272

    254 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT resistance is known at a certain velocity, the effective power required can be computed. If the coefficient of propulsive efficiency is known, it can be compared against the maximum power output of the engine to determine whether the engine can provide this level of power. When the propeller rotates through read more..

  • Page - 273

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 255 Skin Friction Drag Skin friction drag is caused by the contact between the water and the hull as the hull slides through the water. The water clings to the hull and resists the hull motion. Skin friction drag is the dominant hydrodynamic drag component at lower boat velocities and is still significant at read more..

  • Page - 274

    256 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT Form Drag Form drag on boat hulls is similar to form drag on projectiles. As the hull pushes its way through the water, the pressure on the front of the hull is greater than the pressure on the back of the hull. The pressure difference sets up a drag force that acts in the opposite direction to the read more..

  • Page - 275

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 257 The highest wave velocity will occur when the length of the wave is equal to the waterline length of the boat. It turns out that wave drag is a limiting factor in the maximum speed of a boat with a displacement hull. The reason is that for the boat to travel faster than the wave it is read more..

  • Page - 276

    258 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT Aerodynamic Drag So far we have been discussing how to model the hydrodynamic drag forces experienced by a boat. Part of a boat will be above water and will be subject to the forces of aerodynamic drag. Generally speaking, aerodynamic forces for boats traveling at low to moderate speeds don’t contribute read more..

  • Page - 277

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 259 The drawback to this approach is that it really only replicates the performance of the boat for the conditions on the day it was tested. But given the complexities and uncertainties in trying to develop a general analytical model for the performance of a boat, using the perfor- mance data to develop an read more..

  • Page - 278

    260 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT where A plot of the acceleration as a function of velocity curve predicted by Equation (9.26) is shown in Figure 9-8. Also shown on the plot are the performance test measurement data points that were used to determine the curve fit equation. Above the maximum velocity of 46.1 m/s, read more..

  • Page - 279

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 261 data and the approximation shown in Figure 9-8 represents the maximum, full-throttle accel- eration of the boat. If the engines weren’t at full throttle, the acceleration experienced at a given boat velocity would be less. Speedboat Simulator Let’s use the estimated acceleration profile for the Fountain Lightning read more..

  • Page - 280

    262 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT class can therefore be written as a subclass of the SimpleProjectile class. The Powerboat class declares two fields: one named mode that determines whether the boat is accelerating, cruising at constant speed, or slowing down; and the other named planingSpeed that stores the speed at which the powerboat begins read more..

  • Page - 281

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 263 // This method updates the velocity and location // of the boat using a 4th order Runge-Kutta // solver to integrate the equations of motion. public void updateLocationAndVelocity(double dt) { ODESolver.rungeKutta4(this, dt); } Because the Powerboat class is a subclass of read more..

  • Page - 282

    264 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT public class FountainLightning extends Powerboat { // The FountainLightning constructor calls the // SimpleProjectile constructor and initializes // the value of the mode variable. public FountainLightning(double x, double y, double z, double read more..

  • Page - 283

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 265 // Otherwise, evaluate the acceleration according // to the curve fit equation. else { ax = -4.44e-7*Math.pow(v,4.0) + 2.56e-4*Math.pow(v,3.0) - 0.0216*v*v + 0.527*v - 1.51; } } If the mode is read more..

  • Page - 284

    266 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT We will highlight one feature of the BoatSimulator class. The planing speed for the Fountain 35' Lightning speedboat is 8.44 m/s (30.4 km/hr). When the boat reaches this speed, the planing action of the hull begins and the hull tilts upward. While the physical details of the planing process are not modeled read more..

  • Page - 285

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 267 made to simulate variable-throttle acceleration. One of the problems with the performance test data was that it only included acceleration data. There was no information on how fast the boat will slow down if the engines are throttled back. The deceleration of the boat could be simulated by modeling the read more..

  • Page - 286

    268 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT Jet Skis Jet skis, or more generally personal watercraft (PWC), are small, highly maneuverable water- craft that offer a lot of possibilities for game simulations. Although different manufacturers refer to them by different names, in this section we will use the term “jet ski.” As shown in Figure 9-11, jet read more..

  • Page - 287

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 269 Thrust and Drag The basic relations between thrust and drag are the same for a jet ski as they are for a planing speedboat. The engine generates thrust that propels the jet ski forward. Various aerodynamic and hydrodynamic drag forces including skin friction, wave drag, form drag, and aerodynamic drag resist read more..

  • Page - 288

    270 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT Figure 9-12. A schematic of a typical sailboat The right-hand side of Figure 9-12 shows a sideways force diagram on the sailboat where the wind is coming from the left. The force due to the wind on the sail pushes the boat to the right. The keel resists this movement, and a force is exerted on the keel, read more..

  • Page - 289

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 271 Figure 9-13. A surfboard is really just a boat. (Photo courtesy of Kevin Schmidtchen) Buoyancy and Balance Consider a surfer standing on a surfboard as shown in Figure 9-14. The surfer’s weight acts through the center of mass of the surfer and presses down on the board. The buoyancy force resists the read more..

  • Page - 290

    272 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT The Physics of a Wave Most ocean waves are caused by wind, although a ship traveling through the water can also cause waves. A wave caused by a storm in the middle of the Pacific or Atlantic oceans can travel hundreds or even thousands of miles before hitting the shore. The velocity of a wave when it read more..

  • Page - 291

    CHA PTER 9 ■ BOATS A N D THINGS TH AT FL OAT 273 its right side (known as the right rail), and the board will curve to the right. As a general rule, the longer and heavier the surfboard, the slower and harder it is to turn. Coming up with an analytical model for the turn of a surfboard requires an estimation of the drag acting on the board. read more..

  • Page - 292

    274 CH APTER 9 ■ BOA TS AND THINGS THAT FLOAT References 1. F. Papoulias, “Ship Resistance and Propulsion,” http://web.nps.navy.mil/~me/tsse/TS4001/ support/1-4-1.pdf. read more..

  • Page - 293

    275 ■ ■ ■ CHAPTER 10 Airplanes People have always had a fascination with flying. It would be so convenient and so fun to soar with the birds. For thousands of years, people dreamed of ways that man could fly. In a Greek legend, Icarus and his dad built wings out of wax to escape King Minos. Unfortunately, Icarus flew too close to the sun and his wings read more..

  • Page - 294

    276 CHAPTER 10 ■ AIRPLANE S Historical Stuff One of the biggest obstacles to the development of heavier-than-air flight was that it was widely considered to be physically impossible. Famous scientists came up with elaborate “proofs” of why it couldn’t be done. In the 1890s, a German mechanical engineer named Otto Lilienthal dispelled this motion by building and read more..

  • Page - 295

    CHAPTER 10 ■ AIRPLANES 277 and is used to stabilize the plane and to help it turn. The tail consists of two parts—a horizontal, wing-like structure called the horizontal stabilizer and a vertical structure called the vertical stabilizer or vertical fin. Figure 10-2. Airplane schematic Here is a short glossary defining the terms shown in Figure 10-2 and some other read more..

  • Page - 296

    278 CHAPTER 10 ■ AIRPLANE S Basic Force Diagram As shown in Figure 10-3, four basic forces act upon an airplane. Thrust generated by the airplane engine propels the aircraft forward. Aerodynamic drag resists the forward motion of the aircraft and acts in the opposite direction to the velocity vector of the aircraft. When air flows over the wing and other read more..

  • Page - 297

    CHAPTER 10 ■ AIRPLANES 279 Figure 10-4. An airfoil schematic The angle of attack for an airfoil, typically represented by the Greek letter α as shown in Figure 10-5, is the angle the chord line makes with the velocity vector of the airfoil. As we shall see later in this section, the lift and drag characteristics of an airfoil are often evaluated as a read more..

  • Page - 298

    280 CHAPTER 10 ■ AIRPLANE S on the air. By Newton’s third law of equal and opposite forces, if the airfoil is exerting a force on the air, then the air is applying an equal and opposite force on the airfoil. The net force on the airfoil due to air turning, that is, the difference in force between the top and bottom surfaces, is the lift generated read more..

  • Page - 299

    CHAPTER 10 ■ AIRPLANES 281 The surface pressure on each subsection could be computed using the principles of conservation of mass, momentum, and energy. The overall surface pressure, and therefore lift, of the airfoil is determined by summing up the contributions from each subsection. Computational fluid dynamics is a powerful tool, but it is too complicated and read more..

  • Page - 300

    282 CHAPTER 10 ■ AIRPLANE S Figure 10-8. Lift coefficient data for the NACA 0012 and 2412 airfoils One thing that is obvious from looking at Figure 10-8 is that changing the angle of attack of an airfoil changes its lift. This phenomenon makes sense because tilting the airfoil up or down changes the way that air flows around it, which changes the surface read more..

  • Page - 301

    CHAPTER 10 ■ AIRPLANES 283 airplane. Knowing that the lift force must equal the weight of the airplane, the stall speed can be computed from Equation (10.3). Figure 10-9. Flow separation reduces the lift generated by an airfoil. You will most likely want to include the possibility of stall in your flight simulation, partic- ularly when you are modeling takeoffs and read more..

  • Page - 302

    284 CHAPTER 10 ■ AIRPLANE S Figure 10-11. The effect of flap deflection on lift coefficient Center of Pressure In the “How Lift Is Created” section of this chapter, you learned that according to Bernoulli’s equation the pressure on the surface of the wing is related to the air velocity as it flows over the wing. Because the air velocity will vary over read more..

  • Page - 303

    CHAPTER 10 ■ AIRPLANES 285 The lift force of an airfoil can be determined by integrating (that is, summing up) the pressure distribution over the top and bottom surfaces of the wing. The resulting lift force can be modeled by assuming that it is concentrated at a single point known as the center of pressure of the airfoil. This point is important in the read more..

  • Page - 304

    286 CHAPTER 10 ■ AIRPLANE S The engine power is sometimes referred to as the engine brake power because engine power is tested by applying a brake to the engine shaft. The thrust power is equal to the thrust produced by the propeller multiplied by the airplane velocity, v. The propeller efficiency, which has a value between 0 and 1, is not constant but read more..

  • Page - 305

    CHAPTER 10 ■ AIRPLANES 287 match significant features of the curve. For example, in Figure 10-13 the maximum propeller efficiency value of approximately 0.83 occurs at an advance ratio value of about 0.65. The slope of the curve at this point will be zero. Using this information, the values of the constants to match Figure 10-13 can be obtained. The results of read more..

  • Page - 306

    288 CHAPTER 10 ■ AIRPLANE S Equation (10.11) can also be expressed in terms of the airplane velocity. Equation (10.12) is what we will use when we create a flight simulator a little later in the chapter. It states that the thrust generated by the propeller at any time is a function of the engine power, airplane velocity, propeller turnover rate, and read more..

  • Page - 307

    CHAPTER 10 ■ AIRPLANES 289 Example: Computing the Thrust of the Cessna 172 Skyhawk Let’s apply what we’ve learned about propeller engine thrust to compute the thrust profiles of the Cessna 172 Skyhawk airplane. The Skyhawk, shown in Figure 10-15, is a small, single- engine airplane that has been flying for many years and is still quite popular in the world of read more..

  • Page - 308

    290 CHAPTER 10 ■ AIRPLANE S The input parameters are inserted into Equation (10.18), and thrust values are computed as a function of velocity up to the maximum rated velocity of the plane of 63 m/s. The results are shown in Figure 10-16. Because the b coefficient in the curve fit equation is negative, the calcu- lated thrust generated by the engine is read more..

  • Page - 309

    CHAPTER 10 ■ AIRPLANES 291 Jet Engines The second main type of airplane engine we will see in this chapter is the jet engine. This type of engine uses a series of spinning blades known as a turbine to generate thrust. A turbine can be thought of as a propeller with many blades. People have been playing around with turbines and turbine engines for a read more..

  • Page - 310

    292 CHAPTER 10 ■ AIRPLANE S The subscript 0 in Equation (10.19) represents the inlet conditions and the subscript e corresponds to exit conditions. The variable is the inlet or exit mass flow rate in kg/s. Jet engines are usually characterized by thrust, and this number can be used in your simulations if the mass flow rate and pressure data is not available. read more..

  • Page - 311

    CHAPTER 10 ■ AIRPLANES 293 An interesting characteristic about the parasitic drag coefficient is that it is not a function of angle of attack but is only a function of the airplane geometry. For example, the parasitic drag coefficient won’t change if the airplane changes its pitch angle, but the coefficient will change if the wing flaps are deflected. Induced read more..

  • Page - 312

    294 CHAPTER 10 ■ AIRPLANE S The wing aspect ratio is defined as the ratio of the square of the wing span, s, divided by the wing reference area, A. The wing reference area in Equation (10.23) is the wetted area of the wing, the same value that is used in the lift and drag equations. In looking at Equation (10.22), the induced drag coef- ficient is read more..

  • Page - 313

    CHAPTER 10 ■ AIRPLANES 295 Figure 10-19. Straight-and-level drag profiles for the Cessna 172 Skyhawk Keep in mind that the drag profiles shown in Figure 10-19 are for straight-and-level flight. If the airplane was climbing or sinking, the lift would not be equal to the weight of the airplane, and the induced drag profile would be somewhat different. Lift over Drag read more..

  • Page - 314

    296 CHAPTER 10 ■ AIRPLANE S Figure 10-20. Force diagram for an airplane that is climbing For the purposes of analyzing full-body aerodynamics, the lift force, FL, as shown in Figure 10-20 will be defined as the aerodynamic force component that acts perpendicular to the velocity vector of the airplane. Similarly, the drag force, FD, is defined as the aerodynamic read more..

  • Page - 315

    CHAPTER 10 ■ AIRPLANES 297 Figure 10-21. Banking the airplane creates a sideways force component. When the airplane banks, a sideways component to the lift force causes the airplane to turn in a circular arc. When the bank angle is brought back to zero, the sideways lift force compo- nent disappears, and the airplane once again flies in a straight line. The read more..

  • Page - 316

    298 CHAPTER 10 ■ AIRPLANE S Figure 10-22. The pitch, roll, and yaw rotations relative to the center of gravity. Pitch, roll, and yaw are relative to the center of gravity of the airplane. For game simulation purposes, it is usually valuable to define the airplane orientation relative to a fixed point on the ground in terms of climb, heading, and roll read more..

  • Page - 317

    CHAPTER 10 ■ AIRPLANES 299 The cosine and sine of the heading angle is equal to the ratio of the x- and y-velocity components to the horizontal velocity component. The bank angle relative to a fixed point on the ground is the same as the bank angle relative to the center of gravity. Its definition remains the same as was defined in Figure 10-21. The lift, read more..

  • Page - 318

    300 CHAPTER 10 ■ AIRPLANE S The key to minimizing takeoff velocity for a given airplane at a given atmospheric density condition is to maximize the lift coefficient. Lift increases with angle of attack, but the airplane is rolling along the ground so the angle of attack is equal to the incidence angle of the wing, which is usually quite small. Deflecting the read more..

  • Page - 319

    CHAPTER 10 ■ AIRPLANES 301 Exercise 1. Compute the liftoff velocity for the Cessna 172 Skyhawk that uses a NACA 2412 airfoil for its wing. Assume for this problem that the incidence of the wing is zero. The weight of the plane is 10245 N (2300 lb), the reference wing area is 16.2 m2, and the plane is taking off at sea level where the air density is read more..

  • Page - 320

    302 CHAPTER 10 ■ AIRPLANE S • Flap, elevator, and aileron deflections are assumed to happen instantaneously. No attempt will be made to model the dynamic behavior of these flight control surfaces. • When the plane is traveling down the runway, the rolling friction between the wheels and ground will be ignored. If you wanted to include that effect in your read more..

  • Page - 321

    CHAPTER 10 ■ AIRPLANES 303 Figure 10-24. The Flight Simulator GUI display The first thing the PropPlane class does is to declare a number of fields that define various aspects of the airplane. Many of the field names are self-explanatory. The lift coefficient curve for the airplane wing is approximated by two straight lines to model the pre- and post-stall lift read more..

  • Page - 322

    304 CHAPTER 10 ■ AIRPLANE S public class PropPlane extends SimpleProjectile { // Declare fields. private double bank; private double alpha; // Angle of attack private double throttle; private double wingArea; private double wingSpan; private double tailArea; private double clSlope0; // Slope of Cl-alpha curve private double cl0; read more..

  • Page - 323

    CHAPTER 10 ■ AIRPLANES 305 this.cdp = cdp; this.eff = eff; this.mass = mass; this.enginePower = enginePower; this.engineRps = engineRps; this.propDiameter = propDiameter; this.a = a; this.b = b; // Initially, set bank, angle of attack, // and throttle to zero. bank = 0.0; read more..

  • Page - 324

    306 CHAPTER 10 ■ AIRPLANE S // Compute the intermediate values of the various // velocities. double vx = newQ[0]; double vy = newQ[2]; double vz = newQ[4]; double x = newQ[1]; double y = newQ[3]; double z = newQ[5]; double vh = Math.sqrt(vx*vx + vy*vy); double vtotal = read more..

  • Page - 325

    CHAPTER 10 ■ AIRPLANES 307 The nominal value of lift coefficient is modified according to whether the flaps are deflected or if ground effects are present. A simplified approach is taken to account for flap deflection. If the flaps are deflected 20 degrees, the CL is increased by 0.25. If the flaps are deflected 40 degrees, CL is increased by 0.5. read more..

  • Page - 326

    308 CHAPTER 10 ■ AIRPLANE S double cosP; // Climb angle double sinP; // Climb angle double cosT; // Heading angle double sinT; // Heading angle if ( vtotal == 0.0 ) { cosP = 1.0; sinP = 0.0; } else { read more..

  • Page - 327

    CHAPTER 10 ■ AIRPLANES 309 Now that a generic PropPlane class has been created, it is a simple matter to declare subclasses of it that represent specific types of airplanes. All that the airplane-specific subclasses have to do is to pass the proper input parameters to the PropPlane constructor. All of the methods and fields needed to describe the state and read more..

  • Page - 328

    310 CHAPTER 10 ■ AIRPLANE S If you want to try for a more gentle landing experience, decrease the angle of attack and/or throttle and try to set the plane down with a vertical velocity smaller than –5.0 m/s. Trim and Stability The final topics that will be discussed in this chapter are the trim and stability of an airplane. As you have learned in the read more..

  • Page - 329

    CHAPTER 10 ■ AIRPLANES 311 Figure 10-26 shows moment coefficient data for the NACA 2412 airfoil.1 The moment coef- ficient shown in the figure is relative to the quarter chord point. It is fairly constant for angle of attack values ranging from –10 to 10. Figure 10-26. Moment coefficient data for the NACA 2412 airfoil While the moment about the aerodynamic center read more..

  • Page - 330

    312 CHAPTER 10 ■ AIRPLANE S Figure 10-27. Lift from the wing generates a moment about the c.g. of the airplane. Figure 10-28. A counterbalancing moment is generated by the horizontal stabilizer. If the distance between the wing lift force, FLw, and the c.g. is equal to dw, and the distance from the horizontal stabilizer lift force, FLt, and the c.g. is equal read more..

  • Page - 331

    CHAPTER 10 ■ AIRPLANES 313 Stability The previous section introduced the concept of trim, which is a condition where the moment through the center of gravity of an airplane is equal to zero. What happens when the angle of attack deviates from the trim angle defines the stability of the airplane. In this section we will discuss pitch stability, in which read more..

  • Page - 332

    314 CHAPTER 10 ■ AIRPLANE S The condition for pitch stability can be expressed mathematically. For pitch stability, the derivative of pitching moment coefficient with respect to angle of attack for an airplane must be negative. This situation corresponds to the moment curve having a negative slope. Stability and Trim Ideally, an airplane should be stable, and it should read more..

  • Page - 333

    CHAPTER 10 ■ AIRPLANES 315 Figure 10-31. The four stability trim possibilities Dynamic Stability The preceding discussion on stability has actually been on the static stability of the airplane. The term “static” means that there is no time component to the analysis. Static stability deals only with the initial tendency of the airplane to return to an equilibrium orientation or read more..

  • Page - 334

    316 CHAPTER 10 ■ AIRPLANE S Figure 10-32. A plane is dynamically stable if deviations from the equilibrium orientation die out over time. The moment time history shown in Figure 10-33, on the other hand, represents a dynam- ically unstable airplane in that the magnitude of the moment oscillations increase over time. Figure 10-33. A plane is dynamically unstable read more..

  • Page - 335

    CHAPTER 10 ■ AIRPLANES 317 • The three types of drag experienced by an airplane, skin friction, form, and induced drag, and how induced drag is related to the lift generated by a wing • How to compute the thrust of propeller and jet engines and how to account for altitude effects on thrust • The physics of takeoffs and landings • How a plane turns read more..

  • Page - 336

    319 ■ ■ ■ CHAPTER 11 Rockets and Missiles In previous chapters in this book, we explored how to model the motion of cars, boats, and airplanes. Now it’s time to leave the confines of the lower atmosphere and learn about the physics of rockets. Rockets have been around for 800 years or so. At first they were used mostly for military purposes, but starting read more..

  • Page - 337

    320 CHAPTER 11 ■ RO CKETS A N D MISSILES the early days. In the early 1800s, an Italian named Claude Ruggieri entertained people by rock- eting small animals into the air and recovering the animal-carrying payloads by parachute. Up until the early twentieth century, rockets were typically powered by gunpowder. In 1903, a Russian schoolteacher named Konstantin read more..

  • Page - 338

    CH APTER 11 ■ ROCKETS AND MISSILES 321 Some Rocket Terminology A schematic of a liquid-propellant rocket is shown in Figure 11-2. The rocket engine requires two liquids. The first is an oxidizer that is stored in an oxidizer tank. Typically, liquid oxygen is used for the oxidizer. The fuel tank holds a liquid that contains hydrogen. Liquid hydrogen and a highly read more..

  • Page - 339

    322 CHAPTER 11 ■ RO CKETS A N D MISSILES at temperatures below 90 K (-297oF). Commonly used fuels in liquid-cryogenic rocket engines include liquid hydrogen and kerosene, although kerosene does not have to be kept at very low temperatures. Cryogenic propellants provide better performance than solid propellants, but the internal structure of a liquid-cryogenic read more..

  • Page - 340

    CH APTER 11 ■ ROCKETS AND MISSILES 323 General Force Diagram The forces that act upon a rocket during ascent are shown in Figure 11-3. By this time in the book, it probably comes as no shock to you that a rocket is acted upon by the forces of thrust, drag, lift, and gravity. The thrust force is generated by the rocket engines. Drag, as always, acts in read more..

  • Page - 341

    324 CHAPTER 11 ■ RO CKETS A N D MISSILES The first term in Equation (11.3) is called the momentum thrust and is caused by the rocket engine ejecting exhaust gases from the rocket nozzle. The momentum thrust is equal to the exhaust velocity of the combustion gases, vex, multiplied by the mass flow rate. The l term in the momentum thrust expression read more..

  • Page - 342

    CH APTER 11 ■ ROCKETS AND MISSILES 325 Equation (11.8) is called the rocket equation and was first presented by Tsiolkovskii in 1903. It states that in the absence of any external forces, the velocity of a rocket at any point in time is a function of the original mass and velocity of the rocket, m0 and v0, the effective exhaust velocity of the read more..

  • Page - 343

    326 CHAPTER 11 ■ RO CKETS A N D MISSILES This definition is equal to the previous one without the gravitational acceleration scaling. The units for the specific impulse as defined in Equation (11.11) are typically expressed in terms of (N-s)/kg, which is equivalent to m/s. You can use either definition for Isp in your game programming; just make sure that read more..

  • Page - 344

    CH APTER 11 ■ ROCKETS AND MISSILES 327 Computing Atmospheric Pressure, Density, and Temperature The atmospheric pressure as a function of altitude is necessary to properly evaluate the thrust of a rocket engine. When we study drag a little later in this chapter, we will find that we need the density as a function of altitude as well. The pressure, temperature, read more..

  • Page - 345

    328 CHAPTER 11 ■ RO CKETS A N D MISSILES public double getDensity() { return density; } public double getTemperature() { return temperature; } // This method computes atmospheric density, // pressure, and temperature based on the U.S. // Standard Atmosphere 1976 model. public void updateConditions(double altitude) read more..

  • Page - 346

    CH APTER 11 ■ ROCKETS AND MISSILES 329 else if (geoAltitude < 32000.0) { slope = 0.001; T0 = 216.65; p0 = 5474.8; h0 = 20000.0; } else if (geoAltitude < 47000.0) { slope = 0.0028; T0 = 228.65; p0 = 868.0; h0 = 32000.0; read more..

  • Page - 347

    330 CHAPTER 11 ■ RO CKETS A N D MISSILES else { temperature = T0 + slope*(geoAltitude - h0); grp = T0/temperature; grp2 = G/(slope*R); pressure = p0*Math.pow(grp,grp2); } density = pressure/(R*temperature); return; } } The USatm76 class computes the pressure, density, and read more..

  • Page - 348

    CH APTER 11 ■ ROCKETS AND MISSILES 331 Figure 11-4. Gravitational acceleration as a function of altitude Drag By this point in the book, you should be very familiar with the concept of aerodynamic drag and with the equation that is used to evaluate drag. Just to refresh your memory, the drag expe- rienced by a rocket as it travels through the atmosphere is read more..

  • Page - 349

    332 CHAPTER 11 ■ RO CKETS A N D MISSILES Figure 11-5. Variation of atmospheric density with altitude It’s apparent from Figure 11-5 that density changes quite significantly with increasing alti- tude. The density at 80 km is almost 100,000 times less than the density at sea level. Another quantity needed to compute aerodynamic drag is the drag coefficient for read more..

  • Page - 350

    CH APTER 11 ■ ROCKETS AND MISSILES 333 Figure 11-6. Saturn 1B velocity profiles with and without drag Lift When a rocket is in flight, its longitudinal axis may be at a nonzero angle to the flight path of the rocket. If this is the case, the rocket will experience a lift force. Usually, the lift force on a rocket is quite small, but it does have read more..

  • Page - 351

    334 CHAPTER 11 ■ RO CKETS A N D MISSILES A Rocket Simulator Let’s use what we have learned about modeling the physics of rockets to write a rocket simu- lator. The user gets to build her own rocket by selecting an engine type, number of engines, and payload mass. When the rocket is launched, it flies until its propellant is used up. The simulator will read more..

  • Page - 352

    CH APTER 11 ■ ROCKETS AND MISSILES 335 Figure 11-7. A typical Rocket Simulator screen shot As with the Flight Simulator in Chapter 10, several simplifications and assumptions are made in the design of the Rocket Simulator: • The effect of pitch angle is included in the model, but the rocket is constrained to move in the x-z plane. There is no y-directional read more..

  • Page - 353

    336 CHAPTER 11 ■ RO CKETS A N D MISSILES • There is no wind in the simulation. • The lift force acting on the rocket is assumed to be zero. Lift force will generally be insig- nificant for rockets during the ascent part of their flight. • The effect of centripetal acceleration is ignored. Two classes are required to create the Rocket Simulator—one to read more..

  • Page - 354

    CH APTER 11 ■ ROCKETS AND MISSILES 337 // Call the ODE class constructor. super(10); // Load the initial values into the s field // and q array from the ODE class. setS(time); setQ(vx0,0); setQ(x0, 1); setQ(vy0,2); setQ(y0, 3); setQ(vz0,4); setQ(z0, 5); read more..

  • Page - 355

    338 CHAPTER 11 ■ RO CKETS A N D MISSILES The SimpleRocket class declares a getRightHandSide method to compute the right-hand sides of the 10 ODEs that define the equations of motion for the rocket. The first part of the method proceeds as all of the other versions do, namely that intermediate values of the depen- dent variables are computed and some read more..

  • Page - 356

    CH APTER 11 ■ ROCKETS AND MISSILES 339 // Compute the drag force based on the frontal area // of the rocket. double area = 0.25*Math.PI*rocketDiameter*rocketDiameter; double drag = 0.5*cd*density*vtotal*vtotal*area; The gravitational acceleration will decrease as the rocket gets further and further away from the surface of the earth. The read more..

  • Page - 357

    340 CHAPTER 11 ■ RO CKETS A N D MISSILES button is pressed, a Timer object begins to call the actionPerformed method every 0.1 seconds to update the location, velocity, mass, and pitch angle of the rocket. The first thing the method does is to get input data for the payload mass, rocket diameter, and number of engines from the GUI components. // read more..

  • Page - 358

    CH APTER 11 ■ ROCKETS AND MISSILES 341 // Calculate propellant mass per engine. double propellantMass = massFlowRate*burnTime; // Estimate rocket structural mass; double structureMass = 20000.0 + numEngines*4000.0; // Compute initial mass of rocket. double initialMass = numEngines*(engineMass + propellantMass) + read more..

  • Page - 359

    342 CHAPTER 11 ■ RO CKETS A N D MISSILES Figure 11-8. Velocity profile for vertical ascent simulation The profiles shown in Figure 11-8 are for a rocket traveling vertically throughout its ascent. To achieve orbit, a rocket has to gradually pitch itself over so at the end of its ascent its velocity vector is horizontal or nearly horizontal relative to the read more..

  • Page - 360

    CH APTER 11 ■ ROCKETS AND MISSILES 343 For a circle, the instantaneous radius of curvature, r, is simply the radius of the circle. For a more complicated shape such as an ellipse, the radius of curvature will vary depending on where on the ellipse the radius of curvature is being evaluated. Circular Orbits The easiest type of orbit to analyze is a circular read more..

  • Page - 361

    344 CHAPTER 11 ■ RO CKETS A N D MISSILES Comparing Equations (11.17) and (11.19), we see that the escape velocity is equal to the circular orbit velocity times the square root of 2. The escape velocity for an object in a 300 km orbit around the earth is 10,942 m/s. As was the case with the circular orbit velocity, the mass of the object has no effect read more..

  • Page - 362

    CH APTER 11 ■ ROCKETS AND MISSILES 345 Single-stage rockets have a difficult time reaching Earth’s orbit. The solution to this problem is what is known as a multistage rocket. Multistage Rockets A multistage rocket is two or more rockets, called stages, that are piggybacked on top of one another to create a single launch system. The Saturn V rocket, shown read more..

  • Page - 363

    346 CHAPTER 11 ■ RO CKETS A N D MISSILES The change in velocity for each stage can be computed from Equation (11.22). The total change in velocity for the rocket is the sum of the velocity changes for each stage. Let’s compare the multistage Δv result to the value that would be obtained if the first stage of the Saturn 5 were flown by read more..

  • Page - 364

    CH APTER 11 ■ ROCKETS AND MISSILES 347 Missiles Now that we have learned the basics of modeling the physics of rockets, let’s spend a little time exploring the physics of missiles. The word “missile” has several definitions, but in this chapter a missile is defined simply as a rocket that is used for military purposes. Missiles can be large or small. read more..

  • Page - 365

    348 CHAPTER 11 ■ RO CKETS A N D MISSILES Quite a bit of research has been performed on developing sophisticated guidance systems, but an equal amount of research has also gone into finding ways to confuse missile guidance systems so they lose sight of their target. Some targets may try to electronically jam a radar guidance system. Small metal strips, read more..

  • Page - 366

    CH APTER 11 ■ ROCKETS AND MISSILES 349 ■Tidbit The Sidewinder, first introduced in 1956, is a bargain in the world of military missiles. The unit cost of each missile is only $84,000. Summary In this chapter, you learned about the physics of rockets. We saw a little bit about how rockets were first invented and about the development of rocket technology read more..

  • Page - 367

    351 ■ ■ ■ CHAPTER 12 The Physics of Solids For the most part in this book, we have been studying the external physics of various objects— how they fly through the air, drive across land, float over water. The main emphasis in the earlier chapters has been in modeling the external forces of thrust, drag, lift, gravity, and fric- tion. In this chapter, we will read more..

  • Page - 368

    352 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S three possibilities will occur depends on the mass, composition, and velocity of the projectile and target. An arrow shot at a tank will bounce off the tank’s armor. The same arrow shot at a wooden shield might penetrate part or all the way through the shield. In this section, we’ll start by talking read more..

  • Page - 369

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 353 the impact angle of the projectile, the thickness of the target, and the material properties of the target. Creating a detailed model of projectile penetration into a target would be very complicated and not appropriate for game programming applications. For some situations, such as a shell hitting a steel plate, there are read more..

  • Page - 370

    354 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S The right-hand side of Equation (12.5) tells us which factors influence steel armor penetration. The thickness of the armor and the resistance of the armor to penetration increase (obviously) the kinetic energy of the projectile required to penetrate the armor. The diameter of the projectile also has an effect in read more..

  • Page - 371

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 355 The NIJ body armor tests were conducted by shooting bullets at body armor at a distance of about 3 m. The types of bullets tested and their mass and reference velocities are shown in Table 12-2. The abbreviation FMJ stands for “full metal jacket” and indicates a bullet consisting of a lead core covered with a read more..

  • Page - 372

    356 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S To model the effects of body armor penetration in your game simulations, you could equip your soldiers, law enforcement officers, or whomever with one of the types of body armor listed in Table 12-1. When a bullet strikes the person wearing the body armor, compute the kinetic energy of the bullet at read more..

  • Page - 373

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 357 When the projectile strikes the target, whether it bounces off the target or penetrates the target, the momentum of the projectile changes because the target exerts a force on the bullet and the bullet exerts an equal and opposite force on the target. This force, also known as blunt trauma, can significantly damage a read more..

  • Page - 374

    358 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S cavity inside the body. The expanding walls of the temporary cavity can cause very high local pressures to occur. When a bullet exits an object, such as the tomato shown in Figure 12-1, damaged tissue is ejected out of the exit hole behind the bullet. Figure 12-1. Damage caused by a high-velocity bullet read more..

  • Page - 375

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 359 Fourier’s Law In general, heat conduction will occur in all three directions, but that general case is too compli- cated for most game programming applications. The mathematics can be considerably simplified if the heat conduction is assumed to be one-dimensional, acting only in the direction normal to the surface of read more..

  • Page - 376

    360 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S The Heat Conduction Equation To model a transient, or time-varying, heat conduction problem, a heat energy equation that has a time derivative term must be developed. In order to come up with this equation, a heat energy balance is evaluated for the system. As shown in Figure 12-2, the heat energy that enters read more..

  • Page - 377

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 361 The thermal diffusivity, K, has units of m2/s and is equal to the ratio of the thermal conductivity divided by the specific heat capacity and density. The thermal diffusivity can be thought of as a measure of the ability of a material to transfer heat by conduction. Values of thermal diffusivity for various read more..

  • Page - 378

    362 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S The 1-D heat conduction equation can be written in terms of the variable u as a second- order ODE. Without going into all of the details, the solution to Equation (12.15) is an integral equation in terms of u and the thermal diffusivity, K. The quantities A and B are constants that are determined read more..

  • Page - 379

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 363 Figure 12-3. The error function profile For the 1-D head conduction equation, two boundary conditions are required. As an example, let’s assume we want to solve the 1-D heat conduction equation over a metal rod. One possible boundary condition would be to maintain a constant temperature, T1, at the end of the rod where read more..

  • Page - 380

    364 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S The Gas Tank Simulator Let’s use the 1-D heat conduction equation to simulate how long it will take a gas tank to explode when exposed to a flame. A typical screen shot of the Gas Tank Simulator is shown in Figure 12-4. At the top of the GUI is a display window showing a not-too-bright soldier read more..

  • Page - 381

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 365 To solve the heat conduction problem, we will write two classes. The first, called GasTank, represents (as you probably guessed) a gas tank. In this simple example, the GasTank class only declares four fields that contain values of the thickness of the tank wall, thermal diffusivity, initial temperature, and boundary read more..

  • Page - 382

    366 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S The GasTank class declares two other methods. The first is the getErrorFunction method that returns a value of the error function. The method uses a table lookup procedure to compute the error function value. The table lookup method is considerably faster than if the error function were computed according to Equation read more..

  • Page - 383

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 367 grp = 0.5*x/Math.sqrt(diffusivity*time); erf = getErrorFunction(grp); temperature = boundaryT + (initialT-boundaryT)*erf; return temperature; } The GUI elements of the Gas Tank Simulator are implemented in the GasTankSimulator class. The class is a bit different than the GUI classes previously presented read more..

  • Page - 384

    368 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S // Update the display. updateDisplay(); // Fire the flamethrower using a Timer object. gameTimer.start(); } The GasTankSimulator class declares an inner class named GameUpdater. The Timer is set up to call the actionPerformed method declared in the GameUpdater class every 0.1 read more..

  • Page - 385

    CHA PTER 12 ■ THE PHYSICS OF SOLIDS 369 Figure 12-5 shows the time variation of inner wall temperature for the case of an aluminum gas tank where the outer wall temperature is 1000 K and the tank thickness is 0.025 m. The inner wall temperature remains at 300 K for 0.3 seconds. As heat conducts through the tank wall, the inner wall temperature begins read more..

  • Page - 386

    370 CHAPTER 12 ■ TH E PHYS ICS OF SO LID S • How Fourier’s law relates the heat energy flowing through an object to the temperature gradient inside the object • The material properties of thermal conductivity and thermal diffusivity as measurements of the ability to conduct heat energy • How the heat conduction equation can be used to model time-varying read more..

  • Page - 387

    371 ■ ■ ■ CHAPTER 13 Explosions We’ve already seen in this book how to model projectiles as they fly through the air and how to model the ballistic impact of a projectile with another object. Things don’t always just fly through the air in game simulations. Sometimes they also blow up. The physics of explosions is very complex—you can literally get a PhD in read more..

  • Page - 388

    372 CHAPTER 13 ■ EXPL OSIONS Some Explosion Terminology Before we burrow into the physics of explosions, it’s helpful to spend a little time defining some explosion terminology. • Autoignition temperature: The temperature at which an explosive will explode without an external ignition source. As an example, the autoignition temperature of kerosene is 463 K (374 oF). • read more..

  • Page - 389

    CHAPTER 13 ■ E X PLOS IO NS 373 the same level as an object such as a truck, the truck will not be thrown into the air but will be pushed sideways. Only if the truck was above the point of explosion could it be thrown into the air. Figure 13-1. Force due to overpressure will push the truck sideways. Explosive Types There are many, many substances that read more..

  • Page - 390

    374 CHAPTER 13 ■ EXPL OSIONS ■Tidbit Alfred Nobel was bothered by the fact that the dynamite he invented was being used for death and destruction (well, duh!). When he died in 1896, his will provided for the establishment of the Nobel Prize in various scientific disciplines for peace and the betterment of all people. TNT Trinitrotoluene, better known as read more..

  • Page - 391

    CHAPTER 13 ■ E X PLOS IO NS 375 Certain explosives such as C4 and TNT are stable enough that they need a detonator in order to explode. A detonator is a smaller explosive charge that is used to initiate the explosion of a larger explosive. Typical detonator explosive materials include mercury fulminate and diazodinitrophenol, also known as DDNP. The detonator charge read more..

  • Page - 392

    376 CHAPTER 13 ■ EXPL OSIONS A wall or ceiling collapse will cause more serious injuries to anyone in the way of the falling debris. If a building collapses, most of the people inside the building will be killed. Even if they are not struck by flying debris or crushed under a collapsing building, people can still be wounded by the effects of a blast wave. read more..

  • Page - 393

    CHAPTER 13 ■ E X PLOS IO NS 377 The TNT explosion model states that an object will experience the same overpressure from different explosions if the object is at the same scaled distance from the explosions. For example, a person standing 10 m away from a 1000 kg TNT explosion will experience the same overpressure, and therefore the same blast damage, as read more..

  • Page - 394

    378 CHAPTER 13 ■ EXPL OSIONS 1. Compute the scaled distance based on the distance from the target to the point of explosion and the amount of TNT that is exploding using Equation (13.1). 2. Use the scaled distance value to calculate the overpressure for the shock wave from Equation (13.2). 3. Use the computed overpressure value to estimate the damage inflicted on the read more..

  • Page - 395

    CHAPTER 13 ■ E X PLOS IO NS 379 The efficiency factor accounts for the fact that for many explosives only some fraction of the total specific combustion energy is converted into explosive energy. Once the equivalent TNT mass for the given explosive is computed, the scaled distance and overpressure for the explosion can be determined from Equations (13.1) and (13.2) read more..

  • Page - 396

    380 CHAPTER 13 ■ EXPL OSIONS In addition to damage caused by the explosion itself, one of the main reasons to encase explosive material inside an object is to cause metal fragments to fly outward from the point of explosion. We’ll discuss the effects of fragmentation next. Fragmentation Devices A fragmentation device consists of an explosive material that is encased read more..

  • Page - 397

    CHAPTER 13 ■ E X PLOS IO NS 381 As an example, let’s use Equation (13.8) to compute the initial velocity of the fragments from an M-61 hand grenade. The M-61 uses 0.185 kg of an explosive material known as Comp-B for its explosive charge. Comp-B has a heat of explosion of 4.04e + 6 J/kg. The mass of the metal casing is 0.210 kg. Using the read more..

  • Page - 398

    382 CHAPTER 13 ■ EXPL OSIONS Figure 13-3. A typical nuclear explosion mushroom cloud (Photo courtesy of U.S. Department of Energy) Nuclear weapons are almost always characterized in terms of the equivalent amount of TNT. When a reference is made to a nuclear weapon with a yield of 1 megaton, this means a weapon with an explosive energy equal to one million tons read more..

  • Page - 399

    CHAPTER 13 ■ E X PLOS IO NS 383 • How to compute the initial velocity of fragments from the explosion of a fragmentation device and how to estimate the number of fragments that will hit a target • An introduction to the special features of a nuclear explosion References 1. “Primer to Design Safe School Projects in Case of Terrorist Attacks,” Federal read more..

  • Page - 400

    385 ■ ■ ■ CHAPTER 14 Lasers Lasers, highly focused beams of energy, have been a standard in movies and games for many years. The word “laser” is an acronym that stands for Light Amplification by Stimulated Emission of Radiation. Don’t worry what “Stimulated Emission” means right now. We’ll go over that later in this chapter. One of the reasons that lasers read more..

  • Page - 401

    386 CHAPTER 14 ■ LASERS ■Tidbit While Einstein is best known for his theories of relativity, he did not win the Nobel Prize for that work because it was considered too speculative at the time (the fact that Einstein was a complete unknown when he came up with relativity probably didn’t help either). Einstein won the Nobel Prize in physics read more..

  • Page - 402

    CH A P T E R 1 4 ■ LASE RS 387 Electrons have a negative electric charge. Protons have a positive electric charge. Because of the charge difference, there is an electrostatic force that pulls the electrons towards the nucleus. Balancing the electrostatic force is the centripetal force of the electrons as they travel around the nucleus. The radius of the electron read more..

  • Page - 403

    388 CHAPTER 14 ■ LASERS Figure 14-3. When an atom absorbs energy, one of its electrons can move to a higher energy state. Figure 14-4. When an electron transitions to a lower energy state, it emits a photon. Other energy level transitions would be possible with the hydrogen atom. If an electron transitioned from the third excited energy state to the second, a photon read more..

  • Page - 404

    CH A P T E R 1 4 ■ LASE RS 389 The wavelength, λ, of a photon is related to the amount of energy, E, the photon is given when it is generated. In Equation (14.1), c is the speed of light with a value of 3.0e + 8 m/s and h is the Planck constant, which has a value of 6.626e – 34 J-s. Let’s use Equation (14.1) to read more..

  • Page - 405

    390 CHAPTER 14 ■ LASERS Figure 14-6. Inside a laser, photon emissions can stimulate additional photon emissions. The energy of the emitted photons will depend on the difference in energy between the upper and lower energy states that the electron transitions. The energy levels themselves will depend on the material that makes up the lasing medium. Different lasing read more..

  • Page - 406

    CH A P T E R 1 4 ■ LASE RS 391 The light generated by a laser is very different from normal light. For one thing, laser light is monochromatic (one color) because the photons are emitted by atoms at the same energy state and therefore have the same wavelength. Rather than the chaotic light produced by a flashlight, laser light is coherent, meaning that read more..

  • Page - 407

    392 CHAPTER 14 ■ LASERS Typical uses for gas lasers include industrial drilling and cutting applications. Because of their potential to generate high power output levels, many lasers used for military applications are gas lasers. Dye Lasers Dye lasers use an organic dye in a liquid solution as the lasing material. Depending on the dye used, dye lasers can emit light read more..

  • Page - 408

    CH A P T E R 1 4 ■ LASE RS 393 Pulsed and Continuous Wave Lasers Another fundamental distinction between lasers is whether the beam they produce is contin- uous or is generated as a series of short pulses. A pulse laser generates a beam for very short periods of time, usually tiny fractions of a second. The peak power, energy divided by pulse duration, read more..

  • Page - 409

    394 CHAPTER 14 ■ LASERS The average power of the laser will be in the 1 megawatt (MW) range. A megawatt is equal to 1.0e + 6 W. Complete technical details for the ABL system are unavailable to the public, but some of the ABL specifications are shown in Table 14-3. The system mass is for the laser alone and (obviously) does not include the mass of read more..

  • Page - 410

    CH A P T E R 1 4 ■ LASE RS 395 HELEX The goal of the High Energy Laser Experimental (HELEX) program being studied in Germany is to develop a multimegawatt laser-based missile and antiaircraft defense system.5 The HELEX system uses a CO2 laser that is mounted on top of a tracked armored vehicle such as a Leopard 2 tank. The HELEX laser beam is read more..

  • Page - 411

    396 CHAPTER 14 ■ LASERS The power density, I, is typically expressed in units of W/cm2 and is equal to the power of the laser beam, P, in W divided by the area of the beam, A, that strikes the target. The absorbed energy can be expressed in terms of the beam power and area. The energy absorbed by the target in Equations (14.4) and (14.5) is read more..

  • Page - 412

    CH A P T E R 1 4 ■ LASE RS 397 Let’s go through the process of determining how long it will take the Space Based Laser to destroy an enemy missile. The average power of the laser will be assumed to be 7.5 MW, and the diameter of the beam when it strikes the target will be assumed to be 70 cm. If the energy density required to destroy the read more..

  • Page - 413

    398 CHAPTER 14 ■ LASERS Figure 14-8. A typical Laser Simulation screen shot When the Start button is clicked, the actionPerformed method declared in the LaserSimulator class is called. The process followed by this version of the method is similar to that of the other sample games presented in this book. Values for the laser beam power, radius, and absorption read more..

  • Page - 414

    CH A P T E R 1 4 ■ LASE RS 399 // Start the airplane using a Timer object. gameTimer.start(); } The target point of the laser is stored in two fields named laserX and laserZ. Clicking or dragging the mouse to a new location on the screen changes the value of the laserX and laserZ fields. When the mouse is clicked or read more..

  • Page - 415

    400 CHAPTER 14 ■ LASERS // The airplane cartoon moves across the screen at a // constant velocity of 20 pixels/second. airplaneX = airplaneX + 20.0*timeIncrement; // Update the display. updateDisplay(); If the elapsed time that the laser has been in contact with the airplane exceeds the time read more..

  • Page - 416

    CH A P T E R 1 4 ■ LASE RS 401 The key issues with “personal” military lasers are how to generate the required power and how to keep them cool enough so they don’t cook the person carrying it. As long as you can come up with a reasonably plausible technology explanation to accomplish those two objectives, your futuristic laser systems should pass the read more..

  • Page - 417

    402 CHAPTER 14 ■ LASERS • The power, range, weight, and other specifications of land-, air-, and space-based military laser systems. • How laser damage is assessed based on the total energy absorbed by the target. The absorption is a factor of the laser power, the area of the beam, an absorption factor, and the duration of the beam. • That laser beams are read more..

  • Page - 418

    403 ■ ■ ■ CHAPTER 15 Probabilistic and Monte Carlo Simulations As you probably know, there is a lot of randomness in the world. If a golfer hits a golf ball ten times, chances are it will wind up in ten different locations when it comes to rest. At the same time, there is often some structure to the randomness. While the temperature on any given day will read more..

  • Page - 419

    404 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS • The Gaussian distribution—the most commonly used probability function • Other probability functions • Monte Carlo simulations and how they can be used to simulate the behavior of large systems • How Monte Carlo simulations can be used to simulate crowd behavior • Using Monte Carlo techniques to read more..

  • Page - 420

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 405 // Create a Random object to generate random // numbers. The object is seeded with the time // in milliseconds since Jan 1, 1970. Random random = new Random(); double x; // Retrieve 8 floating-point random numbers read more..

  • Page - 421

    406 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS an equal chance that any of the six sides will be face up. In this case, the probability function is a straight line. What Equation (15.1) says is that there is an equal probability, f(x), of any of the six possible die rolls and that the probability of any particular value being rolled is read more..

  • Page - 422

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 407 There are some other important plots that can be generated based on a given probability function. For example, the cumulative distribution function is the integral (the area under the curve) of the probability function. The cumulative distribution function indicates the probability that read more..

  • Page - 423

    408 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS Figure 15-3. An inverse cumulative distribution function Gaussian Distribution Now that we’ve learned some general concepts about probability functions, let’s learn about some specific types of probability functions. One of the most commonly used probability functions is the Gaussian or normal distribution. read more..

  • Page - 424

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 409 Figure 15-4. The effect of standard deviation on the Gaussian distribution curve For the Gaussian and any other normal distributions, the standard deviation also indicates how close a value is likely to be to the mean value of the curve. If values are selected randomly according to the read more..

  • Page - 425

    410 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS An x-value computed from Equation (15.3) can be converted to another μ and σ value using the following equation: For example, let’s say we want to compute the x value for a Gaussian distribution with a mean value of 10 and a standard deviation of 2 when the probability value, p, is 0.4. read more..

  • Page - 426

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 411 include nuclear reactions, stellar evolution, and low-density airflow over spacecraft reentering the earth’s atmosphere. ■Tidbit The term “Monte Carlo” was introduced by one of the pioneers of probabilistic methods, Stanislaw Marcin Ulam, in honor of his uncle, who was a gambler read more..

  • Page - 427

    412 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS independently of each other, but their behavior will tend to follow the trends defined by the probability function. As an example, let’s write a simple Monte Carlo simulation to model an army of soldiers charging across the field. The simplest approach to use in this situation is to have all of read more..

  • Page - 428

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 413 Figure 15-6. The soldiers charge at different speeds. As the simulation progresses, the soldiers continue to charge and, as shown in Figure 15-7, the separation between them becomes more and more random. The speed of any individual soldier at any given time is determined according to read more..

  • Page - 429

    414 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS The Soldier Game makes use of two classes. The first is the Soldier class that represents an individual soldier. In this case, the data model for the soldier is quite simple. The class declares fields that represent the x- and y-location of the soldier and the speed that the soldier is read more..

  • Page - 430

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 415 The GUI for the Soldier Game is defined in the SoldierGame class. As with the other GUI classes in this book, we won’t go over every detail of the SoldierGame class but instead focus on the Monte Carlo aspects of the code. The complete SoldierGame class code listing can read more..

  • Page - 431

    416 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS The Start button is associated with an event listener (the SoldierGame class itself). When the Start button is pressed, the actionPerformed method is called. This method calls the start method on the Timer object that was declared in the class. // The actionPerformed() method is called when read more..

  • Page - 432

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 417 // Find the speed corresponding to the random // number using the Gaussian distribution with a // mean value of 0 and a standard deviation of 1. t = Math.sqrt( Math.log(1.0/(x*x)) ); read more..

  • Page - 433

    418 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS The graphics in the Soldier Game are primitive, but the probabilistic simulation of the physics of a group of charging soldiers is real. The soldiers are acting independently of each other, but the behavior of the group (for example, the speed of the group) will be more or less equal to the read more..

  • Page - 434

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 419 Like all Monte Carlo simulations, the accuracy of π as computed by Equation (15.10) increases with an increasing number of sample points. And because Monte Carlo simulations are prob- abilistic, a different answer will be obtained every time the simulation is run. The difference read more..

  • Page - 435

    420 CHAPTER 15 ■ P ROBABILISTI C AND MO NTE CARLO SIMULATIONS The actionPerformed method then creates the sample points using random numbers generated by the Random object. The location of the sample points is displayed in the panel on the right-hand side of the GUI display. // Create the sample points. Generate // two random numbers read more..

  • Page - 436

    CH A P T E R 1 5 ■ PRO BA BILISTIC AND MONTE CARLO SIMULATIO N S 421 In effect what the PiEstimator class is doing is computing the area of the circle. Monte Carlo methods aren’t limited to circles. They can be used to compute the area under (that is, integrate) any function. The PiEstimator class represents a simplistic Monte Carlo simulation in read more..

  • Page - 437

    423 INDEX ■A acceleration see also angular acceleration; gravitational acceleration; rotational acceleration; translational acceleration car racing simulations, 217, 222 derivatives, 17, 18 English System unit of, 23 equations of motion, 53 force and, 50 gravitational force, 26 Kawasaki 800 SX-R, 269 location and, 51 modeling for boats, 258–261 Newton’s second law of motion, 23 SI unit of, read more..

  • Page - 438

    424 ■INDEX air density of air and water, 249 Airborne Laser (ABL), 393–394 airfoils, airplanes aerodynamic center, 310 angle of attack, 279 camber line, 278 chord line, 278 creating lift, 279 evaluating airfoil lift, 280 Flight Simulator, 306 incidence angle, 279 leading edge, 278 lift, 278 center of pressure, 284 trailing edge, 278 airplane terminology, 276–277 aileron, 277 airfoil, 278 read more..

  • Page - 439

    425 ■INDEX arrays see matrices arrows ballistic impacts, 351 on animals, 356 body wounds, 358 Monte Carlo simulations, 411 projectile motion, 136–137 aspect ratio, airplanes, 277 atmospheric measurements, calculating, 327 altitude effects, 332 USatm76 class, 338 atoms, 386–389 autoignition temperature, 372 automatic transmission car racing simulations, 220 automobile brief history of, 212 axis read more..

  • Page - 440

    426 ■INDEX nautical terminology, 245 beam, 246 bow, 246 displacement, 246 draft, 246 hull, 246 jib, 269 keel, 269 knot, 246 mainsail, 269 mast, 269 port, 246 starboard, 246 stern, 246 transom, 246 physics of sailing, 269–270 physics of surfing, 270–273 references for further reading, 273 speedboat simulations, 261–267 velocity and propeller pitch, 252 BoatSimulator class, 265 resetDisplay read more..

  • Page - 441

    427 ■INDEX center of gravity aerodynamics, airplanes, 297 center of mass rigid body motion, 73–74 rolling motion, 76 sailboat, 270 surfing, 271 center of rotation moments, 310 center of pressure airfoils, airplane lift, 284 centripetal force, 38–39 physics and programming, 4 Rocket Simulator, 336 satellites, 342 summarized, 46 Cessna 172 Skyhawk airplane drag, 295 airplane thrust, 289 drag read more..

  • Page - 442

    428 ■INDEX coordinate axes rotations rigid body motion, 75 rotation matrices, 14 coordinate systems, 9–10 Cartesian coordinate system, 9 conversion between Cartesian and spherical, 10 origin, 10 rotating by an angle, 151 spherical coordinate system, 9, 10 two-dimensional collision example, 153 coupled equations, 59 crosswind see wind effects crowd behavior Monte Carlo simulations, 411–418 read more..

  • Page - 443

    429 ■INDEX drag equation, 294 Flight Simulator, 307 form drag, 292 induced drag, 293 lift over drag ratio, 295 parasitic drag, 292 pressure drag, 292 skin friction drag, 292 total drag equation, 294 wing aspect ratio, 294 boats, 248, 254–258 determining water contact area, 257 form drag, 256 skin friction drag, 255 wave drag, 256 car racing simulations, 221 Car class, 231 read more..

  • Page - 444

    430 ■INDEX equations of motion acceleration equations, 85 aerodynamic drag, 104–105 basic concepts of projectile motion, 84 constant gravitational force, 53 force equations, 85 gravity-only projectile model, 97 wind effects on projectile motion, 115 error function solving heat conduction equation, 362 getErrorFunction method, GasTank class, 366 escape velocity, orbits, 343 Euler angle rotation read more..

  • Page - 445

    431 ■INDEX springs, 37–38 types of, 25–39 variable magnitude force, 33 form drag airplane drag, 292 hydrodynamic drag, 256 Fountain Lightning modeling boat acceleration and velocity, 259 acceleration profile, 260 speedboat simulations, 261 FountainLightning class getRightHandSide method, 264 Powerboat class, 263 Fourier’s law, 359 fourth order Runge-Kutta method fundamentals of, 58 initial value read more..

  • Page - 446

    432 ■INDEX getLocationAndVelocity method Powerboat class, 262 getRightHandSide method Car class, 231 DragProjectile class, 109 FountainLightning class, 264 GolfBall class, 180 ODE class, 61, 62 Powerboat class, 263 PropPlane class, 305 SimpleProjectile class, 91 SimpleRocket class, 338, 339 SoccerBall class, 196 SpinProjectile class, 127 SpringODE class, 65 WindProjectile class, 117 getTemperature method read more..

  • Page - 447

    433 ■INDEX gunpowder, 373 guns projectile motion of bullets, 134–135 gyroscopic precession motorcycle racing simulations, 241 ■H hand grenade modeling fragmentation devices, 380 headwind see wind effects heat conduction, 358–369 Fourier’s law, 359 Gas Tank Simulator, 364–369 heat conduction equation, 360–361 1-D heat conduction equation, 360, 361 Gas Tank Simulator, 365 solving, 361–363 read more..

  • Page - 448

    434 ■INDEX ■K Kawasaki 800 SX-R, 269 keel, boats, 269 kinematics, 49–80 see also projectile motion bowling ball kinematics, 77 kinetic coefficient of friction, 34 kinetic energy, 43–44 elastic and inelastic collisions, 142 knot, boats, 246 Kutta, Martin, 56 ■L laminar flow aerodynamic drag, 103–104 Reynolds number, 104 soccer ball in flight, 191 land mines modeling fragmentation read more..

  • Page - 449

    435 ■INDEX location equations aerodynamic drag, 107 ■M Magnus effect/force effects of spin on flight of baseball, 207 golf ball in flight, 176–178 Golf Game, 184 soccer ball in flight, 194 spin effects on projectile motion, 123–125 directional components, 125 Maiman, Theodore, 386 mainsail, boats, 269 manual transmission car racing simulations, 220 maser, 386 mass center of mass, read more..

  • Page - 450

    436 ■INDEX nautical terminology see under boats neodymium-Yag laser, 392 neutrons, 386 Newton, Isaac, 22 Newton’s laws of motion basic concepts of projectile motion, 84 first law of motion, 22–23 gravitational force, 25 second law of motion, 23–24 angular acceleration, 72 center of mass, 73 conservation of linear momentum, 141 creating lift, 279 force, acceleration, velocity, and read more..

  • Page - 451

    437 ■INDEX payloads delivering into orbit, 344 rocket terminology, 321 performance effect of using physics, 3 performance data modeling acceleration/velocity for boats, 258 photons, 387, 388, 389 description, 385 lasers, 389 wavelength of, 389 physics, reasons to use achieving realism, 2 avoiding unrealistic looking games, 1 game performance, 3 improved programming, 4 Pi computing value of, 418 read more..

  • Page - 452

    438 ■INDEX propellers airplane thrust, 285–290 altitude effects, 288 Cessna 172 Skyhawk, 289 engine brake power, 286 power drop-off factor, 288 propeller advance ratio, 286 propeller efficiency coefficient, 286 boat thrust, 251, 253 pitch, 252 propeller advance ratio, 286 propeller efficiency coefficient, 285, 286 PropPlane class Flight Simulator, 302 get/set methods, 305 getRightHandSide method, read more..

  • Page - 453

    439 ■INDEX rolling friction Car class, 231 car racing simulations, 221 golf simulation, 187 rolling motion, 75 rotation matrices, 13 coordinate axes rotations, 14 Euler angle, 14 rotational acceleration basic concepts of projectile motion, 84 rolling motion, 77 rotational axis for common objects, 73 rotational motion, 69–73 angular acceleration, 70 angular velocity, 70 axis of rotation, 71 read more..

  • Page - 454

    440 ■INDEX gravity-only model, 88–91 getRightHandSide method, 91 ODE class, 89 updateLocationAndVelocity method, 90, 95 SimpleRocket class get/set methods, 337 getRightHandSide method, 338, 339 Rocket Simulator, 336 simulations baseball, 204–207 basketball, 199–204 car racing, 212–240 crowd behavior, 411–418 flight, 301–310 football, 208 Gas Tank Simulator, 364–369 golf, 167–189 hockey, 209 jet read more..

  • Page - 455

    441 ■INDEX springs, 37–38 forces, 37, 38 Hooke’s Law, 37 motion of spring as function of time, 19 solving higher-order ODEs, 58 spring motion example, 63–67 spring motion simulator, 67–69 stability, airplanes, 313–314 dynamic stability, 315–316 pitch stability, 313 stability and trim, 314–315 static stability, 315 stability, rockets, 333 stabilizers horizontal stabilizer, 277 vertical read more..

  • Page - 456

    442 ■INDEX Timer object actionPerformed method, 121 BeanBag class, 54 car racing simulations, 234 GasTankSimulator class, 367 Golf Game, 91, 95 Gravity Game, 29, 30 LaserSimulator class, 398 Shuffleboard Game, 35 SoldierGame class, 415 speedboat simulations, 261 SphereCollision class, 148 SpringSimulator class, 68 TNT (trinitrotoluene), 374 TNT equivalence model blast damage, 378 TNT explosion read more..

  • Page - 457

    443 ■INDEX ■V variable magnitude force, 33 vector cross product, 12 vectors, 10–12 computing magnitude of vector, 11 force vector, 24 indicating in an equation, 11 indicating that terms are, 50 location, 51 unit vector, 11 vector cross product, 12 velocity, 50 Vee drives boat thrust, 251 velocity see also translational velocity acceleration and, 50 acceleration data for Kawasaki 800 read more..

  • Page - 458

    444 ■INDEX ■Y yaw, airplanes, 277 aerodynamics, 297 yaw angle projectile motion of bullets, 134 ■Z z-direction, 52 read more..

Write Your Review