Angle of Elevation (Depression) Between two 3D points

1.7k Views Asked by At

I have some eight points with defined coordinates in 3D space. These are from a straigth but bent and connected with matlab code as in Figure 1. enter image description hereMy challenge is that I need to compute the angle that exists between each consecutive 3D points in the bent line after folding the straight line to reach a defined target point. I have added Figure 1 to show the angles I am referring to. How can I calculate those angles by trigonometry?

2

There are 2 best solutions below

5
On

I am indebted in this solution to @Nominal Animal that has made me the fundamental remark that using cross product couldn't do in all situations.

Let us recall the dot product formula:

$$\tag{1}\vec{W} \cdot \vec{W'}=\|\vec{W}\|\|\vec{W'}\|\cos(\theta) \ \ \ \iff \ \ \ \cos(\theta) = \dfrac{\vec{W} \cdot \vec{W'}}{\|\vec{W}\|\|\vec{W'}\|}$$

where $\theta$ is the angle between vectors $\vec{W}$ and $\vec{W'}$.

Here is the way one can proceed for finding the angles:

  • Compute the consecutive differences between your $n=8$ consecutive points, in other terms, compute the components of the $n-1=7$ vectors $U_k:=\overrightarrow{P_kP_{k+1}}=P_{k+1}-P_k$ ($k=1,2,\cdots n-1$, differences component by component, of course).

  • Compute the norms (lengths) of the $U_k$s.

  • Compute the $n-2=6$ dot products $d_k=U_k \cdot (-U_{k+1})$ (minus sign is important). Then, using formula $(1)$:

  • Compute the $a_k=\frac{d_k}{\|U_k\|.\|U_{k+1}\|}$ (the point meaning "ordinary product" between numbers.)

  • Last step, the looked for angles are the $\cos^{-1}(a_k)$ of these numbers (refer to relationship $(1)$.)

Recall: the other formula for dot product: $\pmatrix{a\\b\\c} \cdot \pmatrix{d\\e\\f}=ad+be+cf.$

0
On

It is by coordinate definition that point to point increments are reckoned. Especially so that the data given is discrete. Absolute frame of reference is used, since data points are given that way.

Between consecutive points

$$ x_2 - x_1 = \Delta x ;\; y_2 - y_1 =\Delta y ;\; z_2-z_1= \Delta z\; ;$$

for arbitrarily general/consecutive points

$$x_{i+1}-x_{i}=\Delta x\;; y_{i+1}-y_{i}=\Delta y\; ;z_{i+1}-z_{i}=\Delta z\;;$$

In spherical coordinate system ( $ \Delta \phi$ denoting elevation or depression ):

$$ \Delta r = \sqrt{\Delta x^2+\Delta y^2} ; $$ $$\Delta \phi = \tan^{-1}{ \frac{\Delta z }{\Delta r}};$$

For arctan we need to use atan2 function to be sensitive to decide between quadrants.

While writing code one would like to importantly check

Closed Loop conditions ( by setting the first and last points to be the same) of first difference sums should vanish, helps to detect any computational errors:

Cartesian coordinates

$$ \Delta\Sigma x=0\;,\Delta\Sigma y=0\;, \Delta\Sigma z=0\;$$

Spherical Coordinates

$$ \Delta\Sigma r=0\;, \Delta\Sigma \theta=0\;,\Delta\Sigma \phi=0\;$$ out of which only the last has been asked for here.