Upload
others
View
13
Download
0
Embed Size (px)
Citation preview
Simulation in Computer Graphics
Rigid Body Dynamics
Matthias Teschner
Computer Science DepartmentUniversity of Freiburg
University of Freiburg – Computer Science Department – Computer Graphics - 2
Motivation
www.hairyharry.de
University of Freiburg – Computer Science Department – Computer Graphics - 3
Outline
representation of a rigid body position (center of mass) orientation
rigid body kinematics linear velocity angular velocity
rigid body dynamics inertia tensor linear and angular momentum force and torque simulation loop
orientation contact handling
University of Freiburg – Computer Science Department – Computer Graphics - 4
Mass-Point System
3n degrees of freedom (dof)
interaction modeled explicitly
system of 3n unknown
no notion of orientation
scalar mass
Mass-Point System vs. Rigid Body
Rigid Body
springs with infinite stiffness
modeled implicitly
6 remaining dof (position and orientation of the entire body)
meaningful orientation
mass distribution
University of Freiburg – Computer Science Department – Computer Graphics - 5
Particle Representation of a Rigid Body
world framecoordinates
body framecoordinates
initialstate
transformedstate
body frame (localcoordinate system)
world frame (globalcoordinate system)
translation + rotation
University of Freiburg – Computer Science Department – Computer Graphics - 6
Center of Mass(Massenmittelpunkt, Schwerpunkt)
same point undertranslation and rotation
University of Freiburg – Computer Science Department – Computer Graphics - 7
Center of Mass - Motivation
Newton's Second Law
University of Freiburg – Computer Science Department – Computer Graphics - 8
rotation matrix 3 x 3 elements to represent 3 degrees of freedom
Orientation in 3D
University of Freiburg – Computer Science Department – Computer Graphics - 9
has to be orthonormal
magnitude of eigenvalues is 1, so preserves the length of
position of a body point
Orientation in 3D
translation + rotation
University of Freiburg – Computer Science Department – Computer Graphics - 10
representation of a rigid body position (center of mass) orientation
rigid body kinematics linear velocity angular velocity
rigid body dynamics inertia tensor linear and angular momentum force and torque simulation loop
orientation contact handling
Outline
University of Freiburg – Computer Science Department – Computer Graphics - 11
time-dependent position
velocity
Body in Motion
linear velocity + angular velocity
University of Freiburg – Computer Science Department – Computer Graphics - 12
angular velocity is a 3D vector in direction of axis of rotation
is the magnitude of the angular velocity [rad/s]
Angular Velocity in 3D(Winkelgeschwindigkeit)
University of Freiburg – Computer Science Department – Computer Graphics - 13
What is the relation between and ?
angular velocity rotates all axis (columns of )
position of a point
velocity of a point
Rigid Body Kinematics
University of Freiburg – Computer Science Department – Computer Graphics - 14
particle rigid body
State Vector
University of Freiburg – Computer Science Department – Computer Graphics - 15
representation of a rigid body position (center of mass) orientation
rigid body kinematics linear velocity angular velocity
rigid body dynamics inertia tensor linear and angular momentum force and torque simulation loop
orientation contact handling
Outline
University of Freiburg – Computer Science Department – Computer Graphics - 16
forces change linear velocity
angular velocity
linear velocity change
like a particle, but ...
Rigid Body Dynamics
University of Freiburg – Computer Science Department – Computer Graphics - 17
the angular momentum of a particle w.r.t. the center of mass is
the total angular momentum of the body is
Angular Momentum (Drehimpuls)
University of Freiburg – Computer Science Department – Computer Graphics - 18
the total angular momentum is with being a 3 x 3 matrix (the inertia tensor of the body)
depends on the rotated configuration
the inertia tensor for the original body can be pre-computed, e.g.
similarity transform relates time-dependent and pre-computed :
Inertia Tensor (Trägheitstensor)
University of Freiburg – Computer Science Department – Computer Graphics - 19
the torque of a particle w.r.t. the center of mass is
the total torque of the body is
Torque (Drehmoment)
University of Freiburg – Computer Science Department – Computer Graphics - 20
angular momentum
torque
the angular version of Newton's Second law reads
tells us, how the forces change the angular velocity
Newton's Second Law (Angular)
University of Freiburg – Computer Science Department – Computer Graphics - 21
linear momentum angular momentum
linear velocity angular velocity
time-derivative of time-derivative of thethe linear momentum angular momentum
Linear vs. Angular Quantities
University of Freiburg – Computer Science Department – Computer Graphics - 22
Dynamics
University of Freiburg – Computer Science Department – Computer Graphics - 23
Simulation Loop (Euler)
Initialize:
Pre-compute: sum up external forces
perform Euler integration step
per particle quantities
University of Freiburg – Computer Science Department – Computer Graphics - 24
orientation matrix is updated every time step
errors accumulate
is not orthonormal anymore
Gram-Schmidt orthonormalization
Reorthonormalization of the Orientation
University of Freiburg – Computer Science Department – Computer Graphics - 25
Force vs. Torque Puzzle
10 s later
10 s later
longer path!
is force being considered twice? to accelerate center of mass
to cause the body to spin
University of Freiburg – Computer Science Department – Computer Graphics - 26
representation of a rigid body position (center of mass) orientation
rigid body kinematics linear velocity angular velocity
rigid body dynamics inertia tensor linear and angular momentum force and torque simulation loop
orientation contact handling
Outline
University of Freiburg – Computer Science Department – Computer Graphics - 27
quaternions
4 components represent 3 dof
often used in rigid body computations for rotations
Alternative OrientationRepresentations
University of Freiburg – Computer Science Department – Computer Graphics - 28
quaternions are an extension of complex numbers
Quaternions
University of Freiburg – Computer Science Department – Computer Graphics - 29
Basic Operations
addition
dot product
conjugate
magnitude (module)
inverse
University of Freiburg – Computer Science Department – Computer Graphics - 30
Basic Operations
multiplication
University of Freiburg – Computer Science Department – Computer Graphics - 31
quaternions with can be used to represent rotations
corresponding rotation matrix
rotation of a point
Unit Quaternions
University of Freiburg – Computer Science Department – Computer Graphics - 32
initialization of orientation and angular velocity in the body frame
update of the angular velocity using
update of the orientation using
updated orientation has to be normalized
torque needs to be transformed from world to body frame,angular velocity from body to world frame
Application in the Simulation Loop
University of Freiburg – Computer Science Department – Computer Graphics - 33
representation of a rigid body position (center of mass) orientation
rigid body kinematics linear velocity angular velocity
rigid body dynamics inertia tensor linear and angular momentum force and torque simulation loop
orientation contact handling
Outline
University of Freiburg – Computer Science Department – Computer Graphics - 34
Non-Penetration
detect collisions (see collision detection slides)
avoid penetrations change time step or
push body back
compute collision response colliding contact ("easy")
resting contact (very hard)
University of Freiburg – Computer Science Department – Computer Graphics - 35
force driven penetration causes force (late, slow, easy to compute)
impulse driven manipulation of velocities (J) instead of accelerations
(fast, more difficult to compute)
e – coefficient of restitution(e=0 plastic c., e=1 elastic c.)
Colliding Contact
University of Freiburg – Computer Science Department – Computer Graphics - 36
Resting Contact
find all collisions with small relative velocities
solve for all contact forces simultaneously such that for each contact force the force is strong enough to prevent interpenetration
the force is repulsive only (not glue like)
the force is zero if the bodies separate
Linear complementary problem (LCP)
University of Freiburg – Computer Science Department – Computer Graphics - 37
representation of a rigid body position (center of mass) orientation
rigid body kinematics linear velocity angular velocity
rigid body dynamics inertia tensor linear and angular momentum force and torque simulation loop
orientation contact handling
Summary
University of Freiburg – Computer Science Department – Computer Graphics - 38
References
Murilo G. Coutinho, "Dynamic Simulations of Multibody Systems",Springer, ISBN 0-387-95192-X
Andrew Witkin, David Baraff, Michael Kass,"Physically-based modeling",ACM SIGGRAPH '01, Course Notes, 2001.
David Eberly,"Game Physics",Elsevier, ISBN 1-55860-740-4.
Kenny Erleben, J. Sporring, K. Henriksen, H. Dohlmann,"Physics-based Animation",Charles River Media, Hingham, Massachusetts, ISBN 1-58450-380-7, 2005.
Jan Bender, "Impulsbasierte Dynamiksimulation von Mehrkoerpersystemen in der virtuellen Realitaet",Dissertation, Universitaet Karlsruhe, 2007
University of Freiburg – Computer Science Department – Computer Graphics - 39
This slide set is courtesy of Matthias Mueller-Fischer, NVIDIA Corp. It has been modified.
Acknowledgement