working collision detection with one segment