1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculating if two objects will come within a given distance

  1. Feb 21, 2016 #1
    I am having trouble calculating if two objects with initial positions and velocity vectors will come within a given distance of one another and if so calculating where the closest approach is. Can anyone point me in the right direction?

    My initial thoughts are that both are linear functions where:
    [itex]y=tv(cos \theta )+y_{i}[/itex]
    [itex]x=tv(sin \theta)x_{i}[/itex]
    The distance is:
    [itex]d = \sqrt {( {x_1 - x_2 })^2 +( {y_1 - y_2 })^2}[/itex]
    Expanding to:
    [itex]d = \sqrt {( {(tv_{2}sin \theta_{2}+x_{2_{i}})- (tv_{1}sin \theta_{1}+x_{1_{i}}) })^2 +( {(tv_{2}cos \theta_{2}+y_{2_{i}})- (tv_{1}cos \theta_{1}+y_{1_{i}}) })^2 }[/itex]
    My next thought is to take the derivative with respect to time to find the turning point of the graph and thus the closest approach to one another. If the turning point is when t is negative then t0 is the closest approach and if it is greater than t0 then the value is the closest approach
    Last edited: Feb 21, 2016
  2. jcsd
  3. Feb 21, 2016 #2
    explain your problem with proper velocities?
  4. Feb 21, 2016 #3
    I am writung some software for quadcopters and I need to be able to see if they will come within some distance of one another I think the best solution is to just find the closet approach. Only need a 2d solution as they are all on the same plane
  5. Feb 22, 2016 #4
    After using wolfram mathematica I have found that the differential is:
    [itex]\left(\frac{2 \left(v_2 \sin \left(\theta _2\right)-v_1 \sin \left(\theta _1\right)\right) \left(-x_{1_i}+x_{2_i}-t v_1 \sin \left(\theta _1\right)+t v_2 \sin \left(\theta _2\right)\right)+2 \left(v_2 \cos \left(\theta _2\right)-v_1 \cos \left(\theta _1\right)\right) \left(-y_{1_i}+y_{2_i}-t v_1 \cos \left(\theta _1\right)+t v_2 \cos \left(\theta _2\right)\right)}{2 \sqrt{\left(-x_{1_i}+x_{2_i}-t v_1 \sin \left(\theta _1\right)+t v_2 \sin \left(\theta _2\right)\right){}^2+\left(-y_{1_i}+y_{2_i}-t v_1 \cos \left(\theta _1\right)+t v_2 \cos \left(\theta _2\right)\right){}^2}}\right)[/itex]

    and solving for when d/dt =0 gives:
    [itex]\frac{v_1 \left(-\sin \left(\theta _1\right)\right) x_{1_i}+v_2 \sin \left(\theta _2\right) x_{1_i}+v_1 \sin \left(\theta _1\right) x_{2_i}-v_2 \sin \left(\theta _2\right) x_{2_i}-v_1 \cos \left(\theta _1\right) y_{1_i}+v_2 \cos \left(\theta _2\right) y_{1_i}+v_1 \cos \left(\theta _1\right) y_{2_i}-v_2 \cos \left(\theta _2\right) y_{2_i}}{v_1^2 \sin ^2\left(\theta _1\right)+v_2^2 \sin ^2\left(\theta _2\right)-2 v_2 v_1 \sin \left(\theta _1\right) \sin \left(\theta _2\right)+v_1^2 \cos ^2\left(\theta _1\right)+v_2^2 \cos ^2\left(\theta _2\right)-2 v_2 v_1 \cos \left(\theta _1\right) \cos \left(\theta _2\right)}[/itex]

    and knowing that it only equals zero in one location I can solve for that point in time to find the closest distance and position of closest approach. Seems like there could be a better way, and if done in 3d would give even more ridiculous results. Is there a better way?
  6. Feb 22, 2016 #5
    well suppose in the plane there are two vehicles each located by a position and velocity vector
    say at r(1) and r(2) there velocity being v(1) and v(2) at time t=t(1);
    i do not know but if you are sitting on one and observing the closest approach - why dont you apply a reverse velocity to your self as well as the other one- so you go to rest and the body (other) has a net velocity v(1) + v(2) a vector addition.
    the distance between 1 and 2 is r= r(1)- r(2) a vector addition at t=t(1) initial time.
    so if you analyse the motion of 2 with respect to 1 and minimize the distance as time advances ,i think you can get a way out...how do you feel about this approach?
  7. Feb 22, 2016 #6


    User Avatar
    Science Advisor

    As drvrm said, choosing the rest frame of one of the objects reduces the mathematical complexity of such problems.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook