Every time a video game character lands on a platform, a car crumples in a crash simulation, or a robot arm avoids a wall, a question has to be answered in microseconds: do these two objects overlap?
The naive answer — sample thousands of points and check whether any lie inside both objects — is far too slow for real time. The clever answer, found by Elmer Gilbert, Daniel Johnson, and S. Sathiya Keerthi in 1988, reduces the whole question to a single geometric fact:
Two convex shapes overlap if and only if their Minkowski difference contains the origin.
The GJK algorithm (named for its three inventors) exploits that fact by building a small simplex — a triangle in 2-D, a tetrahedron in 3-D — that tries to enclose the origin inside the Minkowski difference. It converges in a handful of steps, touching at most a few support points per iteration, making it one of the fastest collision tests known.
Like closest-pair or convex-hull algorithms, GJK belongs to the world of computational geometry: problems where the answer is proven to exist and the challenge is finding it as cheaply as possible.
Comments
Loading comments...