# Practical physics problem about distance between lines.

I am a software engineer and I’m developing a soccer game. I have a solution for this problem based on Newton law and I’m using Newton method to solve the equation I got. I’m here because I think there may be a better solution for this problem, but I’m not sure how to start. I need guidance more than a solution. I believe can study anything that could lead to a solution. I took a very basic Physics approach, so I’m posting this question in Mathematics to see if I get ideas far from what I thought.

So here is the problem: imagine one soccer player passing the ball to another. This one player will kick the ball and it will make a parabolic trajectory. He will kick the ball to a determined point where the second player (receiver) is not; the second player will run to it, with a constant speed.

For simplicity, I’m taking the ball as a particle, no air resistance, and infinite acceleration for the player. You can make other simplifications for the things I don’t see.

The ball trajectory can be split in two movements, one horizontal uniform motion and one vertical simple harmonic motion.

The question is: what is the velocity that should be applied to the ball so the player and the ball will get to the same point at the same time? That is, how should the player kick the ball so the other player can perfectly intercept the ball?

I made an equation D that is the difference of distance between the receiver and ball when the receiver got to the interception point, and solved for D = 0.

The kick has minimum and maximum angulations, so depending where the receiver is, there may not be a solution for the equation. I had to plot the equation to see the limits and adjust the Newton algorithm to converge and to converge fast, since it’ll have to find a solution in runtime. It did not end up very well. I need another approach.

I used basic Newton equations, but I thought I could use linear algebra, Closest Point of Approach, to end up with a simpler, literal solution. Or that I could model the ball and player motion in a set of differential equations that could be numerically solved without the ugly manipulations I had to make, and could be used to solve other problems of the game (more generic solution).

-
"The ball trajectory can be split in two movements, one horizontal uniform motion and one vertical simple harmonic motion." The vertical motion isn't simple harmonic motion, it's motion with constant acceleration. – Ben Crowell Mar 12 '12 at 20:52

If the second play has velocity $v_2$ metres/second and has to run a distance $d_2$ metres then this will take time $t=d_2/v_2$ seconds.

So if the ball has to travel a horizontal distance $d_1$ metres, it needs a horizontal velocity $v_{horiz}=d_1/t$ metres/second. Meanwhile it needs a vertical velocity which means it is at ground level after $t$ seconds and at that stage its vertical velocity has reversed. So $-v_{vert}=v_{vert}-gt$ where $g$ is the gravitational acceleration (about $9.8$ metres/second$^2$), so $v_{vert}=gt/2$ metres/second.

So the initial speed of the ball combines the horizontal velocity and vertical velocities and is $$\sqrt{v_{horiz}^2+v_{vert}^2} = \sqrt{\left(\frac{d_1}{t}\right)^2+\left(\frac{g\, t}{2}\right)^2} = \sqrt{\left(\frac{d_1 v_2}{d_2}\right)^2+\left(\frac{g \, d_2}{2v_2}\right)^2} \text{ metres/second}.$$

The tangent of the angle at which the ball has to be kicked is $v_{vert}/v_{horiz}$ so the angle is $$\tan^{-1}\left(\frac{g \, d_2^2}{2 d_1 v_2^2}\right).$$

-

At time $t=0$ the shooter is at the origin $O$, and the second player is at the point $A:=(a,0)$, $a>0$. The shooter chooses a horizontal direction ${\bf u}:=(\cos\phi,\sin\phi)$, an inclination angle $\theta$ with respect to the horizontal, and an initial velocity $v_0>0$. If $\phi=0$ then the trajectory of the ball can be written as $$t\mapsto\bigl(v_0\cos\theta\ \ t\ , 0\ , v_0\sin\theta\ \ t -{g\over2}t^2\bigr)\qquad(t\geq 0) .$$ Therefore the flying time $t$ of the ball is given by $$t={2v_0\sin\theta\over g}\ ,$$ and the ball will land at the point $B:=r{\bf u}$ at distance $$r={v_0^2\sin(2\theta)\over g}$$ from the origin.

The second player has his own velocity $v_2$, and in the available time interval of length $t$ he can run the distance $d=v_2 t$. If he is required to arrive at $B$ at the same time as the ball the law of cosines, applied to the triangle $AOB$, gives the equation $d^2=a^2+r^2-2 a r\cos\phi$, or $$\sin^2(2\theta) v_0^4 - 2\bigl(a g\sin(2\theta)\cos\phi+2v_2^2\sin^2\theta\bigr)v_0^2 + a^2g^2=0\ .$$ This is the only condition I can see. Given $a$, $g$ and $v_2$, the parameters available to the shooter are $v_0$, $\theta$ and $\phi$, and he has to choose them in such a way that this condition is met.

-