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.
J. Heiberg (Ред.) Bibliotheca scriptorum graecorum et romanorum teubneriana (BT) In Aedibvs B.G. Tevbneri MCMLXXII, Stvtgardiae, Editio stereotypa editionis anni MCMX издание, (1972)
C. Ptolemaeus. Felicibus astris eat in lucem: Ductu Petri Liechtenstein Coloniensis Germani. Anno Virginei Partus .1515. Die .10. Ia. Venetiis ex officina eiusdem litteraria, Venetiis, (1515)