i t m i x i x i done before the weekend t x i x t m i
play

( ) ( ) I ( t ) = m i x i X i done before the weekend T x i - PDF document

Notes Inertia Tensor Simplified Assignment 2 going okay? Reduce expense of calculating I(t): T x i X Make sure you understand what needs to be ( ) ( ) I ( t ) = m i x i X i done before the weekend T x i X


  1. Notes Inertia Tensor Simplified � Assignment 2 going okay? � Reduce expense of calculating I(t): � T x i � X � • Make sure you understand what needs to be � ( ) ( ) I ( t ) = m i x i � X i done before the weekend T x i � X [ T ] � m i ( x i � X ) ( ) � � x i � X ( ) x i � X ( ) = � Read Guendelman et al, “Nonconvex rigid i bodies with stacking”, SIGGRAPH’03 • Now use x i -X=Rp i and use R T R= � � � � S T F ext = � � Mistake last class: � � f i X * T � x i * T � � (forgot a transpose i � [ T R T Rp i � � Rp i p i T R T ] � � I ( t ) = m i p i � f i in calculating torque) i � � i = T p i � � p i p i � � ( ) � � ( T ) R T ( x i � X ) � f i = R m i p i � � i 1 4 i 4 4 2 4 4 4 3 � � � = F � I body � � � cs533d-winter-2005 1 cs533d-winter-2005 2 Inertia Tensor Simplified 2 Degenerate Inertia Tensors � So just compute inertia tensor once, for object � Inertia tensor can always be inverted unless all space configuration the points of the object line up (object is a rod) • Or there’s only one point � Then I(t)=RI body R T � We don’t care though, since we can’t track � And I(t) -1= R(I body ) -1 R T rotation around that axis anyways • So precompute inverse too • So diagonalize I, and only invert nonzero elements � In fact, since I is symmetric, know we have an orthogonal eigenbasis Q � Rotate object-space orientation by Q • Then I body is just diagonal! cs533d-winter-2005 3 cs533d-winter-2005 4 Taking the limit Computing Inertia Tensors � p T p � � pp T ��� ( ) dp I body = � Letting our decomposition of the object � Do the integrals: p into point masses go to infinity: � Lots of “fun” • Instead of sum over particles, � You may just want to look them up instead • E.g. Eric Weisstein’s World of Science on the web integral over object volume • Instead of particle mass, � If not…. align axis perpendicular to planes of symmetry (of � ) in object space density at that point in space • Guarantees some off-diagonal zeros � Example: sphere, uniform density, radius R � ��� m i foo( x i ) � � ( x ) foo( x ) dx � 5 MR 2 � 2 0 0 i x � � 5 MR 2 0 2 0 � � � � 5 MR 2 2 0 0 � � cs533d-winter-2005 5 cs533d-winter-2005 6

  2. Approximating Inertia Tensors Combining Objects � For complicated geometry, don’t really need � What if object is union of two simpler objects? exact answer � Integrals are additive � Could just take the inertia tensor from a simpler • But DO NOT USE I 1 (t)+I 2 (t): geometric figure (will anyone notice?) � World-space formulas (x-X) use the X for the object: X 1 and X 2 may be different � Or numerically approximate integral � Simplified I body formula based on having centre of mass at • If we can afford to spend a lot of time precomputing, origin • Let’s work it out from the integral of I(t) life is simple • Grid approach: sample density… � Combined mass: M=M 1 +M 2 • Monte Carlo approach: random samples � Centre of mass of combined object: � � x = M 1 X 1 + M 2 X 2 � 1 �� 2 X = � M � cs533d-winter-2005 7 � 1 �� 2 cs533d-winter-2005 8 Combined Inertia Tensor Numerical Integration � Recall equations of motion � T x � X � � ( ) ( ) I ( t ) = � x � X dt V = F M d dt L = � d � 1 �� 2 � T x � X 1 + X 1 � X � � � ( ) ( ) L = � x � X 1 + X 1 � X + � 1 � 2 � = I ( t ) � 1 L d dt X = V � T x � X 1 � T x � X 1 � � � � ( ) ( ) ( ) ( ) = � x � X 1 + � X 1 � X � 1 � 1 dt R = � � R d � T X 1 � X � T X 1 � X � + � � � � ( ) ( ) ( ) ( ) L + � x � X 1 + � X 1 � X � 1 � 1 � 2 � X and V is just like particle motion � T � � T � � � ( ) ( ) ( ) ( ) = I 1 ( t ) + X 1 � X � x � X 1 + � x � X 1 X 1 � X 1 � 1 4 4 2 4 4 3 1 � 1 4 4 2 4 4 3 � Angular components trickier: 0 0 R must remain orthogonal, but standard � T X 1 � X � + � integration will cause it to drift + M 1 X 1 � X ( ) ( ) L � 2 • Can use Gram-Schmidt, but expensive and biased � T X 1 � X � T X 2 � X � + I 2 ( t ) + M 2 X 2 � X � = I 1 ( t ) + M 1 X 1 � X ( ) ( ) ( ) ( ) cs533d-winter-2005 9 cs533d-winter-2005 10 Improving on R What are quaternions? � Instead of 9 numbers for 3 DOF, use a � Instead of R, use q=(s,x,y,z) with |q|=1 • Can think of q as a “super complex number” less redundant representation s+xi+yj+zk � Euler angles: 3 numbers • i 2 =j 2 =k 2 =-1, ij=-ji=k, jk=-kj=i, ki=-ik=j • But updating with angular velocity is painful • Quaternions don’t commute! q 1 q 2 � q 2 q 1 in general � Quaternions: 4 numbers � Represents “half” a rotation: • s=cos( � /2) • |x,y,z| 2= sin 2 ( � /2) • Axis of rotation is (x,y,z) � Conjugate (inverse for unit norm) is q = ( s , � x , � y , � z ) cs533d-winter-2005 11 cs533d-winter-2005 12

  3. Rotating with quaternions Integrating Rotation q (0, p ) q � Can update like Symplectic Euler, but � Instead of Rp, calculate need to renormalize q after each step � Composing a rotation of � t � to advance a time step: � � � For reasonable accuracy, limit time step q n + 1 = cos � t � 2 , sin � t � � q n � � according to rate of rotation 2 � � � • Don’t try for more than a quarter turn per time � For small � t � approximate: step, say � � q n + 1 = 1, � t � q n = q n + � t (0, � ) • Stability is not an issue due to renormalization q n � � � 2 � 2 � For more accurate methods, see S. R. Buss, “Accurate and efficient simulation of � From this get the differential equation: rigid body rotations”, JCP 2000 q = 1 ˙ 2 (0, � ) q cs533d-winter-2005 13 cs533d-winter-2005 14 Converting q to R Gravity � Clearly superior to use quaternions for storing � Force on a point is m i g and updating orientation � Net force: � But, slightly faster to transform points with � F = m i g = Mg rotation matrix i � If you need to transform a lot of points (collision detection…) may want to convert q into R � Net torque: � ( ) � m i g � = x i � X � Basic idea: columns of R are rotated axes i R(1,0,0) T , R(0,1,0) T , and R(0,0,1) T � � � � � � Do the rotation with q instead. m i x i � � MX � � g = � � � � • Can simplify and optimize for the zeros - look it up � � � � i = 0 cs533d-winter-2005 15 cs533d-winter-2005 16 Collision Impulses Frictionless impulse � Can use same collision detection as deformable � Object velocities at point: objects • v i = � i � (x-X i )+V i • Since geometry is fixed, may be cheaper � Relative velocity v=v 1 -v 2 • E.g. can use level set approximation to geometry • Normal component v n =v•n � But applying collision impulses is more � Want post-collision relative normal velocity to be complicated than for simple particles v nafter =- � v n • Need to take into account angular motion too � Apply an impulse j=j n n in the normal direction to � Use same principle though for the colliding achieve this V i after = V i + M i � 1 j i points after = L i + x � X i ( ) � j i L i • What is the impulse that causes their relative velocity after = � i + I i ( t ) � 1 x � X i ( ) � j i to change as desired? � i j i = ( � 1) i + 1 j n n cs533d-winter-2005 17 cs533d-winter-2005 18

  4. Computing frictionless impulse Computing friction � Static friction valid only in “friction cone” K i = 1 � T I i � 1 x � X i � � + x � X i ( ) ( ) j T � µ j n M i � Approach: ( ) v n � 1 + � • Calculate static friction impulse (whatever it j = ) n n n T K 1 + K 2 takes to make relative velocity zero) ( • Check if it’s in the friction cone • If so, we’re done • If not, try again with sliding cs533d-winter-2005 19 cs533d-winter-2005 20 Computing static friction Sliding friction � If computed static friction impulse fails v after = � � v n n friction cone test � We’ll assume sliding direction stays � 1 � v � � v n n constant during impact: tangential j = K 1 + K 2 ( ) ( ) impulse just in the initial relative velocity direction • Not true in some situations… cs533d-winter-2005 21 cs533d-winter-2005 22 Computing sliding friction Rigid Collision Algorithms � Use the same collision response algorithm as T = v � v n n with particles • Identify colliding points as perhaps the deepest v � v n n penetrating points, or the first points to collide • Make sure they are colliding, not separating! j = j n n � µ j n T � Problem: multiple contact points • Fixing one at a time can cause rattling. • Can fix by being more gentle in resolving contacts - ( ) v n � 1 + � negative coefficient of restitution j n = � Problem: multiple collisions (stacks) n T K 1 + K 2 ( ) ( n � µ T ) • Fixing one penetration causes others • Solve either by resolving simultaneously or enforcing order of resolution cs533d-winter-2005 23 cs533d-winter-2005 24

Recommend


More recommend