47
Rigid Body Dynamics [email protected]

Rigid Body Dynamics - Carnegie Mellon University

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Rigid Body [email protected]

Rigid Body Dynamics

SF1SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

What is a Rigid Body?

X =X =

( )x t!""#""$

( )x t!""#""$

Particle StateParticle StateParticle State

( )v t!""#""$

( )v t!""#""$

( )( )

( )

x tt

v tX

! "= # $% &

( )( )

( )

x tt

v tX

! "= # $% &

SF2SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

x(t)x(t)

v(t)v(t)

Particle MotionParticle MotionParticle Motion

SF3SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

( )v t!""#""$

( )v t!""#""$

State DerivativeState DerivativeState Derivative

( ) /F t m!""#""$

( ) /F t m!""#""$

( ) ( )( )

( ) ( ) /

x t v td dt

v t F t mdt dtX

! " ! "= =# $ # $

% & % &

( ) ( )( )

( ) ( ) /

x t v td dt

v t F t mdt dtX

! " ! "= =# $ # $

% & % &

d

dt=X

d

dt=X

SF4SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

F(t)F(t)

v(t)v(t)

x(t)x(t)

Particle DynamicsParticle DynamicsParticle Dynamics

SF5SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Multiple ParticlesMultiple ParticlesMultiple Particles

SF7SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

6n elements6n elements...... ......

State DerivativeState DerivativeState Derivative

1 1

1 1 1

( ) ( )

( ) ( ) /

( ) ( )

( ) ( ) /

n n

n n n

x t v t

v t F t md d

dt dtx t v t

v t F t m

X ! !

! " ! "# $ # $# $ # $

= =# $ # $# $ # $# $ # $# $ # $% & % &

1 1

1 1 1

( ) ( )

( ) ( ) /

( ) ( )

( ) ( ) /

n n

n n n

x t v t

v t F t md d

dt dtx t v t

v t F t m

X ! !

! " ! "# $ # $# $ # $

= =# $ # $# $ # $# $ # $# $ # $% & % &

d

dt=X

d

dt=X

SF6SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

......

ODE solutionODE solutionODE solution

0( )tX 0( )tX

1( )tX 1( )tX

0( )t t+ !X 0( )t t+ !X

0( )d

dttX 0( )d

dttX

0( )d

dtt t+ !X 0( )d

dtt t+ !X

SF8SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

ODE solverODE solver

Dxdt()DxdtDxdt()()

lenlenlen

void Dxdt(double t, double x[], double xdot[])

void Dxdt(double t, double x[], double xdot[])

0( )tX 0( )tX

1( )tX 1( )tX0t0t

1t1t

SF9SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

1

1 1

( )

( ) /

( )

( ) /

n

n n

v t

F t m

v t

F t m

!

1

1 1

( )

( ) /

( )

( ) /

n

n n

v t

F t m

v t

F t m

!

Dxdt()DxdtDxdt()()

( )t =X( )t =X ( )d

tdt

=X( )d

tdt

=X

1

1

( )

( )

( )

( )

n

n

x t

v t

x t

v t

!

1

1

( )

( )

( )

( )

n

n

x t

v t

x t

v t

!

SF10SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

What We Have

ODE solverODE solver

Dxdt()DxdtDxdt()()

lenlenlen

void Dxdt(double t, double x[], double xdot[])

void Dxdt(double t, double x[], double xdot[])

0( )tX 0( )tX

1( )tX 1( )tX0t0t

1t1t

SF9SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

1

1 1

( )

( ) /

( )

( ) /

n

n n

v t

F t m

v t

F t m

!

1

1 1

( )

( ) /

( )

( ) /

n

n n

v t

F t m

v t

F t m

!

Dxdt()DxdtDxdt()()

( )t =X( )t =X ( )d

tdt

=X( )d

tdt

=X

1

1

( )

( )

( )

( )

n

n

x t

v t

x t

v t

!

1

1

( )

( )

( )

( )

n

n

x t

v t

x t

v t

