Web Design

Page 6

ADVANCED PHYSICS: NUMERICAL INTEGRATION The problem with this is that physical forces act continuously in the real world. The forces on an object are changing its position and velocity continuously, not in discrete jumps like that. For example, gravity would be acting continuously on a falling object, increasing its speed, thus changing its position smoothly over time. If we just apply gravity to an object and update its velocity and position once per frame, we are missing the effects of gravity and velocity for all the points in between. So the more often you update, the more accurate you are, but there’s always some discrepancy. The Euler integration solution to this discrepancy is to ignore it, so it isn’t very accurate. I can’t put it any simpler than that. Figure 6-2 shows the actual result of Euler integration calculated in one-second intervals to exaggerate the error.

Figure 6-2. Real world motion and Euler integration

Again, if you decrease the interval, you get a better result, but it will be accurate only when increased infinitely. Good luck with that. Furthermore, Euler can also get into situations in which it becomes unstable. This can happen quite easily with springs. The inaccuracies in the integration can sometimes lead to a point where the velocity keeps increasing and the whole thing blows apart. But if Euler is that bad, what are the alternatives? The two we’ll cover here are called Runge-Kutta integration and Verlet integration. Like Euler, they are named for the people who came up with them: Carl Runge, Martin Wilhelm Kutta, and Loup Verlet. As you will see, these two other methods have their strengths in different areas: Runge-Kutta is used when a higher degree of accuracy is desired, and Verlet is often used in computer graphics for creating “rag doll physics,” a sort of inverse kinematics. If that doesn’t make much sense to you now, don’t worry. When we get there, you’ll see

239


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.