Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Collision Detection an Overview
Next
Download to read offline and view in fullscreen.

5

Share

Download to read offline

Collision Detection In 3D Environments

Download to read offline

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Collision Detection In 3D Environments

  1. 1. Ntreev Soft (in-house training) 1 Collision Detection In 3D Environments Collision Detection In 3D Environments 이웅수 peras@ntreev.com oiotoxt@gmail.com Ntreev Soft Co. Ltd. v0.2
  2. 2. Ntreev Soft (in-house training) 2 Collision Detection In 3D Environments Notice • 본 문서를 외부에 유포하지 말아주세요. • 본 문서는 2004년 7월 23일 현재 v0.1 입니다. • 본 문서는 2004년 7월 29일 현재 v0.2 입니다. • 본 문서에 포함된 도안들 중 많은 부분은 여러 다른 저자(Bibliography & People)들의 paper를 참고하거나 그것으로부터 발췌한 것입니다. 그 들의 관용을 바랍니다. Beauty is our business. – Edsger W. Dijkstra
  3. 3. Ntreev Soft (in-house training) 3 Collision Detection In 3D Environments Contents • Concepts: – Geometry – Terminologies – (Time, Response, Performance, Robustness) • Spatial Data Structures – Nonconvex Polyhedra (Convex Decomposition) – Space Partitioning (Voxel Grid, Quadtree, Octree, k-d Tree, BSP) – Model Partitioning (BVH) – Broad Phase Collision Detection (Sweep and Prune) • Scene Management – Portals, PVS, Scene Graph, LOD • Basic Primitives – Sphere: Sphere – Sphere, Ray – Sphere, Line segment – Sphere – AABB: Ray – Box, Sphere – Box – SAT (Separating Axis Test) : Line segment – Box, Triangle – Box, Box – Box – Polygons: Ray – Triangle, Line segment – Triangle, Ray – Polygon, Triangle – Triangle, Polygon – Polygon, Triangle – Sphere, Polygon - Volume • Convex Objects – Finding a Common Point – Finding a Separating Plane – GJK (Gilbert-Johnson-Keerthi) Distance Algorithm & Enhanced GJK – Lin-Canny Closest Feature Algorithm – Voronoi Clip Algorithm (V-Clip)
  4. 4. Ntreev Soft (in-house training) 4 Collision Detection In 3D Environments Geometry • Classical Geometry – Euclidean Geometry – Non-Euclidean Geometry – Affine Geometry • Modern Geometry – Topology – Differential Geometry – Complex Projective Geometry – Finite Projective Geometry • Reference: [KK88]
  5. 5. Ntreev Soft (in-house training) 5 Collision Detection In 3D Environments Euclidean Geometry • 유클레이데스 <원론 (Stoicheia)> • 유클레이데스기하학에서의 변환 f – 1대 1의 점대응 – 선분(또는 직선)은 선분(또는 직선)에 대응 – 길이를 바꾸지 않는 대응 • 즉, f 변환으로 바뀌지 않는 성질이 곧 유클레이데스기하학의 ‘기하학적 성질’ 이다.
  6. 6. Ntreev Soft (in-house training) 6 Collision Detection In 3D Environments Affine Geometry • F. Klein이 <Erlangen Programm>에서 아핀변환에 의해 변하지 않는 기하학 의 이론을 ‘아핀기하학’이라고 명명. • 아핀변환 f – 1대 1의 점대응 – 직선 → 직선 • 즉, 아핀변환 f 는 평행투영에 의한 변환이며 직선, 교점, 평행관계 등은 그대로 유지되나, 길이, 각의 크기 등의 개념은 무의미 (모든 3각형은 같은 도형)
  7. 7. Ntreev Soft (in-house training) 7 Collision Detection In 3D Environments Non-Euclidean Geometry • 19세기에 이르러 확립 • 유클레이데스의 <원론> ‘제5공준(=평행선 공준)’ – 『직선 a 위에 없는 한 점 P를 지나 a와 만나지 않는 직선은 오직 한 개만 그을 수 있다 』 – 『P를 지나 a와 만나지 않는 직선을 무수히 그을 수 있다 』고 가정하여 도 전혀 모순이 일어나지 않는 기하학이 성립. • 평행선의 개수를 이용한 기하학 분류 – 직선 바깥의 한 점을 지나는 평행선이 오직 한 개 존재 : 유클레이데스기하학 무수히 존재 : 로바체프스키-보야이의 비유클레이데스기하학 하나도 존재하지 않음 : 리만의 비유클레이데스기하학
  8. 8. Ntreev Soft (in-house training) 8 Collision Detection In 3D Environments Projective Geometry (1) • 대응(=寫像)에 의해서 도형의 성질을 다루는 기하학
  9. 9. Ntreev Soft (in-house training) 9 Collision Detection In 3D Environments Projective Geometry (2) • 『Projective geometry is all geometry 』 사영기하학 비유클레이데스기하학 아핀기하학 유클레이데스기하학쌍곡선기하학 타원기하학
  10. 10. Ntreev Soft (in-house training) 10 Collision Detection In 3D Environments Topology • ‘위’(=위치, Lage)와 ‘상’(=형상, Gestalt)에 관한 (정성적) 수학(기하학) • 동상 – C ≡ I ≡ J ≡ L ≡ M ≡ N ≡ S ≡ U ≡ V ≡ W ≡ Z, – E ≡ F ≡ G ≡ T ≡ Y, H ≡ K, A ≡ R, D ≡ O, P, B, Q, X • 동형 • 위상공간(=Topological space) – 위상적 구조가 주어진 (=집합의 원소 사이에 ‘근방’이 정의되어진) 집합. • 위상 공간 ⊃ 거리 공간 ⊃ 유클레이데스 공간 • V – E + F = 2 (다면체), V – E + F = 0 (윤환면)
  11. 11. Ntreev Soft (in-house training) 11 Collision Detection In 3D Environments Vector Space • Let V be a set whose elements are called vectors. • Assume that equality of vectors is defined. • Suppose that there are two operations, vector addition (+) and scalar multiplication (•), such that the following properties hold. • 10 Axioms ( a, b, c ∈ R and v, u, w ∈ V ) 1. ( closure under + ) u + v ∈ V 2. ( + is associative ) u + (v + w) = (u + v) + w 3. ( + is commutative ) u + v = v + u 4. ( additive identity ) There is a vector 0 ∈ V such that v + 0 = v for any v ∈ V 5. ( additive inverses ) for each v ∈ V there is a vector –v ∈ V such that v + (-v) = 0 6. ( closure under • ) c • v ∈ V, written simply as cv 7. ( • is distributive over real addition ) (a + b)v = av + bv 8. ( • is distributive over vector addition ) a(u + v) = au + av 9. ( • is associative ) a(bv) = (ab)v 10. ( multiplicative identity ) The number 1 ∈ R has the property 1•v = v • The triple ( V, +, • ) is called a vector space over the real numbers.
  12. 12. Ntreev Soft (in-house training) 12 Collision Detection In 3D Environments Computational Geometry • Application Domain – Computer Graphics – Robotics – GIS (Geographic Information Systems) – CAD (Computer Aided Design) / CAM (Computer Aided Manufacturing) – Molecular modeling – Pattern recognition • Reference: [BKOS00]
  13. 13. Ntreev Soft (in-house training) 13 Collision Detection In 3D Environments Terminologies (1) • Convex, Concave • BV (Bounding Volume) • Manifold & Non-Manifold – Roughly, every edge has two faces joining it. • k-DOP ⊃ OBB ⊃ AABB • Half Space • SSV (Swept Sphere Volumes, S-topes) • Features Convex Concave Manifold Non-Manifold
  14. 14. Ntreev Soft (in-house training) 14 Collision Detection In 3D Environments Terminologies (2) • Simplices – Points, Line segments, Triangles, Tetrahedra • Polygons • Polyhedra • Convex quadrics – Spheres, Cones, Capped cones, Cylinders, Capped cylinder, … • Convex objects – Simplices, Convex polygons, Convex polyhedra, Convex quadrics, … • Polytopes – Simplices ∪ Convex polygons ∪ Convex polyhedra • Polygon Soups
  15. 15. Ntreev Soft (in-house training) 15 Collision Detection In 3D Environments Terminologies (3) • CD (Collision Detection), PD (Penetration Depth) • Proximity Query – A procedure to compute the geometric contact (and distance) between objects. • Convex Hulls • Minkowski Addition / Difference • CSO (Configuration Space Obstacle) • Voronoi Diagrams, Voronoi Sites, Voronoi Regions • Frame Coherence, Geometric Coherence • Interval Halving • Ω-notation (asymptotic lower bound) & O-notation (asymptotic upper bound)
  16. 16. Ntreev Soft (in-house training) 16 Collision Detection In 3D Environments AABB and OBB
  17. 17. Ntreev Soft (in-house training) 17 Collision Detection In 3D Environments k-DOP • k-DOP (Discrete Orientation Polytope) • Set of k / 2 infinite slabs. • There is an even faster test if all objects have the same k and same slab normals. • OBB and AABB are 6-DOP
  18. 18. Ntreev Soft (in-house training) 18 Collision Detection In 3D Environments SSV PSS LSS RSS
  19. 19. Ntreev Soft (in-house training) 19 Collision Detection In 3D Environments Boundary Representations • Winged Edge Structure – by Baumgart • DCEL (Doubly Connected Edge List) – by Muller and Preparata • Hierarchical Representation – by Dobkin and Kirkpatrick
  20. 20. Ntreev Soft (in-house training) 20 Collision Detection In 3D Environments Convex Hulls (1) • The smallest convex shape that contains a given collection of convex shapes[vdB04]. • The convex hull of a set of points S in n dimensions is the intersection of all convex sets containing S. For N points P1, ..., PN, the convex hull C is then given by the expression[Mw].
  21. 21. Ntreev Soft (in-house training) 21 Collision Detection In 3D Environments Convex Hulls (2) • The incremental construction algorithm – Let PS be a set of n points in 3-space. CH(PS) is the convex hull of PS. – Choose four points in PS that do not lie in a common plane, so that their convex hull is a tetrahedron. – Let PSr := { p1, …, pr }. – If pr lies inside CH(PSr-1), or on its boundary, then CH(PSr) = CH(PSr-1) – Now suppose that pr lies outside CH(PSr-1). Imagine that you are standing at pr, and that you are looking at CH(PSr-1). You will be able to see some facets of CH(PSr-1). The visible facets form a connected region on the surface of CH(PSr-1), called the visible region of pr on CH(PSr-1), which is enclosed by a closed curve consisting of edges of CH(PSr-1). We call this curve the horizon of pr on CH(PSr- 1). The horizon of pr forms the border between the part of the boundary that can be kept and the part of the boundary that must be replaced. – Suppose that we knew all facets of CH(PSr-1) visible from pr. Then it would be easy to remove all the information stored for these facets from the DCEL, compute the new facets connecting pr to the horizon, and store the information for the new facets in the DCEL. • Reference: [BKOS00]
  22. 22. Ntreev Soft (in-house training) 22 Collision Detection In 3D Environments Minkowski Addition / Difference • The convex shape that is the result of “adding” two convex shapes, that is, sweeping one shape along the point set of another. • Minkowski Sum (The sum of sets A and B in a vector space) – A + B = { a + b : a ∈ A, b ∈ B} • The negation operation – -B = { -b : b ∈ B }
  23. 23. Ntreev Soft (in-house training) 23 Collision Detection In 3D Environments CSO • Configuration Space Obstacle – A + (-B) = A – B • The CSO contains all the information needed to answer a number of queries on pairs of objects in the context of collision detection. – A ∩ B ≠ Ø ≡ 0 ∈ A – B – The distance between two objects A and B, denoted by d(A,B), is defined as d(A,B) = min{ ║a - b║ : a ∈ A, b ∈ B } d(A,B) = min{ ║x║ : x ∈ A - B } – The penetration depth of a pair of intersecting objects, denoted by p(A,B), is the length of the shortest vector over which one of the objects needs to be translated in order to bring the pair in touching contact. p(A,B) = inf { ║x║ : x ∈ A – B } (infimum: greatest lower bound)
  24. 24. Ntreev Soft (in-house training) 24 Collision Detection In 3D Environments Voronoi Diagram • The partitioning of a plane with n points into n convex polygons such that each polygon contains exactly one point and every point in a given polygon is closer to its central point than to any other[Mw]. Voronoi Site Voronoi Region Voronoi Diagram
  25. 25. Ntreev Soft (in-house training) 25 Collision Detection In 3D Environments Coherences • Frame Coherence – The measure of reusability of computations from earlier frames. • Geometric Coherence – “Geometric coherence has to do with the degree to which a location in space can be associated with one designated object, rather than the degree to which objects cohere.” • Reference: [vdB04]
  26. 26. Ntreev Soft (in-house training) 26 Collision Detection In 3D Environments Asymptotic Complexity log n n n log n (fastest sorting)n22n n
  27. 27. Ntreev Soft (in-house training) 27 Collision Detection In 3D Environments Spatial Data Structures • Convex Decomposition (Nonconvex Polyhedra) – Joe’s Algorithm • Space Partitioning (SP) – Voxel Grid – Quadtree – Octree – k-d Tree – BSP (Axis Aligned, Polygon Aligned) • Model Partitioning – Bounding Volume Hierarchies (BVH) • Broad Phase Collision Detection – Sweep and Prune
  28. 28. Ntreev Soft (in-house training) 28 Collision Detection In 3D Environments Space Partitioning • Algorithms: – Voxel Grid – Quadtree – Octree – k-d Tree – BSP (Axis Aligned, Polygon Aligned) Voxel Grid Quadtree & Octree k-d Tree BSP
  29. 29. Ntreev Soft (in-house training) 29 Collision Detection In 3D Environments Octree
  30. 30. Ntreev Soft (in-house training) 30 Collision Detection In 3D Environments k-d Tree 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 8 9 10 11 12 13 14 15 4 5 6 7 2 3 1
  31. 31. Ntreev Soft (in-house training) 31 Collision Detection In 3D Environments Bounding Volume Hierarchies (1) • Bounding Volumes – OBB, AABB, k-DOP, Sphere, SSV, Convex hull, Ellipsoid, … AABB OBBSphere Convex Hull6-DOP Cost of (Overlap Tests + BV Update), Complexity, Tightness of Fit Decreasing Increasing
  32. 32. Ntreev Soft (in-house training) 32 Collision Detection In 3D Environments Bounding Volume Hierarchies (2) • A binary bounding volume hierarchy
  33. 33. Ntreev Soft (in-house training) 33 Collision Detection In 3D Environments Bounding Volume Hierarchies (3) • Building an OBB Tree – Recursive top-down construction (Partition and Refit) A B C D E A B C D E
  34. 34. Ntreev Soft (in-house training) 34 Collision Detection In 3D Environments Bounding Volume Hierarchies (4) • Fitting OBBs
  35. 35. Ntreev Soft (in-house training) 35 Collision Detection In 3D Environments Bounding Volume Hierarchies (5) • Basic Hierarchy Traversal
  36. 36. Ntreev Soft (in-house training) 36 Collision Detection In 3D Environments Bounding Volume Hierarchies (6) • Dual Hierarchy Traversal
  37. 37. Ntreev Soft (in-house training) 37 Collision Detection In 3D Environments Bounding Volume Hierarchies (7) • AABB Trees vs OBB Trees (Approximation of a Torus)
  38. 38. Ntreev Soft (in-house training) 38 Collision Detection In 3D Environments Bounding Volume Hierarchies (8) • AABB Trees and Deformable Models
  39. 39. Ntreev Soft (in-house training) 39 Collision Detection In 3D Environments SP vs BVH BVH: Object centric, Spatial redundancy SP: Space centric, Object redundancy
  40. 40. Ntreev Soft (in-house training) 40 Collision Detection In 3D Environments Sweep and Prune (1) • Compute the AABB (fixed vs dynamic) for each object. • Dimension reduction by projecting AABB onto each x, y, z – axis. • Sort the endpoints and find overlapping intervals. • Possible collision – Only if projected intervals overlap in all 3 dimensions. • Sorting Methods – Initial sort [Quick sort] runs in O(n log n) just as in any ordinary situation. – Updating [Insertion sort] runs in O(n + k) due to coherence. – We sort an almost sorted list from last stimulation step. – In fact, we look for “swap” of positions in all 3 dimension. • Reference: [Bar92][vdB04]
  41. 41. Ntreev Soft (in-house training) 41 Collision Detection In 3D Environments Sweep and Prune (2)
  42. 42. Ntreev Soft (in-house training) 42 Collision Detection In 3D Environments Convex Objects • Proximity Queries • Overview of Algorithms for Polytopes – Finding a Common Point – Finding a Separating Plane – Distance and Penetration Depth Computation • Simplex-based Algorithm – GJK Distance Algorithm & Enhanced GJK Johnson’s Distance Algorithm Support Mappings Penetration Depth • Feature-based Algorithm – Lin-Canny Closest Feature Algorithm – Voronoi Clip Algorithm
  43. 43. Ntreev Soft (in-house training) 43 Collision Detection In 3D Environments Finding a Separating Plane (1) • Separating Axis Theorem – Two polytopes A and B are disjoint iff there exists a separating axis which is: perpendicular to a face from either or perpendicular to an edge from each. • Implementations – Given two generic polytopes, the number of candidate axes to test F1 + F2 + ( E1 * E2 ) – OBBs have only E = 3 distinct edge directions, and only F = 3 distinct face normals. OBBs need at most 15 axis tests. (2D: 4 axes to test) • Used in: – Line segment ↔ Box – Triangle ↔ Box – OBB ↔ OBB – k-DOP ↔ k-DOP
  44. 44. Ntreev Soft (in-house training) 44 Collision Detection In 3D Environments Finding a Separating Plane (2) Polytope Polytope Number of axes to test Line segment Triangle 0 + 1 + ( 1 * 3 ) = 4 Line segment Box 0 + 3 + ( 1 * 3 ) = 6 Triangle Triangle 1 + 1 + ( 3 * 3 ) = 11 Triangle Box 1 + 3 + ( 3 * 3 ) = 13 Box Box 3 + 3 + ( 3 * 3 ) = 15 • The SAT works well for simple polytopes, such as line segments (rays), triangles, and boxes.
  45. 45. Ntreev Soft (in-house training) 45 Collision Detection In 3D Environments GJK Distance Algorithm & Enhanced GJK • Johnson’s Distance Algorithm • Support Mappings • Penetration Depth
  46. 46. Ntreev Soft (in-house training) 46 Collision Detection In 3D Environments Voronoi Clip Algorithm (1) • Voronoi Region • Basic Algorithm – Given one feature from each polyhedron, find the nearest points of the two features. – If each nearest point is in the Voronoi region of the other feature, closest features have been found. – Else, walk to one or both of their neighbors or some other feature. • Running Time Analysis – Distance strictly decreases with each change of feature pair, and no pair of features can be selected twice. – Convergence to closest pair typically much better for dynamic environments. O(1) achievable in simulations with coherence. Closer to sub-linear time performance even without coherence.
  47. 47. Ntreev Soft (in-house training) 47 Collision Detection In 3D Environments Voronoi Clip Algorithm (2) Face Edge 1 Edge 2 Edge 3 Vert 1 Vert 2 Vert 3
  48. 48. Ntreev Soft (in-house training) 48 Collision Detection In 3D Environments Voronoi Clip Algorithm (3) • Closest Feature Tracking Using Voronoi Regions
  49. 49. Ntreev Soft (in-house training) 49 Collision Detection In 3D Environments Appendix: Collision Cases • Vertex, Edge, Face 6 cases
  50. 50. Ntreev Soft (in-house training) 50 Collision Detection In 3D Environments Appendix: The Elements of Simulator Broad Phase Collision Detection Narrow Phase Collision Detection Contact Determination Contact Analysis Collision Solver Time Control Motion Solver Constraint Solver Mass Property Analysis
  51. 51. Ntreev Soft (in-house training) 51 Collision Detection In 3D Environments Appendix: System Architecture of Simulator Analysis & Response Broad Phase Collision Detection Simulation Collision Transform Overlap Parameters Narrow Phase Collision Detection
  52. 52. Ntreev Soft (in-house training) 52 Collision Detection In 3D Environments Appendix: Public Domain Packages (1) • Collision Detection / Proximity Query Packages – SOLID GJK OBB tree – OPCODE Collision library for triangle meshes. AABB tree – RAPID Part of V-COLLIDE OBB tree – CULLIDE Interactive Collision Detection Between Complex Models in Large Environments using Graphics Hardware Potentially Colliding Set (PCS) – V-COLLIDE More general than I-COLLIDE The system uses OBB tree as defined in RAPID but uses temporal coherence to speed up – I-COLLIDE Lin-Canny Algorithm N-body overlap tests (sweep and prune). Distance calculation between convex polytopes. – SWIFT Variant of the LC feature-walking algorithm More powerful than I-COLLIDE Speedy Walking via Improved Feature Testing – SWIFT++ An evolution of SWIFT Supports nonconvex polyhedra
  53. 53. Ntreev Soft (in-house training) 53 Collision Detection In 3D Environments Appendix: Public Domain Packages (2) • Collision Detection / Proximity Query Packages – DEEP Dual-space Expansion for Estimating Penetration depth between convex polytopes – H-COLLIDE – PIVOT Proximity Information from VOronoi Techniques The system uses graphics hardware acceleration to support the queries – PQP Proximity Query Package The system SSV and supports overlap testing, distance computation, and tolerance verification Good for any proximity query Released in July’99 Strong interest from Sony – IMMAPCT Interactive Massive Model Proximity And Collision Testing Built on top of PQP Use of METIS – Q-COLLIDE A non-UNC A variation of I-COLLIDE and V-COLLIDE The system uses separating Axes to determine intersections rather than tracking closest features but still uses spatial and temporal coherence • Tools – QHull Convex Hull Generation
  54. 54. Ntreev Soft (in-house training) 54 Collision Detection In 3D Environments Appendix: Demos
  55. 55. Ntreev Soft (in-house training) 55 Collision Detection In 3D Environments Bibliography • [Bar92] David Baraff. Dynamic Simulation of Non-Penetrating Rigid Bodies. PhD thesis, Computer Science Department, Cornell University, 1992. Technical Report 92-1275. • [BKOS00] M. de Berg, M. van Kreveld, M. Overmars and O. Schwarzkopf. Computational Geometry 2nd Edition. Springer, 2000. • [KK88] 김용운, 김용국. 토폴로지 入門. 祐成文化社, 1988. • [Mir98] Brian Mirtich. V-Clip: Fast and robust polyhedral collision detection. ACM Transactions on Graphics, 1998. • [Mw] http://mathworld.wolfram.com • [vdB04] Gino van den Bergen. Collision Detection in Interactive 3D Environments. Morgan Kaufmann Publishers, 2004. • [Wis03] CS679 - Fall 2003 - Copyright Univ. of Wisconsin.
  56. 56. Ntreev Soft (in-house training) 56 Collision Detection In 3D Environments People • Ming C. Lin • Brian Mirtich • Gino van den Bergen • David H. Eberly
  57. 57. Ntreev Soft (in-house training) 57 Collision Detection In 3D Environments Note
  • yesolar

    May. 30, 2019
  • mafakhari

    Jan. 6, 2017
  • InzarSalfikar

    Dec. 22, 2016
  • ecotooru

    Apr. 8, 2016
  • ssuser4966c9

    Aug. 19, 2015

Views

Total views

4,050

On Slideshare

0

From embeds

0

Number of embeds

5

Actions

Downloads

83

Shares

0

Comments

0

Likes

5

×