3.2 – Collision Detection of Balls
Has anyone done this exercise? I've tried searching OpenStudy through Google but nothing pops up. If someone has solved it, I will have follow-up questions. Thanks. (P.S. It remains very irritating that there is no OpenStudy search engine.)
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I don't know the particular exercise as I have not done that course but collision detection of spheres can be done using Pythagorean's theorem and the radius of the balls.
By Pythagoreans theorem, the distance from center of one to center of the other is the square root of the sum of of the x differences squared and y differences squared.
If the sum of the two radius is greater than or equal to the above calculation then they are touching.
Fire away. I am sure there are quite a few people here who would be more than willing to help.
Works in 3 dimensions as well as two, so if you know the centers of the (circles or spheres) and the radii, can easily determine if they are touching or have collided.