1

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.

  • 1
    Is the ball falling fast enough that you ignore the effect of gravity? If so the path is a straight line. If not, you need the times of the two observations and the equations get much more complicated. You should make clear which it is by editing the question. In either case you can work with just $x,z$ and $y,z$ in two dimensions and combine the results. – Ross Millikan Jan 18 '21 at 15:49
  • @RossMillikan How fast is fast enough that you ignore the effect of gravity? I'm not sure. I assume it's not fast enough because it's just a basketball being shot by a human being (so it only reaches z=16 ft at most). I do have the times of the two observations. I'll edit this information in. – Machetes0602 Jan 18 '21 at 15:54
  • In a time interval $\Delta t$ the acceleration drops the ball by $\frac 12g\Delta t^2$ It depends on how accurate you want to be whether this is enough to matter. Your problem is probably that the $\arccos$ you are taking returns an answer in radians, not degrees. You need to multiply by $\frac {180}{\pi}$ to get degrees. – Ross Millikan Jan 18 '21 at 16:12
  • The issue is that with only two points you don't have enough information. Say I'm throwing the ball from the free throw line to the basket. I can throw very flat, or with a high arch. The initial and final points are the same, but angle is very different. – Andrei Jan 18 '21 at 16:24

2 Answers2

1

In an interval of time $\Delta t$ the ball will fall $\frac 12g\Delta t^2$ due to gravity. If this is enough to matter to you, add this to the final $z$ measurement to get the direction of travel at the beginning of the interval.

Now we can construct a coordinate system where there is no motion along $y$. $x$ is along the horizontal direction of travel. $z$ is vertical with positive up. Our measurements are $(x_1,z_1)$ and $(x_2,z_2)$. You can convert your measurements by putting in $\sqrt {(x_2-x_1)^2+(y^2-y_1)^2}$ for our $x_2-x_1$.

The ball now travels $x_2-x_1$ horizontally and $z_2-z_1$ vertically. The angle of travel is then $\arctan \frac{z_2-z_1}{x_2-x_1}$. This is equivalent to the expression you are using. Note that the output is in radians. If you want degrees, you need to multiply by $\frac{180}{\pi}$

Ross Millikan
  • 383,099
1

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.

David K
  • 108,155