Draft:Expanding Polytope Algorithm

This is a draft Articles for creation (AfC) submission. It is not currently pending review. While there are no deadlines, abandoned drafts may be deleted after

Draft:Expanding Polytope Algorithm

Expanding Polytope Algorithm

The Expanding Polytope Algorithm (EPA) is a computational geometry algorithm used primarily in physics engines and computer graphics to determine the penetration depth and contact manifold of two intersecting convex shapes (polytopes). [1]

EPA is almost exclusively used in conjunction with the Gilbert-Johnson-Keerthi (GJK) algorithm. While GJK is highly efficient at determining boolean collision (whether two objects intersect), it cannot calculate the depth of the intersection once the objects overlap. EPA takes the geometric data generated by a terminating GJK algorithm and expands it to find the minimum translation vector (MTV) required to separate the objects.

Background

To understand EPA, one must first understand the Minkowski difference, defined for two point sets and as:

Two shapes intersect if and only if their Minkowski difference contains the origin .

The GJK algorithm searches for the origin within the Minkowski difference. If it finds the origin, it terminates and outputs a simplex (a triangle in 2D, or a tetrahedron in 3D) whose vertices lie on the boundary of the Minkowski difference and which wholly encloses the origin.

Once a collision is detected, physics engines need to push the objects apart to resolve the collision. The shortest distance to move them out of collision corresponds to the shortest distance from the origin to the boundary of the Minkowski difference. EPA's function is to "expand" the GJK simplex until it finds this closest boundary point.

Algorithm

The EPA algorithm operates iteratively, expanding the initial polytope outwards toward the boundary of the Minkowski difference.

  1. Initialization: Begin with the simplex provided by the GJK algorithm (a tetrahedron in 3D) that contains the origin.
  2. Find closest face: Calculate the perpendicular distance from the origin to each face of the current polytope. Identify the face closest to the origin.
  3. Calculate support point: Use a support function to find the furthest point on the Minkowski difference in the direction of the closest face's normal vector, .
  4. Termination check: Check the distance from the origin to the new support point. If this distance is equal to (or within a predefined tolerance of) the distance to the face, the algorithm terminates. The current face lies on the boundary of the Minkowski difference, and the penetration vector is the vector from the origin to this face.
  5. Expansion: If the support point is further out, the polytope must be expanded. The closest face (and any adjacent faces visible from the support point) are removed, leaving a "hole" (or horizon) in the polytope.
  6. Reconstruction: Create new triangular faces connecting the edges of the horizon to the new support point, thereby expanding the polytope.
  7. Iteration: Return to Step 2.

Complexity and performance

In the worst-case scenario, EPA has a time complexity of , where is the number of vertices defining the Minkowski difference. However, because it is an iterative algorithm utilizing support functions, its practical performance depends heavily on the complexity of the intersecting shapes and the depth of penetration.

Limitations and challenges:

  • Floating-point errors: Because EPA involves creating increasingly smaller and flatter triangles near the boundary of the Minkowski difference, it is highly susceptible to floating-point precision errors. Degenerate faces can cause infinite loops or crashes if not handled with robust numerical tolerance checks.
  • Non-convex shapes: Like GJK, EPA strictly requires convex polytopes. Concave shapes must be decomposed into a hierarchy of convex sub-shapes (convex decomposition) before EPA can be applied.

Applications

EPA is a standard algorithm in real-time collision detection systems. It is implemented in nearly all major 3D physics engines, including:

  • Bullet Physics: Widely used in films, games, and robotics simulations.
  • Box2D: A ubiquitous 2D physics engine that uses a 2D equivalent called the Expanding Polygon Algorithm.
  • Havok: An industry-standard game physics engine.

By providing the exact penetration vector and contact points, EPA allows physics engines to apply accurate impulse forces, preventing objects in video games or simulations from sinking into one another.

References

  1. ^ van den Bergen, Gino (2001). Proximity Queries and Penetration Depth Computation on 3D Game Objects. Game Developers Conference.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.