logo资料库

Game Physics Second Edition.pdf

第1页 / 共942页
第2页 / 共942页
第3页 / 共942页
第4页 / 共942页
第5页 / 共942页
第6页 / 共942页
第7页 / 共942页
第8页 / 共942页
资料共942页,剩余部分请下载后查看
9780123749031
01
Copyright
02
Dedication
03
Trademarks
04
List of Figures
05
List of Tables
06
Preface to the Second Edition
07
Preface to the First Edition
08
About the CD-ROM
Ch 01
1 Introduction
A Brief History of the World
A Summary of the Topics
Examples and Exercises
Ch 02
2 Basic Concepts from Physics
Rigid Body Classification
Rigid Body Kinematics
Single Particle
Particle Systems and Continuous Materials
Newton's Laws
Forces
Gravitational Forces
Spring Forces
Friction and Other Dissipative Forces
Torque
Equilibrium
Momenta
Linear Momentum
Angular Momentum
Center of Mass
Moments and Products of Inertia
Mass and Inertia Tensor of a Solid Polyhedron
Energy
Work and Kinetic Energy
Conservative Forces and Potential Energy
Ch 03
3 Rigid Body Motion
Newtonian Dynamics
Lagrangian Dynamics
Equations of Motion for a Particle
Time-Varying Frames or Constraints
Interpretation of the Equations of Motion
Equations of Motion for a System of Particles
Equations of Motion for a Continuum of Mass
Examples with Conservative Forces
Examples with Dissipative Forces
Euler's Equations of Motion
Ch 04
4 Deformable Bodies
Elasticity, Stress, and Strain
Mass–Spring Systems
One-Dimensional Array of Masses
Two-Dimensional Array of Masses
Three-Dimensional Array of Masses
Arbitrary Configurations
Control Point Deformation
B-Spline Curves
NURBS Curves
B-Spline Surfaces
NURBS Surfaces
Surfaces Built from Curves
Free-Form Deformation
Implicit Surface Deformation
Level Set Extraction
Isocurve Extraction in 2D Images
Isosurface Extraction in 3D Images
Ch 05
5 Fluids and Gases
Vector Calculus
Gradient, Directional Derivative, and Total Derivative
Vector Fields, Divergence, and Laplacian
Curl
Line Integrals
Surface Integrals and Stokes' Theorem
Volume Integrals and the Divergence Theorem
Green's Theorem, Laplace's Equation, and Poisson's Equation
Vector Field Decomposition
Strain and Stress
Strain Tensor
Stress Tensor
The Relationship Between Strain and Stress
Conservation Laws
Conservation of Mass
Conservation of Momentum
A Simplified Model for Fluid Flow
Implementing the Simplified 2D Model
The Density Equation
The Diffusion Term
The Advection Term
The Source–Sink Term
The Total Density Update
The Velocity Equations
Specialized Boundary Handling
Implementing the Simplified 3D Model
Variations of the Simplified Model
Vorticity Confinement and Vortex Particles
Separate Pressure Term
Omit Diffusion Terms
Density and Velocity Dissipation
Include Temperature
Compressible Flow
Obstacles in the Fluid Region
Moving Boundaries and Multiple Fluids
Finding Papers on Fluid Simulation
Ch 06
6 Physics Engines
The Physics Tick
Collision Culling
Culling with Bounding Spheres
Culling with Axis-Aligned Bounding Boxes
AABB Culling in a Single-Threaded Environment
AABB Culling Using a Separate Core of a CPU
AABB Culling Using a Specialized Processor
Test-Intersection Queries
Spheres
Capsules
Ellipsoids
Cylinders
Collision Detection with Convex Polyhedra
The Method of Separating Axes
Stationary Objects
Objects Moving with Constant Linear Velocity
Oriented Bounding Boxes
Boxes Moving with Constant Linear and Angular Velocity
GJK Algorithm
Unconstrained Motion
Acceleration-Based Constrained Motion
Collision Points
Collision Response for Colliding Contact
Collision Response for Resting Contact
An Illustrative Implementation
Lagrangian Dynamics
Velocity-Based Constrained Motion
Constraint on a Particle
Constraints on a Particle System
Constraint on a Rigid Body
Constraints on a Rigid Body System
Comments and Variations on the Algorithm
Variations
Ch 07
7 Linear Algebra
A Review of Number Systems
The Integers
The Rational Numbers
The Real Numbers
The Complex Numbers
Fields
Systems of Linear Equations
A Closer Look at Two Equations in Two Unknowns
Gaussian Elimination and Elementary Row Operations
Nonsquare Systems of Equations
The Geometry of Linear Systems
Numerical Issues
Iterative Methods for Solving Linear Systems
Matrices
Some Special Matrices
Elementary Row Matrices
Inverse Matrices
Properties of Inverses
Construction of Inverses
LU Decomposition
Vector Spaces
Definition of a Vector Space
Linear Combinations, Spans, and Subspaces
Linear Independence and Bases
Inner Products, Length, Orthogonality, and Projection
Dot Product, Cross Product, and Triple Products
Orthogonal Subspaces
The Fundamental Theorem of Linear Algebra
Projection and Least Squares
Linear Transformations
Advanced Topics
Determinants
Eigenvalues and Eigenvectors
Eigendecomposition for Symmetric Matrices
S + N Decomposition
Applications
Ch 08
8 Affine Algebra
Introduction
Coordinate Systems
Subspaces
Transformations
Barycentric Coordinates
Triangles
Tetrahedra
Simplices
Length, Area, Volume, and Hypervolume
Ch 09
9 Calculus
Univariate Calculus
Limits
Limits of a Sequence
Continuity
Differentiation
L'Hôpital's Rule
Integration
Multivariate Calculus
Limits and Continuity
Differentiation
Integration
Applications
Optimization
Constrained Optimization
Derivative Approximations by Finite Differences
Ch 10
10 Quaternions
Rotation Matrices
The Classical Approach
Algebraic Operations
Relationship of Quaternions to Rotations
A Linear Algebraic Approach
Interpolation of Quaternions
Spherical Linear Interpolation
Spherical Quadratic Interpolation
Derivatives of Time-Varying Quaternions
Ch 11
11 Differential Equations
First-Order Equations
Existence, Uniqueness, and Continuous Dependence
Second-Order Equations
General-Order Differential Equations
Systems of Linear Differential Equations
Equilibria and Stability
Stability for Constant-Coefficient Linear Systems
Stability for General Autonomous Systems
Ch 12
12 Ordinary Difference Equations
Definitions
Linear Equations
First-Order Linear Equations
Second-Order Linear Equations
Constant Coefficient Equations
Systems of Equations
Ch 13
13 Numerical Methods
Euler's Method
Higher-Order Taylor Methods
Methods via an Integral Formulation
Runge–Kutta Methods
Second-Order Methods
Third-Order Methods
Fourth-Order Method
Multistep Methods
Predictor–Corrector Methods
Extrapolation Methods
Richardson Extrapolation
Application to Differential Equations
Polynomial Interpolation and Extrapolation
Rational Polynomial Interpolation and Extrapolation
Modified Midpoint Method
Bulirsch–Stoer Method
Verlet Integration
Forces Without a Velocity Component
Forces with a Velocity Component
Simulating Drag in the System
Leapfrog Method
Velocity Verlet Method
Gear's Fifth-Order Predictor-Corrector Method
Numerical Stability and its Relationship to Physical Stability
Stability for Single-Step Methods
Stability for Multistep Methods
Choosing a Stable Step Size
Stiff Equations
Ch 14
14 Linear Complementarity and Mathematical Programming
Linear Programming
A Two-Dimensional Example
Solution by Pairwise Intersections
Statement of the General Problem
The Dual Problem
The Linear Complementarity Problem
The Lemke Algorithm
Zero Constant Terms
The Complementary Variable Cannot Leave the Dictionary
Mathematical Programming
Karush–Kuhn–Tucker Conditions
Convex Quadratic Programming
General Duality Theory
Applications
Distance Calculations
Contact Forces
Bibliography
Bibliography
Color Plates
Color Plates
Index
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Morgan Kaufmann is an imprint of Elsevier 30 Corporate Drive, Suite 400, Burlington, MA 01803, USA The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, UK Copyright © 2010, Elsevier Inc. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher. Details on how to seek permission, further information about the Publisher’s permissions policies and our arrangements with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions. This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted herein). Notices Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary. Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility. To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors assume any liability for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the material herein. Library of Congress Cataloging-in-Publication Data Eberly, David H. Game physics / David H. Eberly. – 2nd ed. p. cm. Includes bibliographical references and index. ISBN 978-0-12-374903-1 (hardcover : alk. paper) 1. Computer games–Programming. 2. Physics–Computer simulation. 3. Computer graphics. 4. Three-dimensional display systems. I. Title. QA76.76.C672E24 2010 794.8’1526–dc22 2009049828 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library. ISBN: 978-0-12-374903-1 For information on all Morgan Kaufmann publications visit our Web site at www.elsevierdirect.com Typeset by: diacriTech, India Printed in the United States of America 10 9 8 7 6 5 4 3 2 1 10 11 12 13
Dedication After surgery for Stage 4 gallbladder cancer, aggressive chemotherapy, and radiation treatments, it was not clear I would ever have a chance to write the second edition of this book. My survival is a testament to the advances that modern medicine has made. The unselfish caregiving by my loving wife, Shelly, her support through difficult times, and her encouragement for me to recover and continue writing are things for which I am extremely grateful. I have finished this book and look forward to writing many more with her at my side. v
Trademarks The following trademarks, mentioned in this book and the accompanying CD-ROM, are the property of the following organizations. ■ DirectX, Direct3D, Visual C++, DOS, Windows, and Xbox 360 are trademarks of Microsoft Corporation. ■ Playstation 3 is a trademark of Sony Corporation. ■ OpenGL is a trademark of Silicon Graphics, Inc. ■ Radeon is a trademark of ATI Technologies, Inc. ■ NVIDIA, GeForce, PhysX, and the Cg Language are trademarks of NVIDIA Corporation. ■ NetImmerse and R-Plus are trademarks of Numerical Design, Ltd. ■ MathEngine is a trademark of Criterion Studios. ■ The Havok physics engine is a trademark of Havok.com Inc. ■ SoftImage is a trademark of Avid Technology, Inc. ■ Prince of Persia 3D is a trademark of Brøderbund Software, Inc. ■ XS-G and Canyon Runner are trademarks of Greystone Technology. ■ Mathematica is a trademark of Wolfram Research, Inc. ■ Turbo Pascal is a trademark of Borland Software Corporation. ■ The 8086 and Pentium are trademarks of Intel Corporation. ■ Macintosh and Xcode are trademarks of Apple Corporation. ■ Gigi and VAX are trademarks of Digital Equipment Corporation. ■ MASPAR is a trademark of MasPar Computer Corporation. xvii
Figures Color Plates 3.3 3.7 3.14 3.25 4.2 4.4 4.6 4.7 4.15 4.17 4.18 4.19 4.20 4.29 5.4 5.5 The Foucault pendulum. A ball rolling down a hill. A mass pulley spring system shown at two different times. Two snapshots of a freely spinning top. A rope modeled as a linear chain of springs. A cloth modeled as a rectangular array of springs. A gelatinous cube that is oscillating because of random forces. A gelatinous blob that is oscillating because of small, random forces. A skirt modeled by a generalized cylinder surface. A water drop modeled as a control point surface of revolution. A closed tube surface whose central axis is a helix. A wriggling snake modeled as a tube surface whose central curve is a control point curve. Free-form deformation. A bouncing ball with deformation based on implicit surfaces. Image (a) [upper left]: The initial density is generated by a uniform random number generator. Image (b) [upper right]: The evolved density after a small period of time. The only force is due to a spike of wind moving from the left-center of the grid. The bright blob-like region is a density source. The dark blob-like region is a density sink. Image (c) [lower left]: Starting from the random initial density, eight vortices were added to the grid. They are shown in white in the equivalent gray-scale image of Figure 5.4; the direction of rotation is indicated by the arrows. You can see the swirl-like effects of the vortices. Image (d) [lower right]: The grid of image (c) is allowed to evolve further. The density source and sink are more pronounced, and the density is starting to become more homogeneous in regions centered at the vortices. Image (a) [upper left]: The initial density is a spherical blob of constant density. Image (b) [upper right]: The evolved density after a small period of time. The only force is due to a spike of wind moving from the right-center of the grid; the scene has been rotated slightly so you can see the portion of the sphere on which the wind interacted first. There are no density sources or sinks. You can see the material being pushed out of the sphere by the wind. Image (c) [lower left]: Eight vortices were added to the grid, which causes the density to swirl xix
xx Figures 5.6 around a bit. The scene was rotated so you can see the tunnel carved out by the wind. Image (d) [lower right]: The lower-left grid is allowed to evolve further. Image (a) [top] shows the initial 128× 128× 64 gray scale image (a CT image). The boundary voxels are drawn in light gray. The z = 0 slice is the upper left tile. The z = 63 slice is the lower right tile. Image (b) [bottom] shows the 3D image after a number of blurring operations. Figures in Chapters 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 A couple of coordinate systems at points on a curve. A polar coordinate frame at a point on a curve. A curve, a tangent vector at a point, and the circle of choices for the normal vector. The circle lies in the plane containing the point and perpendicular to the tangent. Cylindrical coordinates (x, y, z) = (r cos θ, r sin θ, z). Spherical coordinates (x, y, z) = (ρ cos θ sin φ, ρ sin θ sin φ, ρ cos φ). Motion of a particle about a fixed axis, a constant distance from the axis. (a) The body coordinate system as seen by the body observer. (b) The body coordinate system as seen by the world observer. Gravitational forces on objects located at various places around the Earth. Gravitational forces on objects located nearly on the Earth’s surface, viewed as a flat surface. (a) Unstretched spring. (b) Force due to stretching the spring. (c) Force due to compressing the string. A block in contact with an inclined plane. (a) Static friction is dominant and the block remains at rest. (b) Gravity is dominant and the block slides, so kinetic friction applies. Torque from a force exerted on a particle. A force couple. (a) All forces applied to a point mass are concurrent but are not balanced, so the point moves. (b) All forces are concurrent but do balance, so the point does not move. (c) A rigid rod with noncon- current forces applied to the endpoints. The forces are equal in magnitude but opposite in direction. The rod rotates about its center. (d) Nonconcurrent forces are applied to three locations, two forces of equal magnitudes and directions at the endpoints and one force of twice the magnitude of an endpoint force but opposite in direction applied to the rod center. The rod is balanced and does not rotate about its center. 16 18 20 22 24 25 28 32 33 34 35 36 37 38
Figures xxi 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 3.1 3.2 3.3 3.4 3.5 3.6 3.7 Balancing discrete masses on a line. The center of mass for two masses viewed as the balance point for a seesaw on a fulcrum. Balancing continuous masses on a line. The center of mass for the wire is viewed as the balance point for a seesaw on a fulcrum. A general point location x is shown, labeled with its corresponding mass density δ(x). Balancing discrete masses in a plane. Balancing discrete masses in a plane on a fulcrum. Balancing continuous masses in a plane. The shades of gray indicate variable mass density. A continuous mass bounded by a parabola and a line. A continuous mass in the shape of a hemicircle. A force applied to a particle traveling on a straight line from position x0 to x1. The infinitesimal area dA swept out by motion of the earth over an infinitesimal change in position dr. The swept region is effectively a triangle whose sides are r and r+ dr. The Foucault pendulum. The pendulum joint is at O, the mass is m and is attached to the pendulum rod of length L. The gravitational force acts in the direction k, a unit-length vector from the joint to the center of the Earth. The Foucault pendulum. The figures show the path of the pendulum tip in the horizontal plane. New points on the path are colored white, but the intensity of the older points along the path gradually decreases. The simple pendulum. The motion is constrained to a plane. The mass is located at position X (t ) at time t and is always a fixed length L from the joint P. The angle formed by the pendulum rod with the vertical is θ (t ). The curve of motion is a circle with tangent T(t ) and outward pointing normal N(t ). The only force acting on the mass is gravitational, −mg j , where m is the mass of the particle, g is the gravitational constant, and −j is the direction of the force (vertically downward). The joint P provides no frictional force. A ball of mass m on a flat table. A rubber band connects the ball to a fixed point on the table. The force F due to the rubber band is shown. The position x of the ball is shown together with its velocity ˙x. A ball is at the top of a frictionless hill. With a small push, the ball will roll down the hill. A ball rolling down a hill. Image (b) shows the path of the center of the ball as it rolls down the hill. The ball rotates at a speed commensurate with its downhill velocity. (See also Color Plate 3.7.) 43 44 45 46 47 48 49 78 88 92 95 99 104 105 108
xxii Figures 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 4.1 4.2 4.3 (a) A metal chute of length L, one end attached to the origin, the other end raised by a height H . (b) Side view of the chute. The initial configuration of a rigid rod containing a mass that is attached to a spring. Three masses aligned vertically and subject to gravitational force. A modification of the simple pendulum problem. A triangle pendulum. A system consisting of two masses, a pulley with mass, and a spring. A mass pulley spring system shown at two different times. The spring expands and compresses and the pulley disk rotates during the simulation. The system stops when a mass reaches the center line of the pulley or the ground. (See also Color Plate 3.14.) A system of two pulleys, two springs, and a mass. A physical system with a bent pipe rotating about the z-axis and a disk rotating about its axis. A solid disk that rolls on a rough, inclined plane. A simple diving board. An inclined plane that forms an angle φ with the horizontal. The particle has mass m. It is located at r0 = (x0, y0, z0); hash marks are shown on the axes corresponding to x0, y0, z0, and w0, where y0 = w0 cos φ and z0 = w0 sin φ. Two particles, connected by a massless rod, that slide along a rough plane. A flat board on a rough plane. A side view of a solid box on a rough, inclined plane. The world coordinates and body coordinates for a rigid body where both systems have the same origin. A freely spinning top with tip fixed at the origin of the world coordinate system. Two snapshots of a freely spinning top. The black line is the vertical axis. The white line is the axis of the top. (See also Color Plate 3.25.) Two curve mass objects represented as mass–spring systems. A rope modeled as a linear chain of springs. Image (a) shows the rope at rest with only gravity acting on it. Image (b) shows the rope subject to a wind force whose direction changes by small random amounts. (See also Color Plate 4.2.) A surface mass represented as a mass–spring system with the masses organized as a two-dimensional array. 109 114 116 118 121 122 125 125 126 128 129 137 138 144 146 148 150 154 159 161 162
分享到:
收藏