An efficient collision detection algorithm for polytopes in virtual environments