You are on page 1of 50

Rigid Body Dynamics

CSE169: Computer Animation


Instructor: Steve Rotenberg
UCSD, Winter 2005
Cross Product
| |
x y y x z x x z y z z y
z y x
z y x
b a b a b a b a b a b a
b b b
a a a
=
=
b a
k j i
b a
Cross Product
| |
z y x x z z
z x y x z y
z y y z x x
x y y x z x x z y z z y
b b a b a c
b a b b a c
b a b a b c
b a b a b a b a b a b a
+ + =
+ =
+ =
=
=
0
0
0
b a c
b a
Cross Product
(
(
(

(
(
(

=
(
(
(

+ + =
+ =
+ =
z
y
x
x y
x z
y z
z
y
x
z y x x z z
z x y x z y
z y y z x x
b
b
b
a a
a a
a a
c
c
c
b b a b a c
b a b b a c
b a b a b c
0
0
0
0
0
0
Cross Product
(
(
(

=
=
(
(
(

(
(
(

=
(
(
(

0
0
0

0
0
0
x y
x z
y z
z
y
x
x y
x z
y z
z
y
x
a a
a a
a a
b
b
b
a a
a a
a a
c
c
c
a
b a b a
Derivative of a Rotating Vector
Lets say that vector r is rotating around the
origin, maintaining a fixed distance
At any instant, it has an angular velocity of
r
r
=
dt
d
r
r

Derivative of Rotating Matrix
If matrix A is a rigid 3x3 matrix rotating with
angular 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:
A A
A
= =

dt
d
Product Rule
( )
( )
dt
dc
ab c
dt
db
a bc
dt
da
dt
abc d
dt
db
a b
dt
da
dt
ab d
+ + =
+ =
The product rule defines the derivative of
products
Product Rule
It can be extended to vector and matrix products
as well
( )
( )
( )
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
B
A B
A B A
b
a b
a b a
b
a b
a b a
+ =

+ =

+ =

Dynamics of Particles
Kinematics of a Particle
on accelerati
ity veloc
position
2
2
dt
d
dt
d
dt
d
x v
a
x
v
x
= =
=
Mass, Momentum, and Force
force
momentum
mass
a
p
f
v p
m
dt
d
m
m
= =
=
Moment of Momentum
The moment of momentum is a vector


Also known as angular momentum (the two
terms mean basically the same thing, but are
used in slightly different situations)
Angular momentum has parallel properties with
linear momentum
In particular, like the linear momentum, angular
momentum is conserved in a mechanical system
p r L =
Moment of Momentum
p r L =
p
1
r
2
r
3
r
p
p
L is the same for all three of these particles



Moment of Momentum
p r L =
p
1
r
2
r
3
r
p
p
L is different for all of these particles



Moment of Force (Torque)
The moment of force (or torque) about a
point is the rate of change of the moment
of momentum about that point
dt
dL
=
Moment of Force (Torque)
( )
f r
f r v v
f r p v
p
r p
r L

p r L
=
+ =
+ =
+ = =
=
m
dt
d
dt
d
dt
d
Rotational Inertia
L=rxp is a general expression for the
moment of momentum of a particle
In a case where we have a particle
rotating around the origin while keeping a
fixed distance, we can re-express the
moment of momentum in terms of its
angular velocity
Rotational Inertia
( )
( ) ( )
r r I
I L
r r L
r r r r L
v r v r L
p r L


=
=
=
= =
= =
=
m
m
m m
m m
Rotational Inertia
(
(
(




=
(
(
(

(
(
(

=
=
2 2
2 2
2 2
0
0
0
0
0
0

y x z y z x
z y z x y x
z x y x z y
x y
x z
y z
x y
x z
y z
r r r r r r
r r r r r r
r r r r r r
m
r r
r r
r r
r r
r r
r r
m
m
I
I
r r I
Rotational Inertia
( )
( )
( )
I L
I
=
(
(
(

+
+
+
=
2 2
2 2
2 2
y x z y z x
z y z x y x
z x y x z y
r r m r mr r mr
r mr r r m r mr
r mr r mr r r m
Rotational Inertia
The rotational inertia matrix I is a 3x3 matrix that
is essentially the rotational equivalent of mass
It relates the angular momentum of a system to
its angular velocity by the equation


This is similar to how mass relates linear
momentum to linear velocity, but rotation adds
additional complexity
I L =
v p m =
Systems of Particles
momentum tal to
mass of center of position
particles all of mass l tota
1

= =
=
=
=
i i i cm
i
i i
cm
n
i
i total
m
m
m
m m
v p p
x
x
Velocity of Center of Mass
cm total cm
total
cm
cm
i
i i
i
i
i
cm
i
i i
cm
cm
m
m
m
m
m
dt
d
m
m
m
dt
d
dt
d
v p
p
v
v
x
v
x
x
v
=
=
= =
= =

Force on a Particle
The change in momentum of the center of mass
is equal to the sum of all of the forces on the
individual particles
This means that the resulting change in the total
momentum is independent of the location of the
applied force
i
i
i
cm
i cm
dt
d
dt
d
dt
d

= = =
=
f
p
p
p
p p
Systems of Particles
( )

=
=
i cm i cm
i i cm
p x x L
p r L
The total moment of momentum around
the center of mass is:
Torque in a System of Particles
( )
( )

= =
=
i i cm
i i
cm
i i
cm
cm
i i cm
dt
d
dt
d
dt
d
f r
p r

p r
L

p r L
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 applied
to an individual particle
( )

=
i i cm
f r

=
i cm
f f
Internal Forces
If forces are generated within the particle system
(say from gravity, or springs connecting
particles) 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 mass
cancel out as well
Kinematics of Rigid Bodies
Kinematics of a Rigid Body
For the center of mass of the rigid body:
2
2
dt
d
dt
d
dt
d
cm cm
cm
cm
cm
cm
x v
a
x
v
x
= =
=
Kinematics of a Rigid Body
For the orientation of the rigid body:
on accelerati angular
locity angular ve
matrix n orientatio 3x3
dt
d

A
=
Offset Position
Lets say we have a point on a rigid body
If r 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:
r x x + =
cm
Offset Velocity
The velocity of the offset point is just the
derivative of its position
r v v
r x x
v
r x x
+ =
+ = =
+ =
cm
cm
cm
dt
d
dt
d
dt
d
Offset Acceleration
The offset acceleration is the derivative of the
offset velocity
( ) r r a a
r
r
v v
a
r v v
+ + =
+ + = =
+ =
cm
cm
cm
dt
d
dt
d
dt
d
dt
d
Kinematics of an Offset Point
The kinematic equations for an fixed point
on a rigid body are:
( ) r r a a
r v v
r x x
+ + =
+ =
+ =
cm
cm
cm
Dynamics of Rigid Bodies
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 to
hold the relative positions fixed. These internal forces
are all balanced out with Newtons third law, so that they
all cancel out and have no effect on the total momentum
or angular momentum
The rigid body can actually have an infinite number of
particles, spread out over a finite volume
Instead of mass being concentrated at discrete points,
we will consider the density as being variable over the
volume
Rigid Body Mass
With a system of particles, we defined the total
mass as:



For a rigid body, we will define it as the integral
of the density over some volumetric domain
}
O
O = d m

=
=
n
i
i
m m
1
Rigid Body Center of Mass
The center of mass is:
}
}
O
O
=
d
d
cm

x
x
Rigid Body Rotational Inertia
( )
( )
( )
(
(
(

=
(
(
(
(

O + O O
O O + O
O O O +
=
} } }
} } }
} } }
zz yz xz
yz yy xy
xz xy xx
y x z y z x
z y z x y x
z x y x z y
I I I
I I I
I I I
d r r d r r d r r
d r r d r r d r r
d r r d r r d r r
I
I
2 2
2 2
2 2



Diagonalization of Rotational Inertial
(
(
(

= =
(
(
(

=
z
y
x
T
zz yz xz
yz yy xy
xz xy xx
I
I
I
where
I I I
I I I
I I I
0 0
0 0
0 0
0 0
I A I A I
I
Derivative of Rotational Inertial
( )
( )
( )
( )
I I
I
I I A I A I
I
A I A I
I
A I A A I A
I
A
I A A I
A A I A I

0
0
0 0
0 0
0
=
+ = + =
+ =
+ =
|
.
|

\
|
+ =

=
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
dt
d
T T T
T
T
T
T
T
T
Derivative of Angular Momentum
( )
I I
I I I
I I I

I
I L

I L
+ =
+ =
+ =
+ = =
=

dt
d
dt
d
dt
d
Newton-Euler Equations
I I
a f
+ =
= m
Applied Forces & Torques
( )
( ) I I
f a
f r
f f
=
=
=
=

1
1
m
i i cg
i cg
Properties of Rigid Bodies
a f
v p
a
v
x
m
m
m
=
=
I I f r
I L

A
I
+ = =
=
Rigid Body Simulation
RigidBody {
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 & orientation
Vector3 Momentum,AngMomentum;

// accumulators
Vector3 Force,Torque;
};
Rigid Body Simulation
RigidBody::ApplyForce(Vector3 &f,Vector3 &pos) {
Force += f;
Torque += (pos-Mtx.d) x f
}
Rigid Body Simulation
RigidBody::Update(float time) {
// Update position
Momentum += Force * time;
Mtx.d += (Momentum/Mass) * time; // Mtx.d = position

// Update orientation
AngMomentum += Torque * time;
Matrix33 I = MtxI
0
Mtx
T
// AI
0
A
T
Vector3 = I
-1
L
float angle = || * time; // magnitude of
Vector3 axis = ;
axis.Normalize();
Mtx.RotateUnitAxis(axis,angle);
}

You might also like