Given two points in three dimensions, how can one find the direction of motion and angle of descent of a projectile

physicsprojectile motion

Say you shoot a basketball and you have the data for the ball's x, y, and z coordinates (where z is height and peaks at around z=16) through its time in the air. That's the data that I have. I want to take the ball's x,y,z coordinates when a certain z is reached on its descent, and compute the direction of motion (in terms of x and y) and angle of descent (at what angle is the ball falling at this point? like how steep is the fall) using data from that point and the previous point.

In other words, I have two points taken from the descent of a projectile: $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$, and I want to compute the descent angle and the direction of motion.

I found the following formula for descent angle: $\theta=cos^{-1}(\frac{(x_1x_2+y_1y_2+z_1z_2}{\sqrt{x_1+y_1+z_1}\sqrt{x_1+y_2+z_1}})$. However, I'm getting outputs of less than 1 degree while I'd expect the descent to be pretty steep so I'm not sure if this formula is appropriate for this problem.

For direction of motion, I'm thinking maybe I should just calculate the slope of the points $(x_1,y_1)$ and $(x_2,y_2)$ such that $\text{dir}=\frac{y_2-y_1}{x_2-x_1}$, but again I'm not 100% sure, especially because the answer would not be in degrees.

I also have data for time at these points if that is needed.

Best Answer

You made a few errors in transcribing the standard formula $$\arccos\left(\frac{x_1x_2+y_1y_2+z_1z_2}{\sqrt{x_1^2+y_1^2+z_1^2}\sqrt{x_2^2+y_2^2+z_2^2}}\right). $$ But your suspicion that it was not applicable is correct. This is the formula for the angle between the vectors $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$, that is, it tells you, if you were sitting at the point $(0,0,0)$ watching the projectile through a telescope, how much you would need to turn the telescope in order to keep it pointed at the projectile. If the positions $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$ are not too close to $(0,0,0)$ and are observed very close in time, then naturally you will not have to turn the telescope very much in order to track the projectile.

To find the direction of travel your projectile, a more useful vector would be the vector from one observed point to the next observed point, $$ (x_2 - x_1, y_2 - y_1, z_2 - z_1). $$ This vector is the sum of a horizontal vector $(x_2 - x_1, y_2 - y_1, 0)$ and a vertical vector $(0,0, z_2 - z_1)$. The vector sum can be drawn graphically as a right triangle with those two vectors as the legs and the vector $(x_2 - x_1, y_2 - y_1, z_2 - z_1)$ as the hypotenuse. The length of the hypotenuse is therefore $$ \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} $$ and the length of the vertical leg is $z_2 - z_1$, so by simple trigonometry the angle from straight-up vertical is $$ \arccos\left(\frac{z_2 - z_1} {\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}}\right) $$ and the angle from the horizontal is $$ \arcsin\left(\frac{z_2 - z_1} {\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}}\right). $$

But since the projectile travels in a curve rather than a straight line, the angle of this vector is only a kind of "average" angle of travel over the arc from the first point to the second point, not the actual angle at either endpoint. Assuming a simple parabolic arc for the path of the projectile, the angle you get from the formulas above is the exact angle of travel at the point $$\left(\frac{x_1+x_2}{2}, \frac{y_1+y_2}{2}, \frac{z_1+z_2}{2} + \zeta\right)$$ for some $\zeta> 0,$ that is, at some point whose horizontal coordinates are midway between the two observed points, but whose vertical position is somewhere above the line connecting the two points. How far above the line that position will be is a function of the acceleration of gravity and of how much time passed between the observations.

If you know the acceleration of gravity and the time that passed between observations then you can work backward from the angle measured in the above formulas to the angle at the point $(x_1,y_1,z_1)$. But a simpler method for a parabolic arc is that if you want the direction of travel at a particular time $t$, don't use the position at time $t$; instead, use the positions at time $t - \delta$ and at $t + \delta$, because then the point at which the slope of the arc matches the slope of the vector will be the point at time $t.$

For the horizontal direction, you have the right idea about looking at the points $(x_1,y_1)$ and $(x_2,y_2)$ in the $x,y$ plane. It's also true that the slope of the line between those points is not an angle in the usual meaning of the word "angle." In particular, I think you would want to distinguish a trajectory that passes through $(x_1,y_1)$ first and later through $(x_2,y_2)$ from a trajectory that passes through $(x_2,y_2)$ first and then $(x_1,y_1)$; but the formula $(y_2 - y_1)/(x_2 - x_1)$ gives the same answer in both cases.

For the horizontal direction I suggest you consider the direction of the vector $(x_2 - x_1, y_2 - y_1)$ in the $x,y$ plane. There is some discussion of the angular direction of this vector in How do we really get the angle of a vector from the components?. To summarize, the angle is essentially the result of the inverse tangent (aka arc tangent) function.

Related Question