introduction to collision detection & fundamental geometric concepts ming c. lin
DESCRIPTION
Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin Department of Computer Science University of North Carolina at Chapel Hill http://www.cs.unc.edu/~lin [email protected]. Geometric Proximity Queries. Given two object, how would you check: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/1.jpg)
Introduction to Collision Detection &Fundamental Geometric Concepts
Ming C. LinDepartment of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~lin
![Page 2: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/2.jpg)
M. C. Lin
Geometric Proximity Queries
Given two object, how would you check:
– If they intersect with each other while moving?
– If they do not interpenetrate each other, how far are they apart?
– If they overlap, how much is the amount of penetration
![Page 3: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/3.jpg)
M. C. Lin
Collision Detection
• Update configurations w/ TXF matrices
• Check for edge-edge intersection in 2D (Check for edge-face intersection in 3D)
• Check every point of A inside of B & every point of B inside of A
• Check for pair-wise edge-edge intersections
Imagine larger input size: N = 1000+ ……
![Page 4: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/4.jpg)
M. C. Lin
Classes of Objects & Problems
• 2D vs. 3D• Convex vs. Non-Convex• Polygonal vs. Non-Polygonal• Open surfaces vs. Closed volumes• Geometric vs. Volumetric• Rigid vs. Non-rigid (deformable/flexible)• Pairwise vs. Multiple (N-Body)• CSG vs. B-Rep• Static vs. DynamicAnd so on… This may include other geometric representation
schemata, etc.
![Page 5: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/5.jpg)
M. C. Lin
Some Possible Approaches
• Geometric methods• Algebraic Techniques• Hierarchical Bounding Volumes• Spatial Partitioning• Others (e.g. optimization)
![Page 6: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/6.jpg)
M. C. Lin
Essential Computational Geometry
(Refer to O'Rourke's and “Dutch” textbook )
Extreme Points & Convex Hulls– Providing a bounding volume
Convex Decomposition– For CD btw non-convex polyhedra
Voronoi Diagram– For tracking closest points
Linear Programming– Check if a pt lies w/in a convex polytope
Minkowski Sum– Computing separation & penetration measures
![Page 7: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/7.jpg)
M. C. Lin
Extreme Point
Let S be a set of n points in R2. A point p = (px, py) in S is an extreme point for S iff there exists a, b in R such that for all q = (qx, qy) in S with q ≠ p we have
a px+ b py > a qx+ b qy
Geometric interpretation: There is a line with the normal vector (a,b) through p so that all other points of S lies strictly on one side of this line. Intuitively, p is the most extreme point of S in the direction of the vector v = (a,b).
![Page 8: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/8.jpg)
M. C. Lin
Convex Hull
The convex hull of a set S is the intersection of all convex sets that contains S.
The convex hull of S is the smallest convex polygon that contains S and that the extreme points of S are just the corners of that polygon.
Solving the convex hull problem implicitly solves the extreme point problem.
![Page 9: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/9.jpg)
M. C. Lin
Constructing Convex Hulls
Graham’s Scan Marriage before Conquest (similar to Divide-and-Conquer) Gift-Wrapping IncrementalAnd, many others ……
Lower bound: O(n log H), where n is the input size (No. of points in the given set) and H is the No. of the extreme points.
![Page 10: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/10.jpg)
M. C. Lin
Convex Decomposition
The process to divide up a non-convex polyhedron into pieces of convex polyhedra
Optimal convex decomposition of general non-convex polyhedra can be NP-hard.
To partition a non-degenerate simple polyhedron takes O((n + r2) log r) time, where n is the number of vertices and r is the number of reflex edges of the original non-convex object.
In general, a non-convex polyhedron of n vertices can be partitioned into O(n2) convex pieces.
![Page 11: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/11.jpg)
M. C. Lin
Voronoi Diagrams
Given a set S of n points in R2 , for each point pi in S, there is the set of points (x, y) in the plane that are closer to pi than any other point in S, called Voronoi polygons. The collection of n Voronoi polygons given the n points in the set S is the "Voronoi diagram", Vor(S), of the point set S.
Intuition: To partition the plane into regions, each of these is the set of points that are closer to a point pi in S than any other. The partition is based on the set of closest points, e.g. bisectors that have 2 or 3 closest points.
![Page 12: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/12.jpg)
M. C. Lin
Generalized Voronoi Diagrams
The extension of the Voronoi diagram to higher dimensional features (such as edges and facets, instead of points); i.e. the set of points closest to a feature, e.g. that of a polyhedron.
FACTS:– In general, the generalized Voronoi diagram has quadratic
surface boundaries in it. – If the polyhedron is convex, then its generalized Voronoi
diagram has planar boundaries.
![Page 13: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/13.jpg)
M. C. Lin
Voronoi Regions
A Voronoi region associated with a feature is a set of points that are closer to that feature than any other.
FACTS:– The Voronoi regions form a partition of space outside of the
polyhedron according to the closest feature. – The collection of Voronoi regions of each polyhedron is the
generalized Voronoi diagram of the polyhedron. – The generalized Voronoi diagram of a convex polyhedron has
linear size and consists of polyhedral regions. And, all Voronoi regions are convex.
![Page 14: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/14.jpg)
M. C. Lin
Voronoi Marching
Basic Ideas: Coherence: local geometry does not change
much, when computations repetitively performed over successive small time intervals
Locality: to "track" the pair of closest features between 2 moving convex polygons(polyhedra) w/ Voronoi regions
Performance: expected constant running time, independent of the geometric complexity
![Page 15: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/15.jpg)
M. C. Lin
Simple 2D Example
A
B
P1
P2
Objects A & B and their Voronoi regions: P1 and P2 are the pair of closest points between A and B. Note P1 and P2 lie within the Voronoi regions of each other.
![Page 16: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/16.jpg)
M. C. Lin
Basic Idea for Voronoi Marching
![Page 17: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/17.jpg)
M. C. Lin
Linear Programming
In general, a d-dimensional linear programming (or linear optimization) problem may be posed as follows:
Given a finite set A in Rd For each a in A, a constant Ka in R, c in Rd Find x in Rd which minimize <x, c> Subject to <a, x> Ka, for all a in A .
where <*, *> is standard inner product in Rd.
![Page 18: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/18.jpg)
M. C. Lin
LP for Collision Detection
Given two finite sets A, B in Rd For each a in A and b in B, Find x in Rd which minimize whateverSubject to <a, x> > 0, for all a in AAnd <b, x> < 0, for all b in B
where d = 2 (or 3).
![Page 19: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/19.jpg)
M. C. Lin
Minkowski Sums/Differences
Minkowski Sum (A, B) = { a + b | a A, b B }
Minkowski Diff (A, B) = { a - b | a A,
b B } A and B collide iff Minkowski
Difference(A,B) contains the point 0.
![Page 20: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/20.jpg)
M. C. Lin
Some Minkowski Differences
A B
A B
![Page 21: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/21.jpg)
M. C. Lin
Minkowski Difference & Translation
Minkowski-Diff(Trans(A, t1), Trans(B, t2)) = Trans(Minkowski-Diff(A,B), t1 - t2)
Trans(A, t1) and Trans(B, t2) intersect iff Minkowski-Diff(A,B) contains point (t2 - t1).
![Page 22: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/22.jpg)
M. C. Lin
Properties
Distance– distance(A,B) = min a A, b B || a - b ||2
– distance(A,B) = min c Minkowski-Diff(A,B) || c ||2
– if A and B disjoint, c is a point on boundary of Minkowski difference
Penetration Depth – pd(A,B) = min{ || t ||2 | A Translated(B,t) = }– pd(A,B) = mint Minkowski-Diff(A,B) || t ||2 – if A and B intersect, t is a point on boundary of
Minkowski difference
![Page 23: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/23.jpg)
M. C. Lin
Practicality
Expensive to compute boundary of Minkowski difference:– For convex polyhedra, Minkowski
difference may take O(n2)– For general polyhedra, no known
algorithm of complexity less than O(n6) is known
![Page 24: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/24.jpg)
M. C. Lin
GJK for Computing Distance between Convex Polyhedra
GJK-DistanceToOrigin ( P ) // dimension is m1. Initialize P0 with m+1 or fewer points.2. k = 03. while (TRUE) {4. if origin is within CH( Pk ), return 05. else { 6. find x CH(Pk) closest to origin, and Sk Pk s.t. x CH(Sk)7. see if any point p-x in P more extremal in direction -x 8. if no such point is found, return |x|9. else {10. Pk+1 = Sk {p-x}11. k = k + 112. }13. }14. }
![Page 25: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/25.jpg)
M. C. Lin
An Example of GJK
![Page 26: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/26.jpg)
M. C. Lin
Running Time of GJK
Each iteration of the while loop requires O(n) time.
O(n) iterations possible. The authors claimed between 3 to 6 iterations on average for any problem size, making this “expected” linear.
Trivial O(n) algorithms exist if we are given the boundary representation of a convex object, but GJK will work on point sets - computes CH lazily.
![Page 27: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/27.jpg)
M. C. Lin
More on GJK
Given A = CH(A’) A’ = { a1, a2, ... , an } and B = CH(B’) B’ = { b1, b2, ... , bm }
Minkowski-Diff(A,B) = CH(P), P = {a - b | a A’, b B’} Can compute points of P on demand:
– p-x = a-x - bx where a-x is the point of A’ extremal in direction -x, and bx is the point of B’ extremal in direction x.
The loop body would take O(n + m) time, producing the “expected” linear performance overall.
![Page 28: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/28.jpg)
M. C. Lin
Large, Dynamic Environments
For dynamic simulation where the velocity and acceleration of all objects are known at each step, use the scheduling scheme (implemented as heap) to prioritize “critical events” to be processed.
Each object pair is tagged with the estimated time to next collision. Then, each pair of objects is processed accordingly. The heap is updated when a collision occurs.
![Page 29: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/29.jpg)
M. C. Lin
Scheduling Scheme amax: an upper bound on relative acceleration between any two
points on any pair of objects. alin: relative absolute linear : relative rotational accelerations : relative rotational velocities r: vector difference btw CoM of two bodies d: initial separation for two given objects
amax = | alin + x r + x x r |vi = | vlin + x r |
Estimated Time to collision: tc = { (vi
2 + 2 amax d)1/2 - vi } / amax
![Page 30: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/30.jpg)
M. C. Lin
Collide System Architecture
Analysis & Response
Sweep & Prune
SimulationExact CollisionDetection
Collision
Transform Overlap
Parameters
![Page 31: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/31.jpg)
M. C. Lin
Sweep and Prune
Compute the axis-aligned bounding box (fixed vs. dynamic) for each object
Dimension Reduction by projecting boxes onto each x, y, z- axis
Sort the endpoints and find overlapping intervals
Possible collision -- only if projected intervals overlap in all 3 dimensions
![Page 32: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/32.jpg)
M. C. Lin
Sweep & Prune
b1 b2 e1 e2 b3 e3
b1
b2
e1
b3
e2
e3T = 1
b1 b2 e1 e2 b3 e3
b3
b1
e3
b2
e1
e2
T = 2
![Page 33: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/33.jpg)
M. C. Lin
Updating Bounding Boxes
Coherence (greedy algorithm)
Convexity properties (geometric properties of convex polytopes)
Nearly constant time, if the motion is relatively “small”
![Page 34: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/34.jpg)
M. C. Lin
Use of Sorting Methods
Initial sort -- quick sort runs in O(m log m) just as in any ordinary situation
Updating -- insertion sort runs in O(m) 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.
![Page 35: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/35.jpg)
M. C. Lin
Implementation Issues
Collision matrix -- basically adjacency matrix
Enlarge bounding volumes with some tolerance threshold
Quick start polyhedral collision test -- using bucket sort & look-up table
![Page 36: Introduction to Collision Detection & Fundamental Geometric Concepts Ming C. Lin](https://reader034.vdocuments.site/reader034/viewer/2022042704/56815585550346895dc3580c/html5/thumbnails/36.jpg)
M. C. Lin
References
Collision Detection between Geometric Models: A Survey, by M. Lin and S. Gottschalk, Proc. of IMA Conference on Mathematics of Surfaces 1998.
I-COLLIDE: Interactive and Exact Collision Detection for Large-Scale Environments, by Cohen, Lin, Manocha & Ponamgi, Proc. of ACM Symposium on Interactive 3D Graphics, 1995. (More details in Chapter 3 of M. Lin's Thesis)
A Fast Procedure for Computing the Distance between Objects in Three-Dimensional Space, by E. G. Gilbert, D. W. Johnson, and S. S. Keerthi, In IEEE Transaction of Robotics and Automation, Vol. RA-4:193--203, 1988.