![Page 1: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/1.jpg)
Geometric Representations & Collision DetectionKris HauserI400/B659: Intelligent RoboticsSpring 2014
![Page 2: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/2.jpg)
3D models in robotics• Design• Simulation• Robot collision detection (i.e. prediction)• Proximity calculation• Map building• Object recognition• Grasp planning• Etc..
![Page 3: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/3.jpg)
Common Representations• Primitives• Raw data
• Point clouds• Depth image• Polygon soup
• Surfaces• Polygon mesh• Parametric curves• Subdivision surfaces• Implicit surface
• Volumes• Voxels• Distance transforms• Quad/octree
![Page 4: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/4.jpg)
Aspects to consider• How accurately does the geometry need to be represented?• What operations need to be performed on the geometry?
(Recognition? Matching? Simulation? Collision detection? Visualization? Distance computation?) How quickly? How accurately?
• Storage and transmission limitations?• How easily / reliably / accurately / quickly can the source data
(e.g., raw sensor data, CAD models) be converted to the desired format?
![Page 5: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/5.jpg)
Visualization• Primitives• Raw data
• Point clouds• Depth image• Polygon soup
• Surfaces• Polygon mesh• Parametric curves• Subdivision surfaces• Implicit surface
• Volumes• Voxels• Distance transforms• Quad/octree
Easy to convert to polygons
Convert to polygons (somewhat expensive)Use specialized rasterization techniques
![Page 6: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/6.jpg)
Easy Conversions• From primitives/surfaces to:
• Polygon soups : discretization• Point clouds: sampling• Depth images: rasterization
• From volumes to surfaces:• Simple: output a box for each occupied cell (coarse)• Marching cubes: walk along the volume until a surface is hit,
output a piece of the surface in the volume (accurate)
![Page 7: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/7.jpg)
Harder Conversions• From point clouds / soups to surfaces / volumes: a challenge
• Fill cells that contain points (coarse)• Implicit function fitting• Silhouette carving • Lots of other methods… no “perfect” way to deal with missing
data• From surfaces to volumes :
• Fill cells that contain surface (coarse)• Euclidean distance transform: wavefront propagation from
surface cells (closed surfaces, accurate)
![Page 8: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/8.jpg)
Resolution issues
• Accuracy, space, & computation complexity determined by resolution h• Suppose object size W• Point clouds, polygon meshes: O((W/h)2) space• Voxels: O((W/h)3) space
• Downsampling• Mesh simplification
![Page 9: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/9.jpg)
Geometric queries• Collision detection:
• When A and B are at hypothetical poses TA and TB, would they collide?
• Distance calculation• When A and B are at hypothetical poses TA and TB, how far are
they apart?• Time-of-first contact
• When A and B move along paths TA(t) and TB(t), at what time do they first collide?
![Page 10: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/10.jpg)
Geometric primitives• Points, Rays, Lines, Segments, Triangles, Spheres, Ellipses,
Boxes• Collision detection, distance detection fast operations (O(1))
• Ex: segment – sphere collision detection / distance calculation
�⃗�
�⃗�
�⃗�r
![Page 11: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/11.jpg)
Managing large scenes• O(n2) pairs of objects – how to check collisions?
![Page 12: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/12.jpg)
Collision Detection Methods• Many different methods• In particular:
• Grid method: good for many simple moving objects of about the same size (e.g., many moving discs with similar radii)
• Closest-feature tracking: good for moving polyhedral objects• Bounding Volume Hierarchy (BVH) method: good for few moving
objects with complex and diverse geometry
![Page 13: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/13.jpg)
Grid Method
Subdivide space into a regular grid cubic of square bins
Index each object in a bin
d
![Page 14: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/14.jpg)
Grid Method
d
Running time is proportional tonumber of moving objects
Useful also to compute pairs of objects within some distance (vision,sound, …)
![Page 15: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/15.jpg)
Closest-Feature Tracking(M. Lin and J. Canny. A Fast Algorithm for Incremental Distance Calculation. Proc. IEEE Int. Conf. on Robotics and Automation, 1991)
The closest pair of features (vertex, edge, face) between two polyhedral objects are computed at the start configurations of the objects
During motion, at each small increment of the motion, they are updated
Efficiency derives from two observations: The pair of closest features
changes relatively infrequently When it changes the new closest features will
usually be on a boundary of the previous closest features
![Page 16: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/16.jpg)
Closest-Feature Test for Vertex-Vertex
VertexVertex
![Page 17: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/17.jpg)
Application: Detecting Self-Collision in Humanoid Robots(J. Kuffner et al. Self-Collision and Prevention for Humanoid Robots. Proc. IEEE Int. Conf. on Robotics and Automation, 2002)
![Page 18: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/18.jpg)
BVH with spheres:S. Quinlan. Efficient Distance Computation Between Non-Convex Objects. Proc. IEEE Int. Conf. on Robotics and Automation, 1994.
BVH with Oriented Bounding Boxes:S. Gottschalk, M. Lin, and D. Manocha. OBB-Tree: A Hierarchical Structure for Rapid Interference Detection. Proc. ACM SIGGRAPH '96, 1996.
Combination of BVH and feature-tracking:S.A. Ehmann and M.C. Lin. Accurate and Fast Proximity Queries Between Polyhedra Using Convex Surface Decomposition. Proc. 2001 Eurographics, Vol. 20, No. 3, pp. 500-510, 2001.
Adaptive bisection in dynamic collision checking:F. Schwarzer, M. Saha, J.C. Latombe. Adaptive Dynamic Collision Checking for Single and Multiple Articulated Robots in Complex Environments, manuscript, 2003.
Bounding Volume Hierarchy Method
![Page 19: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/19.jpg)
Enclose objects into bounding volumes (spheres or boxes) Check the bounding volumes first Decompose an object into two
Bounding Volume Hierarchy Method
![Page 20: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/20.jpg)
Enclose objects into bounding volumes (spheres or boxes) Check the bounding volumes first Decompose an object into two Proceed hierarchically
Bounding Volume Hierarchy Method
![Page 21: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/21.jpg)
Enclose objects into bounding volumes (spheres or boxes) Check the bounding volumes first Decompose an object into two Proceed hierarchically
Bounding Volume Hierarchy Method
![Page 22: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/22.jpg)
• BVH is pre-computed for each object
Bounding Volume Hierarchy Method
![Page 23: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/23.jpg)
BVH in 3D
![Page 24: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/24.jpg)
Collision Detection
Two objects described by their precomputed BVHs
A
B C
D E F G
A
B C
D E F G
![Page 25: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/25.jpg)
Collision Detection
AASearch tree
AA
pruning
![Page 26: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/26.jpg)
Collision Detection
AA
CCCBBCBB
Search tree
AA
A
B C
D E F G
![Page 27: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/27.jpg)
Collision Detection
CCCBBCBB
AASearch tree
pruning
A
B C
D E F G
![Page 28: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/28.jpg)
If two leaves of the BVH’s overlap(here, G and D) check their contentfor collision
Collision Detection
CCCBBCBB
AASearch tree
GEGDFEFD
A
B C
D E F G
G D
![Page 29: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/29.jpg)
Variant
AA
CCCBBCBB
Search tree
AA
A
B C
D E F GAA
CABA
![Page 30: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/30.jpg)
Collision Detection• Pruning discards subsets of the two objects that are separated
by the BVs
• Each path is followed until pruning or until two leaves overlap
• When two leaves overlap, their contents are tested for overlap
![Page 31: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/31.jpg)
Search Strategy and Heuristics
If there is no collision, all paths must eventually be followed down to pruning or a leaf node
But if there is collision, it is desirable to detect it as quickly as possible
Greedy best-first search strategy with f(N) = d/(rX+rY)
[Expand the node XY with largest relative overlap (most likely to contain a collision)]
rX
rYd
X
Y
![Page 32: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/32.jpg)
Recursive (Depth-First) Collision Detection Algorithm
Test(A,B)1. If A and B do not overlap, then return 12. If A and B are both leaves, then return 0 if their contents overlap
and 1 otherwise3. Switch A and B if A is a leaf, or if B is bigger and not a leaf4. Set A1 and A2 to be A’s children5. If Test(A1,B) = 1 then return Test(A2,B) else return 0
![Page 33: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/33.jpg)
Performance• Several thousand collision checks per second for 2 three-
dimensional objects each described by 500,000 triangles, on a 1-GHz PC
![Page 34: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/34.jpg)
Distance Computation
M
> M, prune
![Page 35: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/35.jpg)
Greedy Distance Computation
Greedy-Distance(A,B,M)1. If min-dist(A,B) > M, then return M2. If A and B are both leaves, then return distance between their
contents 3. Switch A and B if A is a leaf, or if B is bigger and not a leaf4. Set A1 and A2 to be A’s children5. M min(max-dist(A1,B), max-dist(A2,B), M)6. d1 Greedy-Distance(A1,B,M) 7. d2 Greedy-Distance(A2,B,M) 8. Return Min(d1,d2)
M (upper bound on distance) is initialized to infinity
![Page 36: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/36.jpg)
Approximate Distance
Approx-Greedy-Distance(A,B,M,a)1. If (1+a)min-dist(A,B) > M, then return M2. If A and B are both leaves, then return distance between their
contents 3. Switch A and B if A is a leaf, or if B is bigger and not a leaf4. Set A1 and A2 to be A’s children5. M min(max-dist(A1,B), max-dist(A2,B), M)6. d1 Approx-Greedy-Distance(A1,B,M,a) 7. d2 Approx-Greedy-Distance(A2,B,M,a) 8. Return Min(d1,d2)
M (upper bound on distance) is initialized to infinity
![Page 37: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/37.jpg)
Desirable Properties of BVs and BVHsBVs:• Tightness• Efficient testing• Invariance
BVH: Separation Balanced tree
?
![Page 38: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/38.jpg)
Spheres• Invariant• Efficient to test• But tight?
![Page 39: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/39.jpg)
Axis-Aligned Bounding Box (AABB)
![Page 40: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/40.jpg)
Axis-Aligned Bounding Box (AABB) Not invariant Efficient to test Not tight
![Page 41: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/41.jpg)
Oriented Bounding Box (OBB)
![Page 42: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/42.jpg)
Invariant Less efficient to test Tight
Oriented Bounding Box (OBB)
![Page 43: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/43.jpg)
Comparison of BVs
Sphere AABB OBB
Tightness - -- +
Testing + + o
Invariance yes no yes
No type of BV is optimal for all situations
![Page 44: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/44.jpg)
Desirable Properties of BVs and BVHsBVs:• Tightness• Efficient testing• Invariance
BVH: Separation Balanced tree ?
![Page 45: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/45.jpg)
Desirable Properties of BVs and BVHsBVs:• Tightness• Efficient testing• Invariance
BVH: Separation Balanced tree
![Page 46: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/46.jpg)
Construction of a BVH • Top-down construction • At each step, create the two children of a BV• Example:
For OBB, split longest side at midpoint
![Page 47: Geometric Representations & Collision Detection](https://reader036.vdocuments.net/reader036/viewer/2022062315/56816461550346895dd63d6b/html5/thumbnails/47.jpg)
Computation of an OBB[Gottschalk, Lin, and Manocha, 96]
N points ai = (xi, yi, zi)T, i = 1,…, N
SVD of A = (a1 a2 ... aN) A = UDVT where
D = diag(s1,s2,s3) such that s1 s2 s3 0
U is a 3x3 rotation matrix that defines the principal axes of variance of the ai’s OBB’s directions
The OBB is defined by max and min coordinates of the ai’s along these directions
Possible improvements: use vertices of convex hull of the ai’s or dense uniform sampling of convex hull
x
y
X
Yrotation described bymatrix U