Search code examples
algorithm2dcollision-detectionphysics

Axis-Aligned Bounding Boxes vs Bounding Ellipse


Why is it that most, if not all collision detection algorithms today require each 2D body to have an AABB for the use in the broad phase only?

It seems to me like simply placing a circle at the 2D body's centroid, and extending the radius to where the circle encompasses the entire body would be optimal. This would not need to be updated after the body rotates and broad overlap-calculation would be faster to. Correct?

Bonus:
Would a bounding ellipse be practical for broad phase calculations also, since it would better represent long, skinny shapes? Or would it require extensive calculations, defeating the purpose of broad-phase?


Solution

  • Bounding boxes are represented by linear inequality constraints while circles and ellipses need quadratic inequality constraints. One can work with both, but the linear case, as always, is much simpler to solve algorithmically (it only involves a matrix multiplication). If the bounding boxes are aligned with the world coordinate axes then all the checks look like xa - xb > dxa + dxb, ya - yb > dya + dyb and za - zb > dza + dzb, where d$i$j is the dimensions of the bounding box around object $j in the $i$ direction.

    Ellipse collisions detection is being done, however. The math is significantly harder and the implementation and computational effort might not be worth the savings. In any case, I searched Google scholar for "ellipse collision detection" and at least two papers on the first page seemed to be exactly on this topic: http://hub.hku.hk/bitstream/10722/47091/1/121854.pdf?accept=1 and ftp://crack.seismo.unr.edu/downloads/russell/doven_2005_neighbor_list_collision_driven_MD_II.PDF