Theory of collision detection