Calculating if two objects will come within a given distance

In summary: Another approach could be to use the equations of motion for both objects and find the point where their distance is minimized. This could involve taking the derivative of the distance equation and setting it equal to zero, as you initially suggested. However, it may also be helpful to use a computer program or simulation to analyze the motion and find the closest approach. Overall, there are multiple ways to approach this problem, and it may be helpful to try different methods to find the most efficient and accurate solution.
  • #1
ferret_guy
18
0
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]d=tv[/itex]
[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:
Physics news on Phys.org
  • #2
explain your problem with proper velocities?
 
  • #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
 
  • #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?
 
  • #5
ferret_guy said:
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?

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 don't 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?
 
  • #6
ferret_guy said:
Seems like there could be a better way
As drvrm said, choosing the rest frame of one of the objects reduces the mathematical complexity of such problems.
 

FAQ: Calculating if two objects will come within a given distance

1. How do you calculate the distance between two objects?

The distance between two objects can be calculated using the distance formula, which is:
d = √((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
where (x1, y1, z1) and (x2, y2, z2) are the coordinates of the two objects in a 3-dimensional space.

2. What is the unit of measurement for distance?

The unit of measurement for distance can vary depending on the system being used. In the metric system, the standard unit of measurement for distance is meters. In the imperial system, it is feet. However, in scientific calculations, the unit of measurement is usually in meters.

3. How do you determine if two objects will come within a given distance?

To determine if two objects will come within a given distance, you need to compare the calculated distance between the objects with the given distance. If the calculated distance is less than or equal to the given distance, then the two objects will come within that given distance.

4. Can you calculate the distance between two moving objects?

Yes, the distance between two moving objects can also be calculated using the same distance formula. However, the coordinates of the objects will need to be updated at different time intervals to account for their movement.

5. Is it possible for two objects to never come within a given distance?

Yes, it is possible for two objects to never come within a given distance. This can happen if the two objects are moving in opposite directions or if their paths do not intersect. In such cases, the calculated distance between the objects will always be greater than the given distance.

Similar threads

Back
Top