!

SF10SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Our Goal

ODE solverODE solver

Dxdt()DxdtDxdt()()

lenlenlen

void Dxdt(double t, double x[], double xdot[])

void Dxdt(double t, double x[], double xdot[])

0( )tX 0( )tX

1( )tX 1( )tX0t0t

1t1t

SF9SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

1

1 1

( )

( ) /

( )

( ) /

n

n n

v t

F t m

v t

F t m

!

1

1 1

( )

( ) /

( )

( ) /

n

n n

v t

F t m

v t

F t m

!

Dxdt()DxdtDxdt()()

( )t =X( )t =X ( )d

tdt

=X( )d

tdt

=X

1

1

( )

( )

( )

( )

n

n

x t

v t

x t

v t

!

1

1

( )

( )

( )

( )

n

n

x t

v t

x t

v t

!

SF10SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Replicate this approach for rigid bodies.

v(t)v(t)

x(t)x(t)

Rigid Body StateRigid Body StateRigid Body State

( )

( )( )

x t

tv t

?

?

X

! "# $# $=# $# $% &

( )

( )( )

x t

tv t

?

?

X

! "# $# $=# $# $% &

SF11SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Rigid Body Equation of MotionRigid Body Equation of MotionRigid Body Equation of Motion

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

SF12SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Use Momentum P=Mv instead of just v.What is this?

?

We represent orientation as a rotation matrix

R(t). Points are transformed from body-space to

world-space as:

We represent orientation as a rotation matrix

R(t). Points are transformed from body-space to

world-space as:

††

††He’s lying. Actually, we use quaternions.He’s lying. Actually, we use quaternions.

OrientationOrientationOrientation

0( ) ( ) ( )p t t p x t= +R 0( ) ( ) ( )p t t p x t= +R

SF14SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

00

p(t)p(t)

body spacebody space world spaceworld space

x(t)x(t)

0p0p

SF15SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Rigid Body Equation of MotionRigid Body Equation of MotionRigid Body Equation of Motion

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

SF12SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

What is this?

R(t)?

!(t)!(t)

x(t)x(t)

Angular Velocity DefinitionAngular Velocity DefinitionAngular Velocity Definition

SF17SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Rigid Body Equation of MotionRigid Body Equation of MotionRigid Body Equation of Motion

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

SF12SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

What is this?

R(t)

ω(t)

?

Discretized View

• Total Mass: M =∑

i

mi

• Center of Mass: x =1M

i

mixi

• Relative Position: ri = xi − x

Discretized View

• Basic Principles:

• Conservation of Linear Momentum

• Conservation of Angular Momentum

r

d

dt

i

mixi = 0

d

dt

i

miri × xi = 0

Conservation and ForcesLinear

Momentumd

dt

i

mixi =∑

i

fi

i

mixi = F=

(x =

1M

i

mixi

)

(M ¨x =

i

mixi

)

M ¨x = F

(def)

v(t)v(t)

x(t)x(t)

f1

f1

f2

f2

f3

f3

Net ForceNet ForceNet Force

( ) iF t f=!( ) iF t f=!

SF13SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Rigid Body Equation of MotionRigid Body Equation of MotionRigid Body Equation of Motion

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

( ) ( )

( )( ) ( )

x t v t

d dt

Mv t F tdt dt

? ?

?

X

?

! " ! "# $ # $# $ # $= =# $ # $# $ # $% & % &

SF12SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

What are these?

R(t)

ω(t)

We represent angular velocity as a vector !(t),

which encodes both the axis of the spin and the

speed of the spin.

We represent angular velocity as a vector !(t),

which encodes both the axis of the spin and the

speed of the spin.

How are R(t) and !(t) related?How are R(t) and !(t) related?

Angular VelocityAngular VelocityAngular Velocity

SF16SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

0 ( ) ( )

( ) ( ) 0 ( ) ( )

( ) ( ) 0

( ) ( )

z y

z x

y x

t td

t t t tdt

t t

t t

R R

R

