collision detection i motivation
play

Collision Detection I Motivation F d X S, X Collision Force - PowerPoint PPT Presentation

CPSC 599.86 / 601.86 Sonny Chan - University of Calgary Collision Detection I Motivation F d X S, X Collision Force detection response F d F r Control algorithms Haptic rendering Problem Definition We seek efficient algorithms to


  1. CPSC 599.86 / 601.86 Sonny Chan - University of Calgary Collision Detection I

  2. Motivation F d X S, X Collision Force detection response F d F r Control algorithms Haptic rendering

  3. Problem Definition ‣ We seek efficient algorithms to answer the following queries: - Intersection query (do objects overlap?) - Contact manifolds (set of contact points) - Penetration depth / intersection volume - Separation distance ‣ Difficulty increases as we move down...

  4. Geometric Representations Many different ways to describe the same object

  5. Surface Representations ‣ Implicit surface: S ( x, y, z ) = 0 ‣ Parametric surface: P ( u, v ) | u, v ∈ D ‣ Point-sampled surface (point cloud) ‣ Polygonal mesh: - Triangle mesh - Quadrilateral (quad) mesh ‣ ... any other ones you can think of?

  6. Triangle Meshes Why is this the most popular representation?

  7. Terminology ‣ Objects are composed of primitive shapes ‣ Broad phase - Which objects are in a vicinity? ‣ Narrow phase - Does the geometry intersect?

  8. Broad Phase Collisions No possibility of intersection

  9. Broad Phase Collisions ? Possible intersection

  10. Narrow Phase Collisions Collision!

  11. Today’s Lecture

  12. Primitive Tests

  13. Tests for Meshes ‣ The two most common collision queries for haptic rendering of polygonal meshes: - line segment-triangle intersection test - triangle-triangle intersection test

  14. Ray-Triangle Intersection

  15. Ray-Triangle Intersection ‣ Find intersection between line and plane ‣ Discard if point is outside segment range ‣ Use barycentric coordinates to determine if the point is inside the triangle

  16. Barycentric Coordinates p 2 v ( . 6 , . 4 , 0) p 1 ( . 3 , . 2 , . 5) w u p 0 f ( u, v ) = (1 − u − v ) p 0 + u p 1 + v p 2

  17. Barycentric Coordinates p 2 u = A 1 A A 0 v = A 2 p 1 A 1 A ( . 3 , . 2 , . 5) A 2 A = 1 2 | ( p 1 − p 0 ) × ( p 2 − p 0 ) | p 0 f ( u, v ) = (1 − u − v ) p 0 + u p 1 + v p 2

  18. A Direct Approach A ray: r ( t ) = o + t d A triangle: f ( u, v ) = (1 − u − v ) p 0 + u p 1 + v p 2 Ray-triangle intersect: o + t d = (1 − u − v ) p 0 + u p 1 + v p 2     t Rearrange terms:  − d p 1 − p 0 p 2 − p 0  = o − p 0 u   v Solve for t, u, and v ...

  19. Cramer’s Rule ‣ Given the set of linear equations     x  a b c  = d y   z ‣ Write the determinant of the matrix � � a 1 b 1 c 1 � � � � det( a , b , c ) = a 2 b 2 c 2 � � � � a 3 b 3 c 3 ‣ Then � � x = det( d , b , c ) y = det( a , d , c ) z = det( a , b , d ) det( a , b , c ) det( a , b , c ) det( a , b , c )

  20. A Direct Approach     t Our equation:  − d p 1 − p 0 p 2 − p 0  = o − p 0 u   v     det( s , e 1 , e 2 ) t 1  = Applying Cramer’s rule: det( − d , s , e 2 ) u    det( − d , e 1 , e 2 ) det( − d , e 1 , s ) v where e 1 = p 1 − p 0 , e 2 = p 2 − p 0 , s = o − p 0 Check t, u, v within intervals!

  21. Geometric Interpretation M 0 ] D 0 V 2 V 2 0 M V 1 0 V 0   M =  − d p 1 − p 0 p 2 − p 0  [from T. Möller & B. Trumbore, Journal of Graphics Tools , 1997.]

  22. Triangle-Triangle Intersection

  23. Triangle-Triangle Intersection ‣ Triangles A and B may intersect if they cross each other’s plane ‣ Test A’s vertices against B’s plane, and vice versa for rejection ‣ Test for interval overlap along the line of intersection

  24. Half-Plane Test � � a x b x c x d x � � � � a y b y c y d y � � [ a , b , c , d ] = � � a z b z c z d z � � � � 1 1 1 1 � � = ( d − a ) · (( b − a ) × ( c − a )) ‣ Geometric interpretation: - This tests which side of the plane defined by triangle abc the point d is on

  25. Half-Plane Test ‣ Given two triangles: 4 p 1 q 1 r 1 4 p 2 q 2 r 2 and ‣ We can first perform the half-plane test on triangle one: [ p 2 , q 2 , r 2 , p 1 ] [ p 2 , q 2 , r 2 , q 1 ] [ p 2 , q 2 , r 2 , r 1 ] ‣ Then symmetrically perform the half-plane test on the other triangle...

  26. Intersection of Intervals L L [from T. Möller, Journal of Graphics Tools , 1997.]

  27. Interval Intersection Test ‣ Intervals on line L are p 2 I 1 = [ i, j ] I 2 = [ k, l ] L q 1 ‣ Intervals overlap if l r 1 k j i p 1 k ≤ j and i ≤ l r 2 ‣ Perform two additional q 2 determinant tests: [ p 1 , q 1 , p 2 , q 2 ] [ p 1 , r 1 , r 2 , p 2 ]

  28. Triangle-Triangle Summary ‣ Compute three 4x4 determinants to test first triangle against the second’s plane ‣ If triangle intersects the plane, perform the symmetric test using three more determinants ‣ If both triangles intersect the other’s plane, perform interval overlap test on the intersecting line with two last 4x4 determinants ‣ What happens with co-planar triangles?!

  29. Two of My Favorite Books No need to memorize any of these algorithms!

  30. Some Easier Stuff... ‣ Mesh geometry intersection tests are expensive, and must be performed for every triangle ‣ Collision detection can be sped up significantly by using rejection tests on bounding volumes

  31. Bounding Volumes ‣ Most common bounding volumes are spheres and boxes ‣ Two most common collision queries: - Sphere-sphere intersection - Box-box intersection

  32. Sphere-Sphere Intersection ? Easiest one in the book!

  33. Sphere-Sphere Intersection c 2 ‣ Two spheres intersect if the separation r 2 between their centers is less than the sum of their radii: c 1 || c 1 − c 2 || < r 1 + r 2 r 1

  34. Box-Box Intersection p max p min ‣ An axis-aligned box is represented by lower (minimum coordinate) and upper (maximum coordinate) vertices ‣ How do we detect intersection of boxes?

  35. Box-Box Intersection b max ‣ Two axis-aligned boxes intersect if the lower coordinate of each box a max is bounded by the upper coordinate of the other: a min < b max b min < a max a min

  36. Oriented Box Intersection How do we test for this kind of box intersection?

  37. Separating Hyperplane Theorem ‣ Two convex polytopes can be separated by a hyperplane if and only if they are disjoint ‣ For disjoint polyhedra, there exists a separating plane parallel to a face on either polyhedron, or an edge selected from each polyhedron (why?)

  38. Separating Axis Test ‣ Project all vertices onto the normal of the separating plane (“separating axis”) ‣ Projections from each polytope form an interval ‣ Polytopes are disjoint if intervals are disjoint

  39. Oriented Box Intersection

  40. Oriented Box Intersection ‣ Perform separating axis test on every possible axis: - 3 axes (faces of box A) - 3 axes (faces of box B) - 3 x 3 = 9 axes from pairs of box edges ‣ Total: 15 separating axis tests

  41. Primitive Test Summary ‣ We covered fast intersection tests for: - Segment-triangle - Triangle-triangle - Sphere-sphere - Axis-aligned bounding box (AABB) - Oriented bounding box (OBB) ‣ Look up others if needed!

  42. Summary ‣ We can test collision between two objects, but what happens if there are thousands?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend