Slide Dynamics

50
Rigid Body Dynamics CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005

Transcript of Slide Dynamics

Page 1: Slide Dynamics

Rigid Body Dynamics

CSE169: Computer AnimationInstructor: Steve Rotenberg

UCSD, Winter 2005

Page 2: Slide Dynamics

Cross Product

xyyxzxxzyzzy

zyx

zyx

babababababa

bbbaaa

ba

kjiba

Page 3: Slide Dynamics

Cross Product

zyxxzz

zxyxzy

zyyzxx

xyyxzxxzyzzy

bbabac

babbac

bababc

babababababa

0

0

0bac

ba

Page 4: Slide Dynamics

Cross Product

z

y

x

xy

xz

yz

z

y

x

zyxxzz

zxyxzy

zyyzxx

bbb

aaaaaa

ccc

bbabac

babbac

bababc

00

0

0

0

0

Page 5: Slide Dynamics

Cross Product

00

ˆ

00

0

xy

xz

yz

z

y

x

xy

xz

yz

z

y

x

aaaaaa

bbb

aaaaaa

ccc

a

baba

Page 6: Slide Dynamics

Derivative of a Rotating Vector

Let’s say that vector r is rotating around the origin, maintaining a fixed distance

At any instant, it has an angular velocity of ω

rωr

dtd

Page 7: Slide Dynamics

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 ˆ

dtd

Page 8: Slide Dynamics

Product Rule

dtdcabc

dtdbabc

dtda

dtabcd

dtdbab

dtda

dtabd

The product rule defines the derivative of products

Page 9: Slide Dynamics

Product Rule

It can be extended to vector and matrix products as well

dtd

dtd

dtd

dtd

dtd

dtd

dtd

dtd

dtd

BABABA

bababa

bababa

Page 10: Slide Dynamics

Dynamics of Particles

Page 11: Slide Dynamics

Kinematics of a Particle

onaccelerati

ity veloc

position

2

2

dtd

dtddtd

xva

xv

x

Page 12: Slide Dynamics

Mass, Momentum, and Force

force

momentum mass

apf

vp

mdtdm

m

Page 13: Slide Dynamics

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

prL

Page 14: Slide Dynamics

Moment of Momentum

prL

p

1r2r3r

pp

L is the same for all three of these particles

••

Page 15: Slide Dynamics

Moment of Momentum

prL

p

1r2r

3r

pp

L is different for all of these particles

Page 16: Slide Dynamics

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

dtdLτ

Page 17: Slide Dynamics

Moment of Force (Torque)

frτ

frvvτfrpvτ

prprLτ

prL

m

dtd

dtd

dtd

Page 18: Slide Dynamics

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 it’s angular velocity ω

Page 19: Slide Dynamics

Rotational Inertia

rrIωIL

ωrrLωrrrωrL

vrvrLprL

ˆˆ

ˆˆ

m

mmm

mm

Page 20: Slide Dynamics

Rotational Inertia

22

22

22

00

0

00

0

ˆˆ

yxzyzx

zyzxyx

zxyxzy

xy

xz

yz

xy

xz

yz

rrrrrrrrrrrrrrrrrr

m

rrrrrr

rrrrrr

m

m

I

I

rrI

Page 21: Slide Dynamics

Rotational Inertia

ωIL

I

22

22

22

yxzyzx

zyzxyx

zxyxzy

rrmrmrrmrrmrrrmrmrrmrrmrrrm

Page 22: Slide Dynamics

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

ωIL

vp m

Page 23: Slide Dynamics

Systems of Particles

momentum tal to

mass ofcenter ofposition

particles all of mass l tota1

iiicm

i

iicm

n

iitotal

m

mm

mm

vpp

xx

Page 24: Slide Dynamics

Velocity of Center of Mass

cmtotalcm

total

cmcm

i

ii

i

ii

cm

i

iicmcm

mm

mm

mdtdm

mm

dtd

dtd

vp

pv

vx

v

xxv

Page 25: Slide Dynamics

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

iiicm

icm

dtd

dtd

dtd

fppp

pp

Page 26: Slide Dynamics

Systems of Particles

icmicm

iicm

pxxL

prL

The total moment of momentum around the center of mass is:

Page 27: Slide Dynamics

Torque in a System of Particles

iicm

iicm

iicmcm

iicm

dtd

dtd

dtd

frτ

prτ

prLτ

prL

