Minkowski Portal Refinement
The second mind trip comes primarily from computational geometry and Minkowski spaces, but I’ll see if I can’t sum it up. Imagine you had two shapes J and K, and somehow you subtracted every single point in J from every single point in K. One interesting thing that would come up is that if the shapes were colliding, then necessarily the zero vector would show up in the subtraction (because the two shapes would have at least one point in common, thus that point minus itself is zero!). Furthermore, we introduced a new operation called the Minkowski Difference, which is essentially the subtraction I described above, however, it turns out that we don’t actually need to subtract all the points from each other (this would be prohibitively expensive). Instead, what we can do is attempt to combine what we talked about above with the Minkowski Difference operation, and attempt to find the zero vector! This step is a little more complicated than I’m making it out to be, but that is the gist of the algorithm (actually what I covered is more like GJK, but MPR is a subset of GJK). From that point, when you find the origin, it turns out you can also find the penetration depth and contact normals.
For anyone that wants to see an implementation or code sample, here it is: MPR