8/3/2019 Dynamic Rigid Bodies
1/50
Rigid Body Dynamics
CSE169: Computer Animation
Instructor: Steve Rotenberg
UCSD, Winter 2008
8/3/2019 Dynamic Rigid Bodies
2/50
Cross Product
[ ]xyyxzxxzyzzy
zyx
zyx
babababababa
bbb
aaa
=
=
ba
kji
ba
8/3/2019 Dynamic Rigid Bodies
3/50
Cross Product
[ ]
zyxxzz
zxyxzy
zyyzxx
xyyxzxxzyzzy
bbabac
babbac
bababc
babababababa
++=
+=
+==
=
0
0
0
bac
ba
8/3/2019 Dynamic Rigid Bodies
4/50
Cross Product
=
++=
+=
+=
z
y
x
xy
xz
yz
z
y
x
zyxxzz
zxyxzy
zyyzxx
b
b
b
aa
aa
aa
c
c
c
bbabac
babbacbababc
0
0
0
0
00
8/3/2019 Dynamic Rigid Bodies
5/50
Cross Product
=
=
=
0
0
0
0
00
xy
xz
yz
z
y
x
xy
xz
yz
z
y
x
aa
aa
aa
b
bb
aa
aaaa
c
cc
a
baba
8/3/2019 Dynamic Rigid Bodies
6/50
Derivative of a Rotating Vector
Lets say that vectorr is rotating around theorigin, maintaining a fixed distance
At any instant, it has an angular velocity of
rr
=
dt
d
r
r
8/3/2019 Dynamic Rigid Bodies
7/50
Derivative of Rotating Matrix
If matrix A is a rigid 3x3 matrix rotating withangular velocity
This implies that the a, b, and c axes must be
rotating around The derivatives of each axis are xa, xb, and
xc, and so the derivative of the entire matrix is:
AAA
== dt
d
8/3/2019 Dynamic Rigid Bodies
8/50
Product Rule
( )
( )dt
dcabc
dt
dbabc
dt
da
dt
abcd
dt
dbabdt
da
dt
abd
++=
+=
The product rule defines the derivative ofproducts
8/3/2019 Dynamic Rigid Bodies
9/50
Product Rule
It can be extended to vector and matrix productsas well
( )
( )
( )
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
BAB
ABA
b
ab
aba
bab
aba
+=
+=
+=
8/3/2019 Dynamic Rigid Bodies
10/50
Dynamics of Particles
8/3/2019 Dynamic Rigid Bodies
11/50
Kinematics of a Particle
onaccelerati
ityveloc
position
2
2
dt
d
dt
d
dt
d
xva
xv
x
==
=
8/3/2019 Dynamic Rigid Bodies
12/50
Mass, Momentum, and Force
force
momentum
mass
ap
f
vp
mdt
d
m
m
==
=
8/3/2019 Dynamic Rigid Bodies
13/50
Moment of Momentum
The moment of momentum is a vector
Also known as angular momentum (the twoterms mean basically the same thing, but areused in slightly different situations)
Angular momentum has parallel properties withlinear momentum
In particular, like the linear momentum, angularmomentum is conserved in a mechanical system
prL =
8/3/2019 Dynamic Rigid Bodies
14/50
Moment of Momentum
prL =
p
1r
2r3r
p
p
L is the same for all three of these particles
8/3/2019 Dynamic Rigid Bodies
15/50
Moment of Momentum
prL =
p
1r2r
3r
p
p
L is different for all of these particles
8/3/2019 Dynamic Rigid Bodies
16/50
Moment of Force (Torque)
The moment of force(ortorque) about apoint is the rate of change of the moment
of momentum about that point
dt
dL =
8/3/2019 Dynamic Rigid Bodies
17/50
Moment of Force (Torque)
( )fr
frvv
frpv
p
rp
rL
prL
=+=
+=+==
=
m
dt
d
dt
d
dt
d
8/3/2019 Dynamic Rigid Bodies
18/50
Rotational Inertia
L=rxp is a general expression for themoment of momentum of a particle
In a case where we have a particle
rotating around the origin while keeping afixed distance, we can re-express the
moment of momentum in terms of its
angular velocity
8/3/2019 Dynamic Rigid Bodies
19/50
Rotational Inertia
( )
( ) ( )
rrI
IL
rrL
rrrrL
vrvrLprL
=
=
===
===
m
mmm
mm
8/3/2019 Dynamic Rigid Bodies
20/50
Rotational Inertia
=
=
=
22
22
22
00
0
00
0
yxzyzx
zyzxyx
zxyxzy
xy
xz
yz
xy
xz
yz
rrrrrr
rrrrrr
rrrrrr
m
rrrr
rr
rrrr
rr
m
m
I
I
rrI
8/3/2019 Dynamic Rigid Bodies
21/50
Rotational Inertia
( )( )
( )
IL
I
=
+
+
+
=22
22
22
yxzyzx
zyzxyx
zxyxzy
rrmrmrrmr
rmrrrmrmr
rmrrmrrrm
8/3/2019 Dynamic Rigid Bodies
22/50
Rotational Inertia
The rotational inertia matrix I is a 3x3 matrix thatis essentially the rotational equivalent of mass
It relates the angular momentum of a system toits angular velocity by the equation
This is similar to how mass relates linearmomentum to linear velocity, but rotation addsadditional complexity
IL =
vp m=
8/3/2019 Dynamic Rigid Bodies
23/50
Systems of Particles
momentumtalto
massofcenterofposition
particlesallofmassltota1
==
=
==
iiicm
i
ii
cm
n
i
itotal
m
m
m
mm
vpp
xx
8/3/2019 Dynamic Rigid Bodies
24/50
Velocity of Center of Mass
cmtotalcm
total
cmcm
i
ii
i
ii
cm
i
iicmcm
m
m
m
m
m
dt
dm
m
m
dt
d
dt
d
vp
pv
vx
v
xxv
=
=
==
==
8/3/2019 Dynamic Rigid Bodies
25/50
Force on a Particle
The change in momentum of the center of massis equal to the sum of all of the forces on the
individual particles
This means that the resulting change in the totalmomentum is independent of the location of the
applied force
i
iicm
icm
dt
d
dt
d
dt
d
===
=
fppp
pp
8/3/2019 Dynamic Rigid Bodies
26/50
Systems of Particles
( )
=
=
icmicm
iicm
pxxL
prL
The total moment of momentum aroundthe center of mass is:
8/3/2019 Dynamic Rigid Bodies
27/50
Torque in a System of Particles
( )
( )
=
=
==
=
iicm
ii
cm
iicmcm
iicm
dt
d
dt
d
dt
d
fr
pr
prL
prL
8/3/2019 Dynamic Rigid Bodies
28/50
Systems of Particles
We can see that a system of particles behaves a lot like
a particle itself
It has a mass, position (center of mass), momentum,
velocity, acceleration, and it responds to forces
We can also define its angular momentum and relate a
change in system angular momentum to a force appliedto an individual particle
( )
= iicm fr
= icm ff
8/3/2019 Dynamic Rigid Bodies
29/50
Internal Forces
If forces are generated within the particle system(say from gravity, or springs connectingparticles) they must obey Newtons Third Law(every action has an equal and opposite
reaction) This means that internal forces will balance out
and have no net effect on the total momentum of
the system As those opposite forces act along the same line
of action, the torques on the center of masscancel out as well
8/3/2019 Dynamic Rigid Bodies
30/50
Kinematics of Rigid Bodies
8/3/2019 Dynamic Rigid Bodies
31/50
Kinematics of a Rigid Body
For the center of mass of the rigid body:
2
2
dtd
dtd
dtd
cmcmcm
cmcm
cm
xva
xv
x
==
=
8/3/2019 Dynamic Rigid Bodies
32/50
Kinematics of a Rigid Body
For the orientation of the rigid body:
onacceleratiangular
locityangular ve
matrixnorientatio3x3
dt
d
A
=
8/3/2019 Dynamic Rigid Bodies
33/50
Offset Position
Lets say we have a point on a rigid body Ifr is the world space offset of the point relative
to the center of mass of the rigid body, then the
position x of the point in world space is:
rxx += cm
8/3/2019 Dynamic Rigid Bodies
34/50
Offset Velocity
The velocity of the offset point is just thederivative of its position
rvv
rxxv
rxx
+=
+==
+=
cm
cm
cm
dt
d
dt
d
dt
d
8/3/2019 Dynamic Rigid Bodies
35/50
Offset Acceleration
The offset acceleration is the derivative of theoffset velocity
( )rraa
rr
vva
rvv
++=
++==
+=
cm
cm
cm
dt
d
dt
d
dt
d
dt
d
8/3/2019 Dynamic Rigid Bodies
36/50
Kinematics of an Offset Point
The kinematic equations for an fixed pointon a rigid body are:
( )rraa
rvvrxx
++=
+=+=
cm
cm
cm
8/3/2019 Dynamic Rigid Bodies
37/50
Dynamics of Rigid Bodies
8/3/2019 Dynamic Rigid Bodies
38/50
Rigid Bodies
We treat a rigid body as a system of particles, where the
distance between any two particles is fixed
We will assume that internal forces are generated tohold the relative positions fixed. These internal forcesare all balanced out with Newtons third law, so that theyall cancel out and have no effect on the total momentumor angular momentum
The rigid body can actually have an infinite number ofparticles, spread out over a finite volume
Instead of mass being concentrated at discrete points,we will consider the density as being variable over thevolume
8/3/2019 Dynamic Rigid Bodies
39/50
Rigid Body Mass
With a system of particles, we defined the totalmass as:
For a rigid body, we will define it as the integral
of the density over some volumetric domain
= dm
=
=n
i
imm1
8/3/2019 Dynamic Rigid Bodies
40/50
Rigid Body Center of Mass
The center of mass is:
=
d
d
cm
xx
8/3/2019 Dynamic Rigid Bodies
41/50
Rigid Body Rotational Inertia
( )( )
( )
=
+
++
=
zzyzxz
yzyyxy
xzxyxx
yxzyzx
zyzxyx
zxyxzy
III
IIIIII
drrdrrdrr
drrdrrdrr
drrdrrdrr
I
I
22
22
22
8/3/2019 Dynamic Rigid Bodies
42/50
Diagonalization of Rotational Inertial
==
=
z
y
x
T
zzyzxz
yzyyxy
xzxyxx
I
I
I
where
III
IIIIII
00
00
00
00 IAIAI
I
8/3/2019 Dynamic Rigid Bodies
43/50
Derivative of Rotational Inertial
( )
( )
( )
( )
III
IIAIAII
AIAII
AIAAIAI
AIAAI
AAIAI
0
0
00
000
=
+=+=
+=
+=
+=
=
dt
d
dtd
dt
ddt
d
dt
d
dt
d
dt
d
dt
d
TTT
T
TT
T
TT
8/3/2019 Dynamic Rigid Bodies
44/50
Derivative of Angular Momentum
( )
II
III
III
IIL
IL
+=
+=
+=
+===
dt
d
dt
d
dt
d
8/3/2019 Dynamic Rigid Bodies
45/50
Newton-Euler Equations
I
I
af
+=
= m
8/3/2019 Dynamic Rigid Bodies
46/50
Applied Forces & Torques
( )
( )II
fa
fr
ff
==
==
1
1
m
iicg
icg
8/3/2019 Dynamic Rigid Bodies
47/50
Properties of Rigid Bodies
afvp
av
x
mm
m
=
=
IIfr
IL
AI
+==
=
8/3/2019 Dynamic Rigid Bodies
48/50
Rigid Body SimulationRigidBody {
void Update(float time);void ApplyForce(Vector3 &f,Vector3 &pos);
private:
// constants
float Mass;Vector3 RotInertia; // Ix, Iy, & Iz from diagonal inertia
// variables
Matrix34 Mtx; // contains position & orientationVector3 Momentum,AngMomentum;
// accumulators
Vector3 Force,Torque;
};
8/3/2019 Dynamic Rigid Bodies
49/50
Rigid Body Simulation
RigidBody::ApplyForce(Vector3 &f,Vector3 &pos) {
Force += f;
Torque += (pos-Mtx.d) x f
}
8/3/2019 Dynamic Rigid Bodies
50/50
Rigid Body Simulation
RigidBody::Update(float time) {
// Update positionMomentum += Force * time;
Mtx.d += (Momentum/Mass) * time; // Mtx.d = position
// Update orientationAngMomentum += Torque * time;
Matrix33 I = MtxI0MtxT // AI0A
T
Vector3 = I-1L
float angle = || * time; // magnitude of Vector3 axis = ;
axis.Normalize();
Mtx.RotateUnitAxis(axis,angle);
}