Page 28: Slide Dynamics

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 it’s angular momentum and relate a change in system angular momentum to a force applied to an individual particle

iicm frτ

icm ff

Page 29: Slide Dynamics

Internal Forces If forces are generated within the particle system

(say from gravity, or springs connecting particles) they must obey Newton’s 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

Page 30: Slide Dynamics

Kinematics of Rigid Bodies

Page 31: Slide Dynamics

Kinematics of a Rigid Body

For the center of mass of the rigid body:

2

2

dtd

dtddtd

cmcmcm

cmcm

cm

xva

xv

x

Page 32: Slide Dynamics

Kinematics of a Rigid Body

For the orientation of the rigid body:

onacceleratiangular

locityangular ve matrixn orientatio 3x3

dtdωω

ωA

Page 33: Slide Dynamics

Offset Position

Let’s 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:

rxx cm

Page 34: Slide Dynamics

Offset Velocity

The velocity of the offset point is just the derivative of its position

rωvv

rxxv

rxx

cm

cm

cm

dtd

dtd

dtd

Page 35: Slide Dynamics

Offset Acceleration

The offset acceleration is the derivative of the offset velocity

rωωrωaa

rωrωvva

rωvv

cm

cm

cm

dtd

dtd

dtd

dtd

Page 36: Slide Dynamics

Kinematics of an Offset Point

The kinematic equations for an fixed point on a rigid body are:

rωωrωaarωvv

rxx

cm

cm

cm

Page 37: Slide Dynamics

Dynamics of Rigid Bodies

Page 38: Slide Dynamics

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 Newton’s 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

Page 39: Slide Dynamics

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 Ω

dm

n

iimm

1

Page 40: Slide Dynamics

Rigid Body Center of Mass The center of mass is:

d

dcm

xx

Page 41: Slide Dynamics

Rigid Body Rotational Inertia

zzyzxz

yzyyxy

xzxyxx

yxzyzx

zyzxyx

zxyxzy

IIIIIIIII

drrdrrdrr

drrdrrdrr

drrdrrdrr

I

I22

22

22

Page 42: Slide Dynamics

Diagonalization of Rotational Inertial

z

y

xT

zzyzxz

yzyyxy

xzxyxx

II

Iwhere

IIIIIIIII

000000

00 IAIAI

I

Page 43: Slide Dynamics

Derivative of Rotational Inertial

ωIIωI

ωIIωωAIAIωI

AωIAIωI

AωIAAIAωI

AIAAIAAIAI

ˆ

ˆˆ

ˆ

0

0

00

000

dtddtddtddtd

dtd

dtd

dtd

dtd

TTT

T

TT

TT

T

Page 44: Slide Dynamics

Derivative of Angular Momentum

ωIωIωτ

ωIωωIωIωτωIωωIIωτ

ωIωILτ

ωIL

ˆˆ

dtd

dtd

dtd

Page 45: Slide Dynamics

Newton-Euler Equations

ωIωIωτaf

m

Page 46: Slide Dynamics

Applied Forces & Torques

ωIωτIω

fa

frτ

ff

1

1m

iicg

icg

Page 47: Slide Dynamics

Properties of Rigid Bodies

afvp

avx

mm

m

ωIωIωfrτωIL

ωωAI

Page 48: Slide Dynamics

Rigid Body SimulationRigidBody {

void Update(float time);void ApplyForce(Vector3 &f,Vector3 &pos);

private:// constantsfloat Mass;Vector3 RotInertia; // Ix, Iy, & Iz from diagonal inertia

// variablesMatrix34 Mtx; // contains position & orientationVector3 Momentum,AngMomentum;

// accumulatorsVector3 Force,Torque;

};

Page 49: Slide Dynamics

Rigid Body Simulation

RigidBody::ApplyForce(Vector3 &f,Vector3 &pos) {Force += f;Torque += (pos-Mtx.d) x f

}

Page 50: Slide Dynamics

Rigid Body SimulationRigidBody::Update(float time) {

// Update positionMomentum += Force * time;Mtx.d += (Momentum/Mass) * time; // Mtx.d = position

// Update orientationAngMomentum += Torque * time;Matrix33 I = Mtx·I0·MtxT // A·I0·AT

Vector3 ω = I-1·Lfloat angle = |ω| * time; // magnitude of ωVector3 axis = ω;axis.Normalize();Mtx.RotateUnitAxis(axis,angle);

}