Do these two shapes touch — and what happens when they do. A live engine tests overlap three ways (axis-aligned bounding box, sphere–sphere, and the Separating Axis Theorem for convex polygons), then resolves the hit with an elastic response that conserves both momentum and kinetic energy. Rendered, not quoted.
SOURCE Gilbert, Johnson & Keerthi (1988), “A Fast Procedure for Computing the Distance Between Complex Objects in Three-Dimensional Space,” IEEE J. Robotics & Automation 4(2):199–203 · DOI 10.1109/56.2083 — paywalled; id AMBER-verified via IEEE Xplore doc 2083.
A convex shape is the intersection of half-planes. Two convex shapes do not touch iff there exists a line onto which their shadows (projections) do not overlap — a separating axis.
For polygons it suffices to test the edge normals of both shapes. Overlap holds iff every tested axis shows overlapping intervals: no separating axis exists.
Two questions, one seam. Do these two things touch? — detection, the separating-axis theorem. And when they do: a momentum-and-energy-conserving bounce — the physics of contact.
Neighbour sphere: the-contact-response in KRÂSIS (52) — detection here hands the contact normal to the response there.
Live re-check: the SAT verdict is compared, on constructed pairs, against an independent brute-force overlap oracle. Green iff they agree on every pair.
witness idle
Press TAMPER (window 6) and this flips red within one frame — the planted void cannot hide from the oracle.
Two convex polygons in the plane, each a list of vertices. Below: a fixed diamond A and a moving square B, plus their velocities and masses for the response.
Detection is real satOverlap(); the bounce is the real elastic impulse along the contact normal. KE and momentum are printed live and stay flat — the collision is exact, not damped.
Proven at boot by selfcheck() (throws on any violation, runs with no canvas):
Bounding boxes lie. Two diamonds whose AABBs overlap can still be cleanly apart — the gap lives on a diagonal axis no box edge tests. A broad-phase AABB pass is a filter, never a verdict.
SAT is exact only for convex shapes. A concave polygon can be non-overlapping on every edge normal yet still intersect — it must be decomposed into convex pieces first, or SAT reports a false miss.
“Their boxes overlap, so they collide.”
→ AABB overlap is necessary, not sufficient. Confirm with SAT / GJK.
“Overlap on some axis means a hit.”
→ Backwards. A hit needs overlap on every axis; overlap on one proves nothing.
“An elastic bounce can lose a little energy.”
→ Then it is not elastic (e<1). Elastic means ΣKE is invariant, exactly.
The disclosed planted void: flip satOverlap to report a hit when the shapes overlap on any single axis (instead of requiring no separating axis). Two disjoint shapes are then falsely called colliding.
The Witness (window 7) catches it: the SAT-vs-brute check diverges on the disjoint pair.