module

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

penetration(sa : Support, sb : Support) : Tuple(Flock::Vec3, Float32) | Nil
Source
support_capsule(p0 : Flock::Vec3, p1 : Flock::Vec3, r : Float32) : Support
Source
support_obb(box : OBB3D) : Support
Source
support_sphere(center : Flock::Vec3, r : Float32) : Support
Source

Nested types