Flock::Collision::GJK3D
General convex-vs-convex penetration in 3D via GJK (find the origin inside the Minkowski difference) + EPA (expand the polytope to the nearest boundary face for the penetration normal and depth).
Shapes are given as support functions s(dir) = farthest point in dir.
penetration returns {normal (A -> B, unit), depth} when overlapping, else nil.
Constants
EPA_MAX = 64
EPS = 1e-12_f32
Applied to SQUARED quantities (support-point duplication, zero-length dir and degenerate faces), so 1e-12 here is ~1e-6 in linear units — well below EPA's 1e-4 convergence, so small deep overlaps are not abandoned early.
GJK_MAX = 32
Instance methods
support_obb(box : OBB3D) : Support
Source