Hi! I've been trying to solve this for ages. When you have to circle moving at some point with some velocity... is there a formular to actually predict precisely when it will collide?
This stuff is a bit complicated... but here are a few equations.
The one you need is in, I've just included a few more incase you need them and so others know what's going on.
-----------------------------
Assume that the initial point is (x, y) and the initial velocity is (vx, vy). We want to advance the particle by t time units.
1) Compute xx = x + t vx and yy = y + t vy. If xx^2 + yy^2 <= 1, the particle is still in the unit circle and there is no collision. The new
position is (xx, yy) and the new velocity is the same (vx, vy).
2) If xx^2 + yy^2 > 1, then there is a collision. Need to find the collision time, tc, the point of collision (xc , yc), and the velocity after collision (vxc , vyc).
3) To find the point of collision, solve the quadratic equation
((1 - )x + xx)^2 + ((1 - )y + yy)^2 = 1
Pick the root between 0 and 1 and call it root.
4) The point of collision is given by xc = (1 - root) x + root xx and yc = (1-root) y+root yy. The time of collision is given by tc = root t.
5) The slope of the tangent to the circle at the point of collision is tangentSlope = -xc / yc . The angle between the velocity and the tangent is given by turnAngle = arctan vy - tangentSlope vx
vx + tangentSlope vy
6) The velocites after collision are given by
vxc = cos(2 turnAngle) vx + sin(2 turnAngle) vy
vyc = -sin(2 turnAngle) vx + cos(2 turnAngle) vy
7) Recursively advance (xc , yc) with velocity (vxc , vyc) by t - tc
--------------------------
Not 100% on this? Join the gang. I'm still @ 95% trying to solve a pretty hard question.
Regards,
Lloyd
This is one of the things we learned in mechanics last year.
for each circle apply this formula
r = current position + t(velocity)
Call them r1 and r2
Now if the circles will collide, r1 = r2. (Note you may wish to re arrange the equation of both r1 and r2 before making them equal to each other, for co-efficient purposes)
Now using the co-efficients of i and j find a value for t which satisfies both equations and that value of t is the time when they will collide.