1. What
Collision Testing algorithm
- Very general, works with any combination of convex shape
- Fast
Useful in physics simulation and video games
2. Math Foundations
Define a shape
- A set of points that are infinitely dense
Define the intersection: share at least one point, vector difference is 0
- if a=b
- then a-b=0
If there are infinite number of points, it fails
2.1. Minkowski Sum
Sum of two shape, a shape travel along another shape’s outliers
Blue + Pink= Purple
The center is located at the sum of the original shape center
2.2. Minkowski Difference
Just like the sum, but the position are define as differences rather than sum
Key point:
- When the shape intersect, the difference always contains the origin
Takeaway: We only need to test if the origin is in the Minkowski difference
2.3. Simplify
Instead of working with infinite points, we find useful points and calculate the difference of these points
The convex hull is a good approximation of the entire difference
3. Algorithm
1 | Initialization: |
Keypoint:
- preserve the nearest K point to the origin
- maintain a K+1 dimension simplex
- support point calculation is important
Determine if the dot product of the new point and the last direction
- if <0, means in the opposite direction, no hope, just exit and return false
- if >0, mean in the same direction, should be iterate