! !

! !

! !

! "

#$ %& '

= #& '& '#( )

=

0 ( ) ( )

( ) ( ) 0 ( ) ( )

( ) ( ) 0

( ) ( )

z y

z x

y x

t td

t t t tdt

t t

t t

R R

R

! !

! !

! !

! "

#$ %& '

= #& '& '#( )

=

Angular VelocityAngular VelocityAngular Velocity

and are rel( ) ( ) ated by:t tR !•

and are rel( ) ( ) ated by:t tR !•

SF18SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

can be viewed as the matrix form ofw∗ −(w×)

( )( )

( ) ( ) ( )( )

( ) (

( )

)

t

v tx t

td d t tt

Mv tdt dt F t

R

?

RX

!

!

"

# $# $% &% &% &% &= =% &% &% &% & % &

' ( ' (

( )( )

( ) ( ) ( )( )

( ) (

( )

)

t

v tx t

td d t tt

Mv tdt dt F t

R

?

RX

!

!

"

# $# $% &% &% &% &= =% &% &% &% & % &

' ( ' (

Need to relate !(t) and mass distribution to F(t).Need to relate !(t) and mass distribution to F(t).••

Rigid Body Equation of MotionRigid Body Equation of MotionRigid Body Equation of Motion

SF19SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Conservation and ForcesLinear

MomentumAngular

Momentumd

dt

i

miri × xi =∑

i

ri × fid

dt

i

mixi =∑

i

fi

i

mixi = F=

(x =

1M

i

mixi

)

(M ¨x =

i

mixi

)

M ¨x = F

(def)

x(t)x(t)

f1

f1

f2

f2

f3

f3

p1

p1

p2

p2

p3

p3

Net TorqueNet TorqueNet Torque

( )( ) ( )i it p x t f! = " #$( )( ) ( )i it p x t f! = " #$

SF22SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Conservation and ForcesLinear

MomentumAngular

Momentumd

dt

i

miri × xi =∑

i

ri × fid

dt

i

mixi =∑

i

fi

i

mixi = F=

(x =

1M

i

mixi

)

(M ¨x =

i

mixi

)

M ¨x = F

(def)

d

dt

i

miri × ω × ri = τ

d

dt

i

mir∗i r∗i ω = τ

d

dt

i

miri × xi = τ

Discrete Inertia

I =∑

i

mir∗i r∗i

I =∑

i

mi

−y2 − z2 xy xz

xy −x2 − z2 yzxz yz −x2 − y2

Conservation and ForcesLinear

MomentumAngular

Momentumd

dt

i

miri × xi =∑

i

ri × fid

dt

i

mixi =∑

i

fi

i

mixi = F=

(x =

1M

i

mixi

)

(M ¨x =

i

mixi

)

M ¨x = F

(def)

d

dt

i

miri × ω × ri = τ

d

dt

i

mir∗i r∗i ω = τ

d

dtIω = τ

d

dt

i

miri × xi = τ

P(t) – linear momentum

L(t) – angular momentum

P(t) – linear momentum

L(t) – angular momentum

Rigid Body Equation of MotionRigid Body Equation of MotionRigid Body Equation of Motion

( ) ( )

( )( )

( )

(

( ) ( )( )

( )

( )

)

v tx t

td d t tt

dt M

t t

v tdt F t

t

R RX

I

!

"!

#

$ %$ %& '& '& '& '= =& '& '& '& ' & '( ) ( )( ) ( )

( )( )

( )

(

( ) ( )( )

( )

( )

)

v tx t

td d t tt

dt M

t t

v tdt F t

t

R RX

I

!

"!

#

$ %$ %& '& '& '& '= =& '& '& '& ' & '( ) ( )

SF21SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Discrete Inertia

I =∑

i

mir∗i r∗i

I =∑

i

mi

−y2 − z2 xy xz

xy −x2 − z2 yzxz yz −x2 − y2

( )

xx xy xz

yx yy yz

zx zy zz

I I I

t I I I

I I I

I

! "# $

= # $# $% &

( )

xx xy xz

yx yy yz

zx zy zz

I I I

t I I I

I I I

I

! "# $

= # $# $% &

2 2( )xxV

I M y z dV= +' 2 2( )xxV

I M y z dV= +'off-diagonal termsoff-diagonal termsdiagonal termsdiagonal terms

Inertia TensorInertia TensorInertia Tensor

xyV

I M xydV= ( 'xyV

I M xydV= ( '

SF20SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Continuous Inertia

Inertia Tensors Vary in World Space...Inertia Tensors Vary in World Space...Inertia Tensors Vary in World Space...

2 2( )xx

V

I M y z dV= +!2 2

( )xxV

I M y z dV= +! xyV

I M xydV= " !xyV

I M xydV= " !SF23SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

body( ) ( ) ( )Tt t tI R I R= body( ) ( ) ( )Tt t tI R I R=

... but are Constant in Body Space... but are Constant in Body Space... but are Constant in Body Space

SF24SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Pros:Pros: Simple.Simple.Cons:Cons: Bounding box may not be a good fit.Bounding box may not be a good fit.

Inaccurate.Inaccurate.

Approximating Ibody: Bounding BoxesApproximatingApproximating IIbodybody: Bounding Boxes: Bounding Boxes

SF25SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Pros:Pros: Simple, fairly accurate, no B-rep needed.Simple, fairly accurate, no B-rep needed.Cons:Cons: Expensive, requires volume test.Expensive, requires volume test.

Approximating Ibody: Point SampingApproximatingApproximating IIbodybody: Point: Point Samping Samping

SF26SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Pros:Pros: Simple, exact, no volumes needed.Simple, exact, no volumes needed.Cons:Cons: Requires boundary representation.Requires boundary representation.Code: Code: http://www.http://www.acmacm.org/.org/jgtjgt/papers/Mirtich96/papers/Mirtich96

Computing Ibody: Green’s Theorem (2x!)ComputingComputing IIbodybody: Green’s Theorem (2x!): Green’s Theorem (2x!)

SF27SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Summary

P(t) – linear momentum

L(t) – angular momentum

P(t) – linear momentum

L(t) – angular momentum

Rigid Body Equation of MotionRigid Body Equation of MotionRigid Body Equation of Motion

( ) ( )

( )( )

( )

(

( ) ( )( )

( )

( )

)

v tx t

td d t tt

dt M

t t

v tdt F t

t

R RX

I

!

"!

#

$ %$ %& '& '& '& '= =& '& '& '& ' & '( ) ( )( ) ( )

( )( )

( )

(

( ) ( )( )

( )

( )

)

v tx t

td d t tt

dt M

t t

v tdt F t

t

R RX

I

!

"!

#

$ %$ %& '& '& '& '= =& '& '& '& ' & '( ) ( )

SF21SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

ODE solverODE solver

Dxdt()DxdtDxdt()()

lenlenlen

void Dxdt(double t, double x[], double xdot[])

void Dxdt(double t, double x[], double xdot[])

0( )tX 0( )tX

1( )tX 1( )tX0t0t

1t1t

SF9SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

1. Implementation of1. Implementation of DxdtDxdt()() for rigid bodiesfor rigid bodies

(bookkeeping, data structures, computations) (bookkeeping, data structures, computations)

2.2. Quaternions Quaternions—derivations and code—derivations and code

3. Miscellaneous formulas and examples3. Miscellaneous formulas and examples

4. Derivations for force and torque equations,4. Derivations for force and torque equations,

center of mass, inertia tensor, rotation center of mass, inertia tensor, rotation

equations, velocity/acceleration of points equations, velocity/acceleration of points

What’s in the Course NotesWhat’s in the Course NotesWhat’s in the Course Notes

SF28SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING

Example

Example

These simulations could never have been created by hand.

Question• What Kind of Collisions Are Possible?

• Geometrically?

• Physically?

• How can these be detected?

• What algorithm can handle them?