Rigid Bodies Simulation Homework

Rigid Bodies Simulation Homework

Rigid Bodies Simulation Homework • Build a particle system based either on F=ma or procedural simulation – Examples:Thursday Smoke, Fire, Water, Wind, Leaves, Cloth, Magnets, Flocks, Fish, Insects, Crowds, etc. • SimulateSimulation a Rigid Body & – Examples: Angry birds, Bodies tumbling, bouncing, moving around in a room and colliding, Explosions & Fracture, Drop theUnity camera, Etc… Rigid Body as “Particle Chunks” A small chunk of a rigid body Consider a rigid body It can be broken up into chunks (or elements), and each chunk can be treated as a single particle if it is small enough Center of Mass • A body composed of 푛 particle “chunks” with masses 푚푖 has total mass 푛 푀 = ෍ 푚푖 푖=1 • If the particles have positions 푥Ԧ푖, the center of mass is σ푛 푚 푥Ԧ 푥ҧ = 푖=1 푖 푖 푀 • The center of mass for a rigid body has position 푥ҧ and translational velocity 푣ҧ similar to a single particle • When we refer to the position and velocity of a rigid body, we are referring to the position and translational velocity of its center of mass • The center of mass obeys the same ODEs for position and velocity as a particle does, but using the TOTAL mass and the NET force Orientation Orientation • A rigid body can rotate or change its orientation while its center of mass is stationary • Different ways to keep track of the rotation 푅: – 3x3 Matrix, 3 Euler angles, 1 Quaternion • Place a coordinate system at the center of mass in object space • The rotation 푅 rotates the rigid body (and the object space coordinate system) into its world space orientation • Recall: the columns of 푅 are the three object space axes in their world space orientations Combining Position and Orientation • The rigid body has an intrinsic coordinate system in its object space, with its center of mass at the origin • It’s put into world space with a translation and a rotation 푅 푥ҧ t 푥푤 푥푏 Combining Position and Orientation • The translation of the origin of the object space coordinate system is given by the position of the center of mass 푥ҧ • The world space orientation of the object space coordinate system is given by 푅 – Assume 푅 is a matrix, equivalently expressed as a unit quaternion • A point 푥표 in object space has a world space location 푥푤 = 푥ҧ + 푅푥표 – Notice that the center of mass (at the origin) maps to 푥ҧ – Notice that (1,0,0), (0,1,0), (0,0,1) are all rotated by 푅 before being translated by 푥ҧ Angular Velocity Angular Velocity • Both 푥ҧ and 푅 are functions of time • The rate of change of the position of the center of mass 푥ҧ with respect to time is the translational velocity of the center of mass 푣ҧ • (From our quaternion discussion…) The orientation of the body is changing as it is rotated about some axis 푛ො emanating from the center of mass • The rate of change of the orientation 푅 is given by the world space angular velocity 휔 – its direction is the axis of rotation, 푛ො – Its magnitude is the speed of rotation • The pointwise velocity of any point x on the rigid body is given by 푣푝 = 푣ҧ + 휔 × 푥 − 푥ҧ = 푣ҧ + 휔 × 푟 where r is the moment arm and × is the cross-product Aside: Cross Product Matrix • Given vectors 푎 = [푎1, 푎2, 푎3] and 푏 = 푏1, 푏2, 푏3 , their cross product 푎 × 푏 can be written as matrix multiplication 푎∗푏 by converting 푎 to a cross product matrix 0 −푎3 푎2 ∗ • 푎 = 푎3 0 −푎1 −푎2 푎1 0 • 푎∗푇 = −푎∗ • 푎∗푏 = −푏∗푎 • Using this new notation, the pointwise velocity of any point x on the object is then given by: ∗ 푣푝 = 푣ҧ + 휔 푟 Linear and Angular Velocity 휔 푣ҧ 푥ҧ ODE for Orientation • The ODE for orientation (angular position) is given by 푅ሶ = 휔∗푅 • That is, 푅ሶ = 휔 × 푅 where the cross product is applied independently to each of the three columns of 푅 • Writing the 3x3 matrix 휔∗ and using matrix multiplication 휔∗푅 automatically performs these 3 cross products Inertia Tensor Inertia Tensor • Linear momentum is defined as the product of the mass times the translational velocity – Mass is something that resists change in velocity • Angular momentum 퐿 is defined as an “angular mass” times the angular velocity 휔 • The “angular mass” is called the moment of inertia (or inertia tensor) 퐼 of the rigid body • If you spin in your chair while extending your legs, and then suddenly pull your legs closer the chair spins faster – 퐼 reduces when you pull your legs closer. – Hence 휔 has to increase to keep angular momentum 퐿 = 퐼휔 constant Inertia Tensor • For a system of n particles, the angular momentum is 푤 ∗ ∗ ∗ ∗ 퐿 = ෍(푥푖 ) 푚푖푣푖 = ෍ 푥ҧ + 푟푖 푚푖푣푖 = 푥ҧ 푀푣ҧ + ෍ 푟푖 푚푖푣푖 푖 푖 푖 푡ℎ – where 푟푖 is the moment arm of the 푖 particle ∗ • 푣푖 can be written as 푣ҧ + 휔 푟푖 so ∗ ∗ ∗ ∗ 퐿 = 푥ҧ 푀푣ҧ + ෍ 푟푖 푚푖푣ҧ + ෍ 푟푖 푚푖휔 푟푖 푖 푖 ∗ ∗ 푇 • σ푖 푟푖 푚푖푣ҧ = (푣ҧ ) σ푖 푚푖푟푖 = 0 so ∗ ∗ 푇 ∗ ∗ 퐿 = 푥ҧ 푀푣ҧ + ෍ 푚푖(푟푖 ) 푟푖 휔 = 푥ҧ 푀푣ҧ + 퐼휔 푖 ∗ 푇 ∗ – where 퐼 = σ푖 푚푖(푟푖 ) 푟푖 Object Space Inertia Tensor • We can pre-compute the object space inertia tensor as a 3x3 matrix 퐼표 • Then, the world space inertia tensor is given by the 3x3 matrix 퐼 = 푅퐼표푅푇 • One can compute the SVD of the symmetric 3x3 matrix 퐼표 to obtain 퐼표 = 푈퐷푈푇 where 퐷 is a 3x3 diagonal matrix of 3 singular values • Then rotating the object space rest state of the rigid body by 푈−1 gives a new object space inertia tensor of 푈−1퐼표푈−푇 = 푈−1푈퐷푈푇푈−푇 = 퐷 • That is, properly orienting the rest pose of a rigid body in object space gives a diagonal object space inertia tensor 퐼표 Forces and Torques Forces and Torques • Newton’s second law for angular quantities • A force 퐹 changes both the linear momentum 푀푣ҧ and the rotational (angular) momentum 퐿 • The change in linear momentum is independent of the point on the rigid body 푥 where the force is applied • The change in angular momentum does depend on the point 푥 where the force is applied • The torque is defined as 휏 = 푥 − 푥ҧ × 퐹 = 푟 × 퐹 • The net change in angular momentum is given by the sum of all the external torques 퐿ሶ = 휏 ODEs Rigid Body: Equations of Motion • State vector for a rigid body 푥ҧ 푅 푋 = 푀푣ҧ 퐿 • Equations of motion 푥ҧ 푣ҧ 푑 푑 푅 휔∗푅 푋 = = 푑푡 푑푡 푀푣ҧ 퐹 퐿 휏 Rigid Body: Equations of Motion • State vector for a rigid body 푥ҧ 푅 푋 = 푣ҧ 퐿 • Equations of motion 푥ҧ 푣ҧ Equations of 푑 푑 푅 휔∗푅 motion for a 푋 = = particle at the 푑푡 푑푡 푣ҧ 퐹/푀 center of mass 퐿 휏 Forward Euler Update 푣ҧ 푛 휔∗푅 푋푛+1 = 푋푛 + Δ푡 퐹/푀 휏 • Newmark for better accuracy and stability, etc… • Better results are obtained on the second equation by rotating the columns of 푅 directly using the vector Δ푡휔 • Need to periodically re-orthonormalize the columns of 푅 to keep it a rotation matrix Rigid Body: Equations of Motion • State vector for a rigid body 푥ҧ 푞 푋 = 푣ҧ 퐿 • Equations of motion 푣ҧ 푥ҧ 1 푑 푑 푞 휔∗푞 푋 = = 2 푑푡 푑푡 푣ҧ 퐿 퐹/푀 휏 • Once again, preferable to rotate q by Δ푡휔 • Renormalize q using a square root Question #1 LONG FORM: • Summarize rigid body simulation. • Identify 10 rigid bodies in a typical room. SHORT FORM: • Identify 10 rigid bodies in this room. Geometry Rigid Body Modeling • Store an object space triangulated surface to represent the surface of the rigid body • Store an object space implicit surface to represent the interior volume of the rigid body • Collision detection between two rigid bodies can then be carried out by checking the surface of one body against the interior volume of another • Implicit surfaces can be used to model the interior volume of kinematic and static objects as well • Implicit surface representations of interior volumes can also be used for collisions with particles and particle systems Recall: Implicit Surfaces • Implicit surfaces represent a surface with a function 휙(푥) defined over the whole 3D space • The inside region Ω−, the outside region is Ω+, and the surface 휕Ω are all defined by the function 휙(푥) • 휙 푥 < 0 inside • 휙 푥 > 0 outside • 휙 푥 = 0 surface • Easy to check if a point is inside an object • Efficient to make topology changes to an object • Efficient boolean operations: Union, Difference, Intersection Analytic Implicit Surfaces • For simple functions, write down the function and analytically evaluate 휙(푥) to see if 휙 푥 < 0 and thus 푥 is inside the object • 2D circle • 3D ellipsoid Discrete Implicit Surfaces • Lay down a grid that spans the space you are trying to represent, e.g. a padded bounding box • Store values of the function at grid points • Then for arbitrary locations in space, interpolate from the nearby values on the grid to see if 휙 푥 < 0 • use trilinear interpolation, like 3D textures • Signed Distance Functions are implicit surfaces where the magnitude of the function gives the distance to the closet point on the surface Constructing Signed Distance Functions • Start with a triangulated surface • Place a grid inside a slightly padded bounding box of the object – This grid will contain point samples for the signed distance function – The resolution of the grid is based on heuristics • Place a sphere at every grid point and find all intersecting triangles – the radius of the sphere only needs to be a few grid cells wide, because we only care about grid points near the triangulated surface – If the sphere does not intersect any triangles, then the grid point is not near the triangulated surface – (An acceleration structure is useful, e.g.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    44 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us