Sort, sweep, and prune: Collision detection algorithms