Rigid Body Dynamics 2 CSE169: Compute Animation nstucto: Steve Rotenbeg UCSD, Winte 2018
Coss Poduct & Hat Opeato
Deivative of a Rotating Vecto Let s say that vecto is otating aound the oigin, maintaining a fied distance At any instant, it has an angula velocity of ω d dt ω ω ω
Poduct Rule The poduct ule of diffeential calculus can be etended to vecto and mati poducts 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
Rigid Bodies We teat a igid body as a system of paticles, whee the distance between any two paticles is fied We will assume that intenal foces ae geneated to hold the elative positions fied. These intenal foces ae all balanced out with Newton s thid law, so that they all cancel out and have no effect on the total momentum o angula momentum The igid body can actually have an infinite numbe of paticles, spead out ove a finite volume nstead of mass being concentated at discete points, we will conside the density as being vaiable ove the volume
Rigid Body Mass With a system of paticles, we defined the total mass as: m n i1 m i Fo a igid body, we will define it as the integal of the density ρ ove some volumetic domain Ω m d
Angula Momentum The linea momentum of a paticle is p = mv We define the moment of momentum (o angula momentum) of a paticle at some offset as the vecto L = p Like linea momentum, angula momentum is conseved in a mechanical system f the paticle is constained only to otate so that the diection of is changing but the length is not, we can e-epess its velocity as a function of angula velocity ω: v = ω This allows us to e-epess L as a function of ω: L = p = mv = m v = m ω L = m ω L = m ω
Rotational netia L = m ω We can e-wite this as: L = ω whee = m We ve intoduced the otational inetia mati, which elates the angula momentum of a otating paticle to its angula velocity
Rotational netia of a Paticle 2 2 2 2 2 2 0 0 0 0 0 0 ˆ ˆ y z y z z y z y z y z y y z y z y z y z m m m
Rotational netia of a Paticle ω L 2 2 2 2 2 2 y z y z z y z y z y z y m m m m m m m m m
Rotational netia of a Rigid Body Fo a igid body, we eplace the single mass and position of the paticle with an integation ove all of the points of the igid body times the density at that point
Rigid Body Rotational netia zz yz z yz yy y z y y z y z z y z y z y z y d d d d d d d d d 2 2 2 2 2 2
Rotational netia The otational inetia mati is a 33 symmetic mati that is essentially the otational equivalent of mass t elates the angula momentum of a system to its angula velocity by the equation L ω This is simila to how mass elates linea momentum to linea velocity, but otation adds additional compleity p m v
Rotational netia The cente of mass of a igid body behaves like a paticle- it has position, velocity, momentum, etc., and it esponds to foces though f=ma Rigid bodies also add popeties of otation. These behave in a simila fashion to the tanslational popeties, but the main diffeence is in the velocity-momentum elationships: p = mv vs. L = ω We have a vecto p fo linea momentum and vecto L fo angula momentum We also have a vecto v fo linea velocity and vecto ω fo angula velocity n the linea case, the velocity and momentum ae elated by a single scala m, but in the angula case, they ae elated by a mati This means that linea velocity and linea momentum always line up, but angula velocity and angula momentum don t Also, as itself changes as the object otates, the elationship between ω and L changes This means that a constant angula momentum may esult in a non-constant angula velocity, thus esulting in the tumbling motion of igid bodies
Rotational netia L = ω Remembe eigenvalue equations of the fom A=b whee given a mati A, we want to know if thee ae any vectos that when tansfomed by A esult in a scaled vesion of the (i.e., ae thee vectos who s diection doesn t change afte being tansfomed?) A symmetic 33 mati (like ) has 3 eal eigenvalues and 3 othonomal eigenvectos f the angula momentum L lines up with one of the eigenvectos of, then ω will line up with L and the angula velocity will be constant Othewise, the angula velocity will be non-constant and we will get tumbling motion We call these eigenvectos the pincipal aes of the igid body and they ae constant elative to the geomety of the igid body Usually, we want to align these to the, y, and z aes when we initialize the igid body. That way, we can epesent the otational inetia as 3 constants (which happen to be the 3 eigenvalues of )
Pincipal Aes We see thee eample angula momentum vectos L and thei coesponding angula velocities ω, all based on the same otational inetial mati We can see that L 1 and L 3 must be aligned with the pincipal aes, as they esult in angula velocities in the same diection as the angula momentum L 1 L 2 ω 2 ω 1 L 3 ω 3
Pincipal Aes & netias f we diagonalize the mati, we get an oientation mati A and a constant diagonal mati o The mati A otates the object fom an oientation whee the pincipal aes line up with the, y, and z aes The thee values in o, (namely, y, and z ) ae the pincipal inetias. They epesent the esistance to toque aound the coesponding pincipal ais (in a simila way that mass epesents the esistance to foce)
Diagonalization of Rotational netial z y T zz yz z yz yy y z y whee 0 0 0 0 0 0 0 0 A A
Paticle Dynamics Position Velocity Acceleation Mass Momentum Foce
Rigid Body Dynamics Oientation (33 mati) Angula Velocity (vecto) Angula Acceleation (vecto) = A 0 A T Rotational netia (33 mati) Momentum (vecto) Toque (vecto)
Newton-Eule Equations f ma τ ω ω ω
Toque-Fee Motion We can solve the Newton-Eule equations fo the acceleation tems: a = 1 m f ഥω = 1 τ ω ω We see that acceleation a will be 0 if thee is no foce f Howeve, if thee is no toque τ, thee may still be some angula acceleation: ഥω = 1 ω ω We call this toque-fee motion and this is esponsible fo tumbling motion we see in igid bodies
Rigid Body Simulation Each fame, we can apply seveal foces to the igid body, that sum up to one total foce and one total toque f = f i τ = i f i We can then integate the foce and toque ove the time step to get the new linea and angula momenta p = p + f t L = L + τ t We can then compute the linea and angula velocities fom those: v = 1 m p ω = 1 L We can now integate the new position and oientation: = + v t A = A Rotate(ω t)
Rigid Body Simulation At some point, we need to compute 1 whee = A 0 A T Note the identity S T 1 = T 1 S 1 Likewise STU 1 = U 1 T 1 S 1 Also, as A is othonomal, A 1 = A T Theefoe 1 = A 0 A T 1 = A 0 1 A T As 0 is diagonal, 0 1 is easy to pe-compute
Rigid Body Set-Up To define a igid body fom a physics point of view, we need only 4 constants: its mass m, and its pincipal otational inetias, y, and z Fo collision detection and endeing, we will also want some type of geomety- and we can calculate the inetia popeties fom this We epect that the geomety fo the igid body is positioned such that the cente of mass lies at the oigin and that the pincipal aes line up with, y, and z One way to do this is to use simple shapes like sphees and boes. We can use simple fomulas to calculate m,, y, and z fom the dimensions and density (see last lectue fo some of these) Altenately, we can use a tiangle mesh as input and calculate the inetia popeties fom that
Mitich-Ebely Algoithm n 1996, Bian Mitich published an algoithm fo analytically calculating the inetia popeties of a polygonal mesh and in 2002, David Ebely steamlined the algoithm specifically fo tiangle meshes The esulting algoithm loops though each tiangle, makes seveal elatively simple calculations pe tiangle, and ultimately ends up with eact values fo the total volume, cente of mass, and all 6 otational inetia integals We could conceivably input any mesh, calculate the popeties, and then e-cente the mesh to move the cente of mass to the oigin, and then diagonalize the otational inetia mati and e-otate the mesh by the esulting otation to align the pincipal aes with, y, and z
Kinematics of Offset Points
Offset Position Let s say we have a point on a igid body f is the wold space offset of the point elative to the cente of mass of the igid body, then the position of the point in wold space is: cm
Offset Position cm = cm +
Offset Velocity The velocity of the offset point is just the deivative of its position cm v d dt d dt cm d dt v v cm ω
Offset Acceleation The offset acceleation is the deivative of the offset velocity v v cm ω a dv dt dv dt cm dω dt ω d dt a a cm ω ω ω
Kinematics of an Offset Point The kinematic equations fo a fied point on a igid body ae: cm v v cm ω a a cm ω ω ω
nvese Mass Mati
Offset Foces Suppose we have a paticle f we apply a foce to it, what is the esulting acceleation? Easy:
Offset Foces With igid bodies, the same holds tue fo the acceleation of the cente of mass Howeve, what if we e inteested in the acceleation of some offset point? f we apply a foce f to a igid body at offset 1, what is the esulting acceleation at a (possibly) diffeent offset 2?
Offset Foces f we apply a foce f to a igid body at offset 1, what is the esulting acceleation at a offset 2? a =? f 2 1
Offset Foces
Offset Foces
Offset Foces So, when we apply a foce f at 1, we get the esulting igid body acceleations: But we e inteested in the acceleation at offset 2, so we need to use:
Offset Foces
nvese Mass Mati
nvese Mass Mati We call M -1 an invese mass mati, (and we can call M the mass mati) t lets us apply a foce at 1 and find the esulting acceleation at 2 in a f=ma fomat t also lets us apply an impulse at 1 and find the esulting change in velocity Note: 1 can equal 2, allowing us to find the esulting acceleation at the same offset whee we apply the foce
nvese Mass Mati Why do we cae? Well, this lets us do all kinds of useful things such as collisions and constaints Fo a collision, fo eample, we can use it to solve what impulse will pevent the velocity of a colliding point to go though anothe object Fo a constaint, we can solve the constaint foce the holds an offset point still (zeo acceleation)
Collisions & Constaints
Collisions Lets say we have a igid body that hits the gound at offset point We will assume the collision has zeo elasticity and high enough fiction to zeo out any tangential velocity The velocity at the collision point is The collision will esult in an impulse that causes the offset velocity v to go to zeo immediately afte the collision Theefoe, we want to solve fo impulse j:
Collisions Thee s a lot moe to say about collisions Fo states, that eample was of one igid body colliding with an infinite mass and we ll need to have igid bodies colliding with othe igid bodies Also, we want to handle non-zeo elasticity, and a ealistic fiction model Then comes issues of multiple simultaneous collisions Then static contact situations Then olling and sliding Then stacking
Constaints t is common to add constaints to a igid body system that allows us to ceate aticulated figues with vaious joint types Fo eample, we could constain an offset position of one igid body to match a diffeent offset position on anothe igid body, thus ceating a ball-and-socket type joint The constaint would apply some foce to the fist igid body and an equal an opposite foce to the second. The constaint foce would be whateve foce is necessay to keep the two points fom sepaating We can use the invese mass mati technique to fomulate an equation that lets us solve fo the unknown constaint foce f multiple objects ae constained togethe in a lage goup, then we must simultaneously solve fo all of these constaint foces in one big system of equations
Constaints & Collisions t tuns out that constaints and collisions can be fomulated in vey simila ways although thee ae some impotant diffeences (namely, constaints fom equality equations and collisions fom inequality equations) They can all be included in one big system and then solved by a special inequality solve called an LCP solve (LCP stands fo linea complementaity poblem) o by othe techniques This lets us combine igid body motion, constaints, and collisions into one single pocess The details ae outside the scope of this class, but ve included a pdf on the web page that gives an oveview of the state of the at in igid body simulation