Jump to content
  • Advertisement
Sign in to follow this  
Exchange

Circles Collision Detection

This topic is 3983 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys. I just signed up here and I have a question that I wanted to ask. I’d really appreciate it if somebody could please help me with this. Imagine a circle with the radius of 2 inches. Now imagine another circle with the same radius drawn somehow that the center of the second circle is a point on the circumference of the first circle. Therefore, the center of Circle1 will be on the circumference of Circle2, also. Now what I need to know is the X and Y coordinates of the two points that are the collision points of the circumference of both of the circles. When these two circles collide, they do in two points that is obviously located on the circumference of both of them. Now is there any way that I can find the X and Y coordinates of these two points? I have tried the Pythagorean Theorem; finding the sine and cosine of some of the angles; length of the lines; midpoints; slope-intercept formulas and etc for each of the lines but no dice yet in finding the coordinates of the colliding points. I have attached a picture to this post that shows exactly what I need to find out: which is the coordinates of the “z” point in Cartesian coordinate system. I’d appreciate it if somebody could help me. Radius of the circles in the picture = 2.23607 http://www.asmtrauma.com/Circles.png

Share this post


Link to post
Share on other sites
Advertisement
Use the equation for a circle, (x-a)^2 + (y-b)^2 = r^2, where (a,b) is the center and r is the radius. Take the equations for the two circles and solve for x and y. You'll end up with a quadratic equation whose solutions will be the intersection points.

Share this post


Link to post
Share on other sites
If you only care about the collisions along the circumference, then take the equation for the circle for each and solve it together:

(x-h)^2 + (y-k)^2 - r^2 = 0

[(x-h)^2 + (y-k)^2 - r^2]1 = [(x-h)^2 + (y-k)^2 - r^2]2

Share this post


Link to post
Share on other sites
Thanks guys. I solved the system of linear equations and I got these results:

Circle1.Center = (0, 0), Radius = 2
Circle2.Center = (2, 0), Radius = 2


Circle1.Equation = x^2 + y^2 = 4
Circle2.Equation = (x-2)^2 + y^2 = r^2 = x^2 - 4x - 4 + y^2 = 4

Multiply the equation of the first circle by (-1):

-x^2 - y^2 = -4
x^2 - 4x - 4 + y^2 = 4


-4x - 4 = 0
-4x = 4
x = -1

Solve for y:

x^2 + y^2 = 4
1 + y^2 = 4
y^2 = 3
y = Sqrt(3)
y = 1.732050807568877293573725295594556428114


So the first collision point on the circumference of both of the circles would be (1, 1.73). Now what I need to know is the second point of collision. How can I find that? I'd appreciate your help.

Share this post


Link to post
Share on other sites
Quote:
Original post by Exchange

Solve for y:

x^2 + y^2 = 4
1 + y^2 = 4
y^2 = 3
y = Sqrt(3)
y = 1.732050807568877293573725295594556428114


So the first collision point on the circumference of both of the circles would be (1, 1.73). Now what I need to know is the second point of collision. How can I find that? I'd appreciate your help.



Remember that y^2 = 3 has two solutions: +sqrt(3) and -sqrt(3).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!