?? http:^^www.tc.cornell.edu^visualization^education^cs417^sections^dynamics.html
字號(hào):
Date: Mon, 16 Dec 1996 23:40:02 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Wed, 28 Feb 1996 13:45:23 GMTContent-length: 14462<html><head><title>dynamics</title></head><body><h2>Using forces to animate objects</h2><hr><b> Introduction </b> <p>There are several good reasons why you may want to compute motion of objectsbased on forces, rather than attempt a kinematic description of object motion.<ul><li> It is often easier to write an expression for the forces on an object(a differential equation) than it is to directly describe the motion.<li> Dynamic systems based on forces evolve "automatically" so than the motionis physically correct (given the correct equations). This automatic behaviorrelieves the animator of attention to lots of boring detail.<li> For chaotic systems it is impossible to write a kinematic description.</ul><hr><b> Background </b> <p>The basis of many particle systems is a description of the accelerationof the particles. If the accelerations are given, then thesystem is called second order because two integrations must be done to get the positions. <p>As an example, consider a mass on the end of a spring sliding on a frictionless horizontal table. the forceon the mass is given by: <p> <code>F = -k*x </code> <p>where F is the force, k is the spring constant and x is the length of the spring.The negative sign appears because the force from a spring pulls in theopposite direction to the spring extension.<p>Since <code> F = m*a </code> where <code> a </code> is the acceleration, <p> <code>a = -(k/m)*x </code> <p>Now given the acceleration, and if we know an initial velocity and position, we can find the position of the mass at any later time. In the case ofthis linear spring, we can integrate the acceleration directly to findthat the position is a sinusoidal function of time. The constant <code> (k/m)</code> will determine the frequency of the sinusoidal function, whilethe initial position, x0, and velocity, v0, will determine the amplitude andphase [5]. The position is given by: <p><!WA0><!WA0><!WA0><!WA0><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.spring.gif"><p>In this simple case, the solution is available, so one could code akinematic solution (that is, just plug time into the sin function), butnotice that the description of the system in differential form is morecompact and straightforward. Also if we changed the force to a morerealistic "stiff spring" model such as:<code> <p>F = -k*x - c*x^3 </code> <p>we could not directly integrate it, butwould be forced to use numerical methods. The next section will considerhow to perform the integration.<hr><b> Numerical integration </b> <p>Solving a dynamic system means figuring out how to move the system forward intime from some set of initial conditions to compute the positions as a function of time. For instance you might want of trace the trajectory of a ball after it is fired from a cannon. In general,direct analytical solutions of the differential equations governing a system are hard or impossible. We will outline some techniques forsolving a system by simple (but perhaps not optimal) numerical methods.<p>As a disclaimer, it is difficult to construct generalnumerical schemes that work for various physical systems. What follows isa specific approach which works for some systems. Consider it the barestintroduction to the topic of numerical introduction. Much more detailmay be obtained in [1] or [3] or many other books.<p>We will consider three specific second order systems.<ul> <li> <!WA1><!WA1><!WA1><!WA1><a href="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.3body.mpg"> Three-body gravitation </a> <li> <!WA2><!WA2><!WA2><!WA2><a href="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.WaterWave.mpg"> Water waves </a> <li> <!WA3><!WA3><!WA3><!WA3><a href="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.billards.mpg"> Billards impact system </a></ul>For each system we will first introduce the physics (the force law) thenthe scheme to integrate the force law to produce the time-dependentpositions. We will start with a integration scheme which will be used<b> only </b> for intrducing the notion of numerical integration. Whileuseful to look at, it should almost never be used for actual work.<hr><b> The Euler integration algorithm</b><p>Let me state again that this algorithm, while easy to understand, is soinefficient that it should only be used whem programming effortdominates throughput. We want to start with a differential equation andshow how to integrate in numerically. Start with the differentialequation<p><!WA4><!WA4><!WA4><!WA4><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.dxdt.gif"> <p>We want to solve this equation by stepping time discretely forward insmall steps ("small" still needs to be defined).One discrete approximation of this equation is: <p><!WA5><!WA5><!WA5><!WA5><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.deltaxdeltat.gif"> <p>where the n and n-1 refer to two time steps sufficiently close togetherthat the differences approximate the derivitive.Rearranging this equation yields: <p><!WA6><!WA6><!WA6><!WA6><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.euler.gif"> <p>which gives a explicit form for stepping the system from time n-1 totime n. This form is thus a way to step a dynamic system forward in timegiven an initial state x0. The inefficiency of this method occursbecause of the assumption of constant f(x) across the entire time step.To be accurate the time step has to be very short compared to thenatural time constants of the system. <hr><b> The Verlet integration algorithm </b> <p>A much better alogrithm can be derived by averaging slopes across thesmall time interval of integration. One such formulation is called the velocityform of the Verlet algorithm [1]. This algorithm is most useful for secondorder systems where the force on an object is specified and the positionis desired as a function of time. Since the accelerations are specified,one integration must be done to calculate the velocity and a second doneto calculate the position.<p>The Verlet scheme is first updates the position, then use the old and newposition information to update the velocity.<p><!WA7><!WA7><!WA7><!WA7><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.verlet.gif" > <p>Where <!WA8><!WA8><!WA8><!WA8><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.anMinus1.gif" align=middle> are the accelerations calculated from a force lawdescribing the system and which are usually a function of position.Note that an is calculated from the just-completed calculation for xn. Evaluating both of these equations advances the system onetime step. To start the solution, a velocity and position have to beknown at t=0. Choosing delta t requires some care. Generally, you canstart with a time step which is around .2 of the fastest time-constantin the system.<p>The two Verlet equations can be vector equations if themotion is 2 or 3 dimensional.<p>Now we are ready to consider some specific physical systems.<hr><b> Gravitation and the three-body problem </b><p>The accleration due to a gravitating mass is <p><!WA9><!WA9><!WA9><!WA9><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.grav.gif"> <p>where G is a strength contant, M is the mass of the object pulling onyou, and r is the distance between you and M. Since a and r are actuallyvectors we must derive a form of this equation which is useful in 2 or 3dimensions. We will use 2D here so we need equations for the x and ycomponents of the acceleration. Assuming body one is located atr1 and body two is located at r2, and that we want the acceleration of body one:<p><!WA10><!WA10><!WA10><!WA10><img src="http://www.tc.cornell.edu/Visualization/Education/cs417/SECTIONS/dynamics.eqn.gravxy.gif"> <p>Where theta is the angle measured from the x-axis of the vector r pointing
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -