Problemcore
Penetration depth
Also called penetration depth computation.
The shortest translation that separates two overlapping solids, which gives the contact normal and the overlap distance.
The penetration depth of two overlapping solids is the length of the shortest translation that makes them disjoint, apart from contact on their boundaries. Its direction is the contact normal, and its length tells how far the solids overlap. A physics engine needs both to push the solids apart and to apply a contact impulse along the right direction. For two convex solids the problem has a clean form: the depth is the distance from the origin to the boundary of their Minkowski difference. For nonconvex solids, the shortest translation can be far from any local overlap, and the exact problem is much harder.
In plain words
Two solid objects overlap, for example because a simulation step moved them too far. You want the smallest push, in one straight direction, that moves one object until the two only touch.
The length of that push says how deep they overlap. Its direction says which way the contact pushes. For two round balls, you push along the line between the centers. For boxes and other flat-sided shapes, the best push is along one of a few special directions. For shapes with holes and dents, the best push can go in a surprising direction, and it is hard to find.
Definition
Input. Two compact solids , with or , whose interiors overlap. Usually they are convex polygons, convex polyhedra, or other convex shapes given by a support function. In the general version they are polygons or polyhedral meshes.
Output. The penetration depth
and a vector that attains it. The unit vector is the contact normal. Many uses also want a pair of witness points, one on each boundary, whose difference is .
Convex form. and have overlapping interiors exactly when is in the interior of . So for convex solids is the distance from the origin to the boundary of , and the minimizing is the negative of the closest boundary point. If the solids are disjoint, the distance from the origin to is their distance. The two together give the signed distance.
Cost model. For exact methods, the real RAM on polygons or polyhedra with and vertices. For support-function methods, the number of support queries and the size of the work polytope, with a tolerance on the depth.
Variants
- Translational depth. The definition above. It is the common version in simulation.
- Directional depth. The shortest translation along a given direction, for example the direction of the relative velocity. It is a ray cast inside .
- Generalized depth. The smallest rigid motion, with rotation, that separates the solids, under a metric on motions. It is more faithful for long objects and much harder to compute.
- Signed distance. The distance when the solids are apart and minus the depth when they overlap, as one continuous function of the placement.
- Local depth. For each contact region, a depth and a normal at that region alone. Engines and deformable models often use local depths, sampled from a signed distance field, because the global minimum can jump from one region to another.
- Penetration volume. The volume of instead of a distance.
Examples
| depth | normal | ||
|---|---|---|---|
| the disk with the center and the radius 1 | the disk with the center and the radius 1 | along | |
| the square | the square | 0.5 | along |
| the triangle | the triangle | along |
For the squares, is the box , and the origin is from its left side, from its bottom side and farther from the others, so moving by to the right is the shortest push. The overlaps on the two axes are and , and the depth is the smaller one. For the triangles, lies inside and touches the long side . On the direction , covers and covers , so must move until on all of it, which is a push of . Along the two axes the push would be 3.
Known algorithms
Separating axes for polygons and boxes. For two convex polygons, each edge of is parallel to an edge of or of . The distance from the origin to the line of an edge with the outer normal is the overlap of the projections of and on . So the smallest overlap over all edge normals of both polygons is the depth, and the separating axis test computes it in time, or in with a merged walk over the normals in angular order. The same argument holds for any set of directions that contains all facet normals of . For two boxes in 3D, the 15 axes of the box test give the exact depth.
The Minkowski difference. In the plane, the Minkowski sum of two convex polygons has at most edges and is computed in time, so the depth takes time. In 3D, is the convex hull of the differences of vertices, and it can have faces. A hull of these points gives the depth in time. Dobkin, Hershberger, Kirkpatrick and Suri defined the intersection depth of two convex polyhedra and gave algorithms to compute it exactly.
The expanding polytope algorithm. The expanding polytope algorithm starts from the simplex in which GJK found the origin, and grows a polytope inside toward its nearest face, with support queries only. It works for curved convex shapes too, and it stops at a tolerance. It is the usual method in physics engines.
Nonconvex solids. Split each solid into convex pieces, by an exact or an approximate convex decomposition. The depth of the union is not the largest depth of a pair of pieces, because a push that separates one pair of pieces can push another pair into contact. An exact method must find the closest point to the origin outside the union of all the pairwise Minkowski differences, which is costly. Practical methods use local depths at each contact region, or sample a signed distance field.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Expanding polytope algorithm | O(k (k + n + m)) call | O(k) extra | deterministicnot exactofflineiterative | 1 language |
Bounds
For convex polygons, the depth takes time, by the Minkowski sum. For convex polyhedra, the difference can have faces, so a method that builds it needs time in the worst case. Support-function methods such as EPA give no bound in terms of and that is smaller than the size of the difference, but on typical shapes they need few support queries. For nonconvex polyhedra the union of the pairwise differences can be much larger, and exact methods are rarely used in simulation.
Reductions
- To a nearest point on a boundary. For convex solids, the depth is the distance from the origin to the boundary of , from the inside.
- To distance. The signed distance joins the depth and the distance of two convex solids in one function, and GJK with EPA computes both.
- From overlap testing. The depth is positive exactly when the interiors overlap, so a depth method also decides overlap.
- To a configuration space query. The placements of that overlap form the obstacle in the configuration space of translations, and the depth is the distance from the current placement to the boundary of this obstacle.
Applications
- Contact response. A penalty method applies a force that grows with the depth along the normal. A projection method moves the solids apart by the depth. Impulse methods use the normal to build the contact manifold and the collision impulse.
- Recovery after a missed contact. When a discrete step lets two solids overlap, the depth tells how to separate them before the next step.
- Haptics. A haptic device renders a force that depends on how deep the probe is in an object.
- Motion planning and tolerance checks. The depth measures how far a placement is from being free, which guides a planner out of collision and measures interference in an assembly.
References
- David Dobkin, John Hershberger, David Kirkpatrick and Subhash Suri, Computing the intersection-depth of polyhedra, Algorithmica 9(6), 1993, 518 to 533, the definition of the intersection depth as the shortest translation that separates two convex polyhedra, and its computation
- Christer Ericson, Real-Time Collision Detection, Morgan Kaufmann, 2005, the chapter on convexity-based methods (the Minkowski difference, GJK and penetration depth)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag P9J3VF Edit this page History Report an error Markdown