distance3d.mpr.mpr_penetration¶
- distance3d.mpr.mpr_penetration(collider1, collider2, mpr_tolerance=0.0001, max_iterations=100)[source]¶
Minkowski Portal Refinement (MPR) with penetration info.
The returned penetration direction and contact position form a line along which the penetration happens. The penetration direction is computed such that adding depth + penetration_direction to each vertex of the second collider separates the two colliders.
- Parameters:
- collider1ConvexCollider
Convex collider 1.
- collider2ConvexCollider
Convex collider 2.
- mpr_tolerancefloat, optional (default: 0.0001)
Boundary tolerance for MPR algorithm
- max_iterationsint, optional (default: 100)
Maximum number of iterations.
- Returns:
- intersectionbool
Do the two colliders intersect?
- depthfloat or None
Penetration depth.
- penetration_directionarray, shape (3,) or None
Penetration direction. Vector will be either a unit vector or zero vector in case of touching colliders.
- contact_positionarray, shape (3,) or None
Contact position.