![:(](./images/smilies/icon_frown.gif)
described below
[algo]
first i have calculated the velocity vectors: v1<x,y,z> and
v2<x,y,z> by the following rule
x2 = x1 + v1.x * time;
y2 = y1 + v1.y * time;
z2 = z1 + v1.z * time;
and v2<x,y,z> calculated in the same fashion.
let 1st missile comes to point p<x,y,z> after
time 't' and 2nd missile to point q<x,y,z>.
then i get
p.x = x1 + v1.x * t;
p.y = y1 + v1.y * t;
p.z = z1 + v1.z * t;
where <x1,y1,z1> is the initial position of 1st missile.
and
q.x = x3 + v2.x * t;
q.y = y3 + v2.y * t;
q.z = z3 + v2.z * t;
<x3,y3,z3> is the initial position of 2nd missile.
then i got the equation of the distance between p and q which
is: sqrt[ a second order equation of t, say at^2+bt+c ]
then i calculated the turning point(time) of this equation and say
that time was T [ T = -b/2a ]. i just checked if T<0 then the initial
distance is the minimum or the min value is sqrt(aT^2+bT+c).
is there anything wrong with my algo or i just missed some point?
can anybody help me? Thanks in advance.