Rigid Body Dynamics CSE169: Computer Animation Instructor: Steve - - PowerPoint PPT Presentation
Rigid Body Dynamics CSE169: Computer Animation Instructor: Steve - - PowerPoint PPT Presentation
Rigid Body Dynamics CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2020 Cross Product i j k = a b a a a x y z b b b x y z = a b a b a b a b a b a b a b y
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
Properties of the Cross Product
◼
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 + + − = − + = + − = = − − − = 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
Cross Product
− − − = = − − − = ˆ ˆ
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
Hat Operator
◼ We’ve introduced the ‘hat’ operator which converts a
vector into a skew-symmetric matrix (ො 𝐛𝑈 = −ො 𝐛)
◼ This allows us to turn a cross product of two vectors into
a dot product of a matrix and a vector
◼ This is mainly for algebraic convenience, as the dot
product is associative (although still not commutative) ො 𝐛 ∙ 𝐜 = 𝐛 × 𝐜 ො 𝐛 ∙ 𝐜 ≠ 𝐜 ∙ ො 𝐛 (non commutative) ො 𝐛 ∙ መ 𝐜 ∙ 𝐝 = ො 𝐛 ∙ መ 𝐜 ∙ 𝐝 (associative)
Derivative of a Rotating Vector
◼ Let’s say that vector r is rotating around the
- rigin, 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 + = + = + =
Eigenvalue Equation
◼
Symmetric Matrix
◼
Symmetric Matrix Diagonalization
◼
Dynamics of Particles
Kinematics of a Particle
- n
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
◼ It is typically represented with a capital L, which is
unfortunately inconsistent with our standard of using lowercase for vectors…
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
- f 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 it’s 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
ˆ ˆ
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
Systems of Particles
momentum tal to mass
- f
center
- f
position particles all
- f
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 it’s 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 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
- f action, the torques on the center of mass
cancel out as well
Dynamics of Rigid Bodies
Kinematics of a Rigid Body
◼ For the position of 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
◼
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
- r 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
- f the density ρ over some volumetric domain Ω
= d m
=
=
n i i
m m
1
Rigid Body Center of Mass
◼ The center of mass is:
= d d
cm
x x
Rotational Inertia of a Particle
◼
Rigid Body Rotational Inertia
( ) ( ) ( )
= + − − − + − − − + =
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
Rigid Body Rotational Inertia
◼
The rigid body rotational inertia is a 3x3 symmetric matrix that encodes the distribution of mass around the center of mass
◼
It is calculated by calculating the integrals on the previous slide by integrating over the volume of the rigid body where r indicates the vector from the center of mass to the position of the volume integration element and ρ represents the density at that location
◼
These integrals can be calculated with analytical formulas for simple shapes like spheres, cylinders, and boxes
◼
There also exists an analytical technique for computing them on triangle meshes as well (Mirtich-Eberly algorithm)
Rotational Inertia Diagonalization
◼
Diagonalization of Rotational Inertia
◼
Rotational Inertia of a Box
◼
Rotational Inertia of a Sphere
◼
Rotational Inertia
◼
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 ˆ ˆ ˆ ˆ − = + = + = + = + = + = = 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 = Mtx·I0·MtxT // A·I0·AT Vector3 ω = I-1·L float angle = |ω| * time; // magnitude of ω Vector3 axis = ω; axis.Normalize(); Mtx.RotateUnitAxis(axis,angle); }