Notes Other Standard Approach � Find where line intersects plane of triangle � Email list � Check if it � s on the segment • Even if you � re just auditing! � Find if that point is inside the triangle • Use barycentric coordinates � Slightly slower, but worse: less robust • round-off error in intermediate result: the intersection point • What happens for a triangle mesh? � Note the predicate approach, even with floating- point, can handle meshes well • Consistent evaluation of predicates for neighbouring triangles cs533d-term1-2005 1 cs533d-term1-2005 2 Distance to Triangle Testing Against Meshes � If surface is open, define interference in terms of � Can check every triangle if only a few, but distance to mesh too slow usually � Typical approach: find closest point on triangle, then distance to that point � Use an acceleration structure: • Direction to closest point also parallel to natural normal • Spatial decomposition: � First step: barycentric coordinates background grid, hash grid, octree, kd-tree, • Normalized signed volume determinants equivalent to solving least squares problem of closest point in plane BSP-tree, … � If coordinates all in [0,1] we � re done • Bounding volume hierarchy: � Otherwise negative coords identify possible closest axis-aligned boxes, spheres, oriented boxes, edges … � Find closest points on edges cs533d-term1-2005 3 cs533d-term1-2005 4
Moving Triangles For Later… � Collision detection: find a time at which particle � We now can do all the basic particle vs. lies inside triangle object tests for repulsions and collisions � Need a model for what triangle looks like at � Once we get into simulating solid objects, intermediate times • Simplest: vertices move with constant velocity, we � ll need to do object vs. object instead triangle always just connects them up of just particle vs. object � Solve for intermediate time when four points are � Core ideas remain the same coplanar (determinant is zero) • Gives a cubic equation to solve � Then check barycentric coordinates at that time • See e.g. X. Provot, “Collision and self-collision handling in cloth model dedicated to design garment", Graphics Interface � 97 cs533d-term1-2005 5 cs533d-term1-2005 6 Elasticity Elastic objects � Simplest model: masses and springs � Split up object into regions � Integrate density in each region to get mass (if things are uniform enough, perhaps equal mass) � Connect up neighbouring regions with springs • Careful: need chordal graph � Now it � s just a particle system • When you move a node, neighbours pulled along with it, etc. cs533d-term1-2005 7 cs533d-term1-2005 8
Masses and springs 1D masses and springs � But: how strong should the springs be? Is � Look at a homogeneous elastic rod, length 1, this good in general? linear density � • [anisotropic examples] � Parameterize by p (x(p)=p in rest state) � General rule: we don � t want to see the � Split up into intervals/springs mesh in the output • 0 = p 0 < p 1 < … < p n = 1 • Avoid “grid artifacts” • Mass m i = � (p i+1 -p i-1 )/2 (+ special cases for ends) L i + 12 = p i + 1 � p i • We of course will have numerical error, but • Spring i+1/2 has rest length let � s avoid obvious patterns in the error x i + 1 � x i � L i + 12 and force f i + 12 = k i + 12 L i + 12 cs533d-term1-2005 9 cs533d-term1-2005 10 Figuring out spring constants Young’s modulus � So net force on i is � So each spring should have the same k • Note we divided by the rest length x i + 1 � x i � L i + 12 x i � x i � 1 � L i � 12 F i = k i + 12 � k i � 12 • Some people don � t, so they have to make their L i + 12 L i � 12 constant scale with rest length � � � � x i + 1 � x i x i � x i � 1 = k i + 12 � 1 � � k i � 12 � 1 � The constant k is a material property (doesn � t � � � p i + 1 � p i p i � p i � 1 � � � � depend on our discretization) called the Young � s modulus � We want mesh-independent response (roughly), • Often written as E e.g. for static equilibrium • Rod stretched the same everywhere: x i = � p i � The one-dimensional Young � s modulus is simply • Then net force on each node should be zero force per percentage deformation (add in constraint force at ends…) cs533d-term1-2005 11 cs533d-term1-2005 12
The continuum limit Sound waves � Try solution x(p,t)=x 0 (p-ct) � Imagine � p (or � x) going to zero • Eventually can represent any kind of � And x(p,t)=x 0 (p+ct) E deformation � So speed of “sound” in rod is � • [note force and mass go to zero too] � Courant-Friedrichs-Levy (CFL) condition: � � � � � p E ( p ) � � ( p ) = 1 � a x ( p ) � 1 � � • Numerical methods only will work if information ˙ ˙ � � x � � � � � transmitted numerically at least as fast as in reality (here: the speed of sound) • If density and Young � s modulus constant, • Usually the same as stability limit for good explicit methods [what are the eigenvalues here] � 2 x � 2 x � t 2 = E • Implicit methods transmit information infinitely fast � � p 2 cs533d-term1-2005 13 cs533d-term1-2005 14 Why? � Are sound waves important? • Visually? Usually not � However, since speed of sound is a material property, it can help us get to higher dimensions � Speed of sound in terms of one spring is kL c = � So in higher dimensions, just pick k so that c is constant m • m is mass around spring [triangles, tets] • Optional reading: van Gelder cs533d-term1-2005 15
Recommend
More recommend