Collision Detection • Collision Detection Is an Essential Part of Physically Realistic Dynamic Simulations
Total Page:16
File Type:pdf, Size:1020Kb
Motivation - Dynamic Simulation ETH Zurich ETH Zurich Collision Detection • Collision detection is an essential part of physically realistic dynamic simulations. • For each time step: •compute dynamics • detect collisions • resolve collisions Stefan Gottschalk, UNC Jim Cremer, Univ of Iowa Matthias Teschner M Teschner – Collision Detection GDV 2 – Sommersemester 20021 M Teschner – Collision Detection 2 Motivation - Biomedical Simulation Motivation - Path Planning ETH Zurich ETH Zurich • Dysfunction of the hip joint due to reoriented femoral head • Restricted range of motion in hip joint Stefan Gottschalk, UNC • Simulation of the range of motion to decide whether a reorienting Jean-Claude Latombe, Stanford Univ osteotomy of the proximal femur can improve the range of motion Planning a path for the torus • Triangulated surface representation of the bone structure involves collision detection tests. -> collision detection problem M Teschner – Collision Detection 3 M Teschner – Collision Detection 4 1 Motivation Motivation - Robotics ETH Zurich Molecular Motion, Protein Folding ETH Zurich Sanchez, Latombe, Stanford Univ Singh, Latombe, Brutlag, Stanford Univ • Collision detection is required to coordinate all tasks for all robots • Computation of low-energy states for designed drug molecules •Can be time-critical in case of a break-down M Teschner – Collision Detection 5 M Teschner – Collision Detection 6 Outline Bounding Volumes ETH Zurich ETH Zurich Bounding Volumes Simplified conservative surface representation for fast approximative collision detection test Hierarchies of Bounding Volumes • Spheres • Axis-aligned bounding boxes (ABB) Spatial Partitioning • Object-oriented bounding boxes (OBB) • Discrete orientation polytopes (k-DOPs) Distance Fields Collision Detection • Avoid checking all object primitives. for Deformable Objects • Check bounding volumes to get the information whether objects could interfere. M Teschner – Collision Detection 7 M Teschner – Collision Detection 8 2 Spheres and Overlapping Test Sphere as Bounding Volume ETH Zurich ETH Zurich Sphere is represented by center c and radius r. c2 c2 r1 r2 good choice. bad choice. − − > + 2 Two spheres do not overlap if (c1 c2 )(c1 c2 ) (r1 r2 ) M Teschner – Collision Detection 9 M Teschner – Collision Detection 10 Axis-Aligned Bounding Box - ABB ABB as Bounding Volume ETH Zurich ETH Zurich y ABB is represented by c1 center c and radii rx, ry. rx2 c2 ry2 x 1 − > + good choice. bad choice. Two ABBs do not overlap in 2D if (c1 c2 ) rx1 rx2 0 0 − > + or (c1 c2 ) ry1 ry2 1 M Teschner – Collision Detection 11 M Teschner – Collision Detection 12 3 Discrete Orientation Polytope - k-DOP k-DOPs as Bounding Volumes ETH Zurich ETH Zurich A k-DOP is “a convex polytope whose facets are determined by halfspaces Example: 8-DOP whose outward normals come from a small fixed set of k orientations.” [Klosowski] Larger k’s are more flexible than smaller. ABB is a 4-DOP. Is a 4-DOP an ABB? y k-DOP is represented by k/2 directions and k/2 pairs of min, max values. min1 max1 x min2 Two k-DOPs do not overlap, max2 good choice. quite good choice. Examples: if at least the intervals in 6-, 14-, 18-, 26-DOPs one direction do not overlap. M Teschner – Collision Detection 13 M Teschner – Collision Detection 14 Object-Oriented Bounding Box OBB OBB Overlapping Test in 2D ETH Zurich ETH Zurich An OBB is represented by the b1B1 Β principal axes of a set of vertices. Α Β A1, A2 , B1, B2 •axes of , These axes are not fixed. They move Α b B • unit vectors according to object transformations. T 2 2 a1,a2 ,b1,b2 • 'radii' of Α,Β a1A1 3 L • unit vector Vertices: vv∈ℜ a2 A2 n = + 1 pA a1 A1L a2 A2 L µ = pA Mean: vi pB n i =1 = + T ⋅ L L pB b1B1L b2 B2 L Covariance matrix: Eigenvectors of the n Α,Β do not overlap: covariance matrix = 1 Cjk vij vik n i=1 ∃ ⋅ > + ∃ ∈ ⋅ > + L : T L pA pB or L {}A1, A2 , B1, B2 : T L pA pB = − µ vi vi 1≤ j, k ≤ 3 M Teschner – Collision Detection 15 M Teschner – Collision Detection 16 4 OBB Examples Bounding Volumes - Summary ETH Zurich ETH Zurich • Principal axes of an object are not always a good choice for the main axes of an OBB! • Spheres • Inhomogeneous vertex distribution • Axis-aligned bounding boxes (ABB) can cause bad OBBs. • Object-oriented bounding boxes (OBB) • Discrete orientation polytopes (k-DOP’s) • Ellipsoids PSS •Convex Hulls • Swept-Sphere Volumes (SSV’s) • Point Swept Spheres (PSS) • Line Swept Spheres (LSS) • Rectangle Swept Spheres (RSS) • Triangle Swept Spheres (TSS) Lin, UNC LSS RSS M Teschner – Collision Detection 17 M Teschner – Collision Detection 18 The Optimal Bounding Volume ? Outline ETH Zurich ETH Zurich Bounding Volumes Hierarchies of Bounding Volumes Spatial Partitioning Sphere ABB OBB 6-DOP Convex Hull Distance Fields Quality: Better approximation Collision Detection for Deformable Objects Decreasing complexity and computational expenses for overlap test M Teschner – Collision Detection 19 M Teschner – Collision Detection 20 5 Hierarchy of Bounding Volumes Hierarchy of Bounding Volumes ETH Zurich ETH Zurich • Not only one bounding volume, but a hierarchical structure of BV for the bounding volumes entire object • Subdivsion of bounding volumes to generate a hierarchy BV • Bounding volume tree BV for parts Layer 1 Layer 2 Layer 3 (BV tree) of the object •Nodes contain BV BV bounding volume information • Leaves additionally BV BV contain information BV for a few/one primitives on object primitives object primitive(s) primitives primitives M Teschner – Collision Detection 21 M Teschner – Collision Detection 22 Hierarchy of Bounding Volumes - OBB Tree Example ETH Zurich ETH Zurich Object-oriented bounding box level 1 Object Object-oriented bounding boxes level n • Sean Quinlan, Stanford Univ • Philip Hubbard, Brown Univ M Teschner – Collision Detection 23 M Teschner – Collision Detection 24 6 ABB vs. OBB Tree Overlapping Test for BV Trees ETH Zurich ETH Zurich • BV-trees speed-up the collision detection test Representation • If bounding volumes in a hierarchy level overlap, their children are of a torus checked for overlapping. If leaves are reached, primitives are checked against each other. Lin, UNC Chapel Hill M Teschner – Collision Detection 25 M Teschner – Collision Detection 26 Construction of a BV Tree Construction of a BV Tree ETH Zurich ETH Zurich Bottom-Up Parameters • Start with object-representing primitives • Bounding volume • Fit a bounding volume to each primitive • Top-down vs. bottom-up • Group primitives or bounding volumes recursively • What to subdivide / group: object primitives or bounding volumes • Fit bounding volumes to these groups • How to subdivide / group object primitives or bounding volumes • Stop in case of a single bounding volume at a hierarchy level • How many primitives in each leaf of the BV tree • Re-sampling of the object ? Top-Down •Start with object Goals • Fit a bounding volume to the object • Split object or bounding volume recursively • Balanced tree • Fit bounding volumes • Tight-fitting bounding volumes • Stop, if all bounding volumes in a level contain less than n primitives • Minimal redundancy (primitives in more than one BV per level) M Teschner – Collision Detection 27 M Teschner – Collision Detection 28 7 Construction of a BV Tree - Spheres Collision Detection Libraries ETH Zurich ETH Zurich Hubbard: SOLID RAPID QuickCD • Approximate triangles with spheres and build the tree bottom-up by grouping spheres Axis-aligned Object-oriented k discrete • Cover vertices with spheres and group them bounding box bounding box orientation • Resample vertices prior to building the tree polytope (homogeneous vertex distribution reduces redundancy) • Build the tree top-down by using an octree • Compute the medial axis and place spheres on it medial axis van den Gottschalk Klosowski based Bergen et al. et al. Eindhoven University of University of University North Carolina New York octree based 1997 1995 1998 M Teschner – Collision Detection 29 M Teschner – Collision Detection 30 Comparison of CD Libraries Object Transformations ETH Zurich ETH Zurich • Time to compute a collision for two spheres with radius 1 cm • Translation represents the distance of both centers Some object transformations can be simply applied • QuickCD [Klosowski], RAPID [Gottschalk], SOLID [Bergen] to all elements of the bounding-volume tree: • Differences mostly due to programming aspects Spheres • Translation, rotation Axis-Aligned Bounding Boxes • Translation, no rotation Discrete Orientation Polytopes 10,000 triangles • Translation, no rotation per sphere (principal orientations are fixed for all objects) 8-DOP OBB Object-Oriented Bounding Boxes ABB • Translation, rotation (box orientations are not fixed) M Teschner – Collision Detection 31 M Teschner – Collision Detection 32 8 Rotations Parallel Close Proximity ETH Zurich ETH Zurich Axis-Aligned Bounding Boxes Discrete Orientation Polytopes • Quality of lower-level • Rotation of the bounding volume is not BV approximation possible due to the respective box overlap test. influences collision (The tests require fixed surface normals.) detection performance in case of close proximity. Problem Spheres 1. Recomputation of the BV hierarchy • Quality of higher-level 2. Preservation of the tree structure, update of all nodes BV approximations is 3. Additional storage of the convex hull which is rotated with the object not very critical. - check if extremal vertices are still extremal after rotation • In case of overlapping BV - compare with adjacent vertices of the convex hull expensive