Improved pixel accurate collision detection algoritm