This book explains the algorithms behind those collisions using basic shapes like circles, rectangles, and lines so you can implement them into your own projects.
D. Satsangi, K. Srivastava, and Gursaran. International Journal of Computer Science, Engineering and Information Technology (IJCSEIT), 2 (2):
129-149(April 2012)