Particle system Particle Dynamics Particles are objects that have mass, position, and velocity, but without spatial extent Particles are the easiest objects to simulate but they can be made to exhibit a wide range of objects Applications Overview One particle Particle system Forces Collisions
A Newtonian Particle Second order equations x ( t ) = f ( x ( t ) , ˙ x ( t )) What is the differential equation that describes the ¨ behavior of a mass point? m This is not in our standard form because it has second f = m a derivatives What does f depend on? Add a new variable, v ( t ), to get a pair of coupled first order equations x ( t ) = f ( x ( t ) , ˙ x ( t )) ¨ { ˙ x = v m v = f /m ˙ Phase space Particle structure x 1 Particle x 2 Concatenate position and velocity � x � x 3 to form a 6-vector: position in = v v 1 x position phase space a point in the phase space v 2 v velocity v 3 f force accumulator mass m � ˙ � v � � First order differential equation: x = f ˙ velocity in the phase space v m
Solver interface Overview solver system interface solver One particle 6 GetDim particle Particle system x x Get/Set Forces v v State f Collisions v m f Deriv Eval m Particle system structure Particle system structure solver system system interface solver x 1 x 2 x n v 1 v 2 v n 6n GetDim particles ... particles f 1 f 2 f n m 1 m 2 m n x 1 x 2 x n Get/Set n time n time . . . v 1 v 2 v n State v 1 v 2 v n f 1 f 2 f n Deriv Eval . . . m 1 m 2 m n
Deriv Eval Overview Clear forces: loop over particles, zero One particle force accumulator Particle system Calculate forces: sum all forces into accumulator Forces Gather: loop over particles, copy v Collisions and f /m into destination array Forces Particle systems with forces system Constant x 1 x 2 x n gravity v 1 v 2 v n particles ... f 1 f 2 f n Position/time dependent m 1 m 2 m n force fields, springs n time Velocity dependent ... drag forces F 1 F 2 F m
Force structure Particle systems with forces system Unlike particles, forces are heterogeneous (type- x 1 x 2 x n independent) v 1 v 2 v n particles ... f 1 f 2 f n Each force object “knows” m 1 m 2 m n n time which particles it influences how much contribution it adds to the force accumulator ... forces F 1 F 2 F m Gravity Viscous drag At very low speeds for small x 1 x 2 x n x 1 x 2 x n Unary force: f = m G v 1 v 2 v n v 1 v 2 v n particles, air resistance is f 1 f 2 f n f 1 f 2 f n m 1 m 2 m n m 1 m 2 m n approximately: F F Exerting a constant force p p on each particle . . . f drag = − k drag v . . . sys apply_fun sys apply_fun particle system particle system G k p->f += p->m*F->G p->f += p->v*F->k
Attraction Attraction Act on any or all pairs of particles, depending on their x p x q v p v q positions f p = − k m p m q l f p f q m p m q | l | 2 | l | F f p = − k m p m q l p l x p | l | 2 | l | sys apply_fun x q f q = − f p particle system k l = x p − x q Damped spring Damped spring x p x q v p v q � � ˙ l · l l f p f q f p = − k s ( | l | − r ) + k d | l | | l | m p m q F x p � � ˙ l · l l r f p = − k s ( | l | − r ) + k d p | l | | l | k d sys apply_fun r f q = − f p particle system | l | k s l = x p − x q x q
Deriv Eval ODE solver 1. Clear force accumulators Canonical differential equation: x = f ( x , t ) ˙ x 1 x 2 x n v 1 v 2 v n � ˙ � v 2. Invoke apply_force ... � � f 1 f 2 f n x = functions Equation of motion for a particle: f ˙ v m 1 m 2 m n m ... F 1 F 2 F n Euler’s method: x ( t 0 + h ) = x ( t 0 ) + hf ( x , t ) 3. Return derivatives to solver � ˙ � v x t +1 = x t + h ˙ � � x t x = f v t +1 = v t + h ˙ ˙ v t v m Euler step Euler step solver Evaluate derivatives system interface solver update forces and evaluate new derivatives x t +1 = x t + h ˙ x t 3. GetDim particles Get States v t +1 = v t + h ˙ v t 4. 2. x 1 x 2 x n Update states 5. Advance Get/Set time Set State Get State . . . v 1 v 2 v n time State 1. Set States v 1 v 2 v n f 1 f 2 f n Deriv Eval Deriv Eval . . . Advance time m 1 m 2 m n
Overview Particle Interaction One particle We will revisit collision when we talk about rigid Particle system body simulation Forces For now, just simple point-plane collisions Collisions Collision detection Collision detection Normal and tangential components Particle is on the legal side if Particle is within of the wall if � x x v T v T v N = ( N · v ) N N N v T = v − v N v N v N Particle is heading in if v v p
Collision response Contact Conditions for contact: Before collision After collision 1. particle is on the collision surface v � 2. zero normal velocity − k r v N v T v T If a particle is pushed into the contact plane a contact force f c is exerted to cancel the normal component of f v N v N v � = v T − k r v N x v p coefficient of restitution: 0 ≤ k r < 1 f f N f T What’s next? Project 1 grading session How do we impose constraints on the particles? It’s due on next Tuesday (01/31) before the class This means that your executable needs to be created before 11:00 01/31/06 Sumit will run a grading session with each group on Tuesday and Wednesday You need to sign up for a time slot TODAY!
Animation artifact If your artifact is smaller then 5M, mail it to csci520@usc.edu Otherwise, burn it onto a CD and bring it to the class on Thursday (2/2) We will show them in the class and you will vote for your favorite artifact
Recommend
More recommend