Final exam date Final exam date has been announced: Dynamics III Tuesday, February 27, 2007 2:45 - 4:45pm Numerical Integration 70-1435 Projects Assignments Presentations: Assignment 1 -- Framework Most have been graded Dates: If not submitted please do so. Week 9: Wed, Feb 14 Week 10: Mon, Feb 19 Assignment 2 -- Keyframing Finals Week: Tues, Feb 27 (2:45-4:45) Due Friday, Jan 12. Questions? 15 minutes / presentation Schedule now on Web Assignment 3 -- Billiards Please send me choice of time/day To be given today Logistics Potential job opportunity Prof Raj will be teaching a course on Course Withdrawal deadline Saturdays to high school students. Friday, January 26th Looking for lab assistants 7 Saturdays thru May Please contact rkr@cs.rit.edu 1
Plan Motivation Films Physics 101 for rigid body animation Computer Animated Feature Films 35 since (and including) Toy Story Last Mon: translation and rotational dynamics 17 currently in Production Last Wed: Forces, impacts, and collisions http://www.boxofficemojo.com/genres/chart/?id=computeranimation.htm Today: Numerical integration. Major players Pixar But first… PDI/Dreamworks Blue Sky / FOX Sony Imageworks Disney Motivational Film Motivational Film Short animations by Sony Imageworks The ChubbChubbs (2002) First animated short produced by Sony Imageworks Previewed before Men in Black II. Winner of the 2002 Academy Award for best animated short. Motivational Film Plan For Today Early Bloomer (2003) Topics Started as an in-house training exercise Numerical Integration Shown at SIGGRAPH 2003. Life Beyond Euler Assignment #3 A Night at the Pool Hall 2
Laws of Motion Linear Motion Law I For Linear Physical Motion Every object in a state of uniform motion tends to remain Mass in that state of motion unless an external force is applied Measure of the amount of matter in a body to it. (Inertia) From Law II: Measure of the a body’s resistance to motion Velocity Law II: Change of motion with respect to time The acceleration of a body is proportional to the resulting Acceleration force acting on the body, and this acceleration is in the Change of velocity with respect to time same direction as the force. Force Law III: In short, force is what makes objects accelerate For every action there is an equal and opposite reaction. Momentum mass x velocity Another way of stating Law I: Momentum is conserved Rotational Motion Where we are Object properties For Rotational Physical Motion Calculate forces Inertia Position, orientation Measure of the amount/distribution of matter in a body Linear and angular velocity From Law II: Measure of the a body’s resistance to motion Linear and angular momentum Angular Velocity mass Change of rotation with respect to time Angular Acceleration Change of velocity with respect to time Torque In short, torque is what makes objects rotate Angular Momentum Update object properties Calculate accelerations Inertia x velocity Using mass, momenta Another way of stating Law I: Momentum is conserved Where we are Where we are State of object at any given time Derivative of object state position s ( t ) v ( t ) & � � � � s ( t ) � � � � � � & R ( t ) ( t ) R ( t ) rotation (in world coords) � � � � R ( t ) & � � � � S ( t ) momentum � � = = S ( t ) = & M ( t ) F ( t ) � � � � M ( t ) � � � � � � angular momentum � � & L ( t ) ( t ) � L ( t ) � � � � � � 3
Putting it all together Putting it all together Step 1 Step 1 Calculate Forces, F(t), τ (t) Calculate Forces, F(t), τ (t) Step 2 Step 2 Integrate position/rotation Integrate position/rotation s(t + Δ t) = s(t) + v(t) Δ t q(t + Δ t) = q(t) + 0.5 ( ω (t)q(t)) Δ t /* normalize to avoid problems */ s(t + Δ t) = s(t) + v(t) Δ t R(t + Δ t) = quatToRot (q(t + Δ t) ) R(t + Δ t) = R(t) + ( ω (t)*R(t)) Δ t /* CAREFUL HERE */ r(t + Δ t) = s(t + Δ t) + r body R(t + Δ t) r(t + Δ t) = s(t + Δ t) + r body R(t + Δ t) Update Momentum (integrate accelleration) Update Momentum (integrate accelleration) M(t + Δ t) = M(t) + F(t) Δ t M(t + Δ t) = M(t) + F(t) Δ t L(t + Δ t) = L(t) + τ (t) Δ t L(t + Δ t) = L(t) + τ (t) Δ t Putting It all together Numerical Integration Step 3 Problems we are considering are first Calculate velocities (for next step) order, initial value, ordinary differential v(t + Δ t) = M(t + Δ t)/m + impulse equations (ODE) I -1 (t + Δ t) = R(t + Δ t)I -1 body R(t + Δ t) T We have derivative (acceleration, velocity) ω (t + Δ t) = + I -1 (t + Δ t)L(t + Δ t) + impulse We have initial values Go to step 1 We need integral (velocity, position) Questions? Numerical Integration Numerical Integration Said another way The derivative can be seen as forming a vector field in 2 dimensions dx v f ( x t , ) � = = dt f’(t, x) = the derivate of our function at time t at point x. 4
Numerical Integration Numerical Integration And Instead we start at an initial point x(t 0 ) t Step along the field (using f’) to determine x ( t ) x ( t ) f ( t , x ) dt � = + � value at subsequent time steps 0 t 0 For most interesting cases, this integral cannot be calculate analytically Numerical Integration Numerical Integration Euler method Euler method Let Assumes average gradient over h is the gradient at time t t i+1 = t i + h then x x h f ( t , x ) = + � � i + 1 i i i Numerical Integration Numerical Integration Euler Method Taylor series expansion of a function Pros dx h 2 d 2 x h 3 d 3 x Easy x ( t h ) x ( t ) h ( t ) L + = + + + + Intuitive 2 3 dt 2 ! dt 3 ! dt Cons Error prone Can be unstable Euler All this is method stops error here 5
Numerical Integration Numerical Integration Euler is said to be a 1 st order method Note that we can improve on Euler method by reducing h dx h 2 d 2 x h 3 d 3 x x ( t h ) x ( t ) h ( t ) L + = + + + + 2 3 dt 2 ! dt 3 ! dt dx x ( t h ) x ( t ) h ( t ) O ( h 2 ) + = + + dt Numerical Integration Numerical Integration To improve, consider 2 nd order terms Problem with direct 2 nd order solutions Need both f’(t) and f’’(t) at each time to calculate f(t) 2 2 3 3 dx h d x h d x x ( t h ) x ( t ) h ( t ) Which we don’t have + = + + + + L dt 2 ! dt 2 3 ! dt 3 Recall, we are calculating v(t) by applying a first order to a(t) then calculating x(t) by applying first order to v(t) There is a way to get around this (Adams-Bashforth method), but would require several values for f(t - Δ t), f’(t - 2 Δ t), etc to calculate f(t). 2 nd order All this is method stops I.e. Not self-starting error here Numerical Integration Numerical Integration Midpoint Method Midpoint Method Assumes average gradient over h is the Let gradient at the midpoint of h t i+1 = t i + h then h x � x x h f ( t , x ) = + � � + + i 1 i i i + 2 2 6
Numerical Integration Numerical Integration Midpoint method Find midpoint But how does one calculate? x mid = x i + (h/2) f' (t i, x i ) h x We know x i � f ( t , x ) � + + i i 2 2 Derivative is Δ x / Δ t Use Euler h x x x � � f ( t , x ) mid i + + = i i h 2 2 2 Numerical Integration Numerical Integration The Midpoint method can be shown to Midpoint Method have 2 nd order accuracy Pros 2 nd Order accuracy Self starting h x � 3 x x h f ( t , x ) O ( h ) = + � + + + Cons i 1 i i i + 2 2 Additional application of Euler required at each step. Numerical Integration Numerical Integration Runge-Kutta Method 4 th order Runge-Kutta Method Family of methods symmetrical w.r.t. the k 1 = h � f ( t i , x i ) � interval h k Midpoint method is a 2 nd order Runge- k h f ( t , x 1 ) = � � + + 2 i i 2 2 Kutta method h k Fourth order Runge-Kutta k h f ( t , x 2 ) � = � + + 3 i i 2 2 Uses gradient at 4 points to estimate gradient over h. k h f ( t h , x k ) = � � + + 4 i i 3 Has 4 th order accuracy 1 x x ( k 2 k 2 k k ) = + + + + i + 1 i 6 1 2 3 4 7
Recommend
More recommend