I wanted to actually understand collision detection — not "call the library function," but understand it well enough to write it myself. So I built a small 2D physics engine in C++ and SDL2, no external physics library, and picked the Separating Axis Theorem (SAT) as the core algorithm.
Here's how it works, and the gotchas I ran into turning "shapes are touching" into "shapes bounce correctly."
Why not just bounding circles?
Circle-vs-circle collision is one line: compare the distance between centers to the sum of the radii. Easy, but wrong the moment you want anything that isn't round — a square, a triangle, a pentagon. Once shapes have edges and orientation, you need real polygon-vs-polygon detection. That's what SAT gives you.
The idea behind SAT






