Finding an interception point?

  • Thread starter Thread starter The Guardian
  • Start date Start date
  • Tags Tags
    Point
AI Thread Summary
The discussion centers on finding the interception point between two objects on a 2D plane, one starting from the origin with a constant velocity and slope, and the other with a different constant velocity. The goal is to determine the point where both objects arrive simultaneously, requiring calculations involving their velocities and the angle between their paths. The conversation includes deriving an equation to solve for time (t) using the quadratic formula, emphasizing that the solution's feasibility depends on specific conditions related to their velocities and angles. Participants explore how to simplify calculations for real-time game performance while noting that the angle has minimal impact on time compared to the velocities. Ultimately, the feasibility of interception is contingent on the relationship between the velocities and the angle, with some configurations leading to no possible interception.
The Guardian
Messages
5
Reaction score
0
Sorry I wasn't sure which forum exactly to put this into.

I'm writing a computer game, and I have an object departing from 0,0 on a 2D plane with known and constant velocity and slope. X and Y will always be positive.

I also have a point on that plane with different but known (and constant) velocity.

What I'm not sure about is how to find the interception point that has the least amount of time. I know if I simply move on a perpendicular slope from the known X,Y coordinates it will be the shortest time for that object but not for the object traveling from 0,0 necessarily.

So basically I need the point at which the time for both objects to reach that point is the same.

Help please? :)
 
Mathematics news on Phys.org
Ummm if I got it right you actually want to know in which direction to go with the other point to intercept first one as soon as possible. Your trajectory will surely be a straight line.
If you draw a line between two originating points you get a triangle. One angle is known, all you have to do is write down the equation. (a^2=b^2+c^2-2*b*c*cos(fi)), fi is the angle between b and c.
You get an equation for time. From this, calculation is very simple...
 
Yes I suppose if I know the angle I can figure out the point of interception. And of course there is the possibility that it can't be intercepted.

I wasn't really sure how you were using the variables so I drew a diagram in Paint.

Point s is the starting point of the second object. Point p is the point of interception.

We know the length of c, and we can know the angle A. We also know the velocity along the paths a and b.

What I need to know in the end is: if an interception is possible, the length of a, and the coordinates of point p.
 

Attachments

  • plot.JPG
    plot.JPG
    6.3 KB · Views: 575
Length of a = v2*t, b=v1*t, this reduces problem to just one variable, t... if there exists some sensible solution of t (real, positive), this problem has a solution. Calculation of a and p is easy when you have t.
(condition for having a solution for t is that v2^2 >= v1^2*(sin(fi))^2. However, if v2^2=v1^2 and sin(fi)=1, problem has no solution)
 
OK, so if I plug those lengths in and then run it through the quadratic equation I can solve for t right?

t = ( -2 * v1 * Cos(fi) +/- sqrt( (2 * v1 * Cos(fi))2 - 4 * (v12 - v22) * c2) ) / 2 * (v12 - v22)

Look right?
 
Seems right. You could simplify equation a bit if you require more speed when running your game.
 
Cool thanks! I don't really need to speed it up I think it'll run fine, but out of curiosity how would you simplify that given that you don't know v1, v2, c, or the angle at compile time, only at run-time?
 
... so t is mostly dependent on the actual velocities of the two objects and the angle has very very little effect, right? If I use c=240, v1 = 20, v2 = 100 and fi=10° I get ~2.45 seconds, but I get the same if I set fi=40°. On the other hand with fi at 40, I do not have a legal value with which find find angle B which I assume means that an interception is impossible? (makes sense given the larger angle)...
 
Back
Top