Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding an interception point?

  1. Jul 7, 2008 #1
    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? :)
     
  2. jcsd
  3. Jul 7, 2008 #2
    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...
     
  4. Jul 7, 2008 #3
    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.
     

    Attached Files:

  5. Jul 8, 2008 #4
    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)
     
  6. Jul 8, 2008 #5
    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?
     
  7. Jul 8, 2008 #6
    Seems right. You could simplify equation a bit if you require more speed when running your game.
     
  8. Jul 8, 2008 #7
    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?
     
  9. Jul 8, 2008 #8
    ... 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)...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Finding an interception point?
  1. Find two points (Replies: 2)

Loading...