# Circle-Circle collision intersection point

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

## Recommended Posts

Given two circles, each with an old position (where they are not colliding) and a new position (where they are colliding)... How can I find at what point they collide between the old and new position?

##### Share on other sites
Wouldn't they technically collide at a minimum of two points?

Edit: re-read it. Perhaps you mean at what time ??

##### Share on other sites
yes, at what point in time does the distance between the two circles, minus the radius of both circles... equal zero

##### Share on other sites
Hmm. I'm trying to think of a way to do this and I'll try to do some math on paper but I have a sort of quick way you could figure it out.
Find the two points the circles collide at.
Reverse the velocities of the circles.
Increment the positions of the circles with the negative velocities at a set amount of time.
When the two points of intersection are roughly the same point calculate the number of time steps to get to this point.

So you have the point in time from the current time the two circles first intersected.

##### Share on other sites
I attempted to write it out algebraically... not sure if this is right:
D - distance between circles
T - time
C1/C2 - circle1/circle2

D =
Sqrt(
(C1.XOLD + T * (C1.XNEW - C1.XOLD) - (C2.XOLD + T * (C2.XNEW - C2.XOLD)))^2 +
(C1.YOLD + T * (C1.YNEW - C1.YOLD) - (C2.YOLD + T * (C2.YNEW - C2.YOLD)))^2

If that is correct, I'd probably have trouble rearranging it to make T the subject : /

##### Share on other sites
let x1/2 be circle positions, r1/2 radii, v1/2 velocities

||x1+t.v1 - x2-t.v2||=r1+r2
||(x1-x2) + t(v1-v2)||=r1+r2
||x1-x2||^2 + t^2||v1-v2||^2 + 2t(x1-x2).(v1-v2) = (r1+r2)^2

and done. quadratic equation in t. solve for both values; choose minimum t value >= 0

##### Share on other sites
Sorry I don't understand... how can I find out what time they collide if t isn't the subject?

##### Share on other sites
It's a quadratic equation, whos solutions have been known for over a thousand years and is taught in high school ;)

at^2 + bt + c = 0 -> t = (-b +/- sqrt(b^2 - 4ac)) / 2a

here, a = ||v1-v2||^2, b = 2(x1-x2).(v1-v2), c = ||x1-x2||^2 - (r1+r2)^2

##### Share on other sites
Ok I'll attempt to implement that, though I'd like to clarify...

Anything between || || is to be normalized, and the " 2(x1-x2).(v1-v2)" part is the (dot product between the two resulting vectors) * 2?

##### Share on other sites
normalized, what no. ||x|| means the length of x

1. 1
2. 2
Rutin
22
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
631775
• Total Posts
3002278
×