[Math] Angle of Elevation (Depression) Between two 3D points

analytic geometrygeometrykinematicsroboticstriangles

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?

Best Answer

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.$

Related Question