distance3d.epa.epa¶
- distance3d.epa.epa(simplex, collider1, collider2, max_iter=64, max_loose_edges=32, max_faces=64, epsilon=1e-08)[source]¶
Expanding Polytope Algorithm (EPA).
Find minimum translation vector to resolve collision.
Based on Kevin Moran’s implementation: https://github.com/kevinmoran/GJK/blob/b38d923d268629f30b44c3cf6d4f9974bbcdb0d3/GJK.h (MIT License or Unlicense)
- Parameters:
- simplexarray, shape (4, 3)
Simplex of Minkowski distances obtained by GJK.
- collider1Collider
Convex collider 1.
- collider2Collider
Convex collider 2.
- max_iterint, optional (default: 64)
Maximum number of iterations.
- max_loose_edgesint, optional (default: 32)
Maximum number of loose edges per iteration.
- max_facesint, optional (default: 64)
Maximum number of faces in polytope.
- epsilonfloat, optional (default: 1e-8)
Floating point tolerance.
- Returns:
- mtvarray, shape (3,)
Minimum translation vector to be added to the second set of vertices or subtracted from the first set of vertices to resolve the collision. The norm of this vector is the penetration depth and the direction is the contact normal.
- facesarray, shape (n_faces, 4, 3)
Faces in Minkowski difference space, defined by 3 points and its normal.
- successbool
EPA converged before maximum number of iterations was reached.