See http://stackoverflow.com/a/21486462/380384 https://stackoverflow.com/a/21486462/380384
Or follow these steps
- Create two vectors $A=(S-E)$ and $B=(W-E)$
- Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
- Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
- Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
- Get the desired angle by $\pi - \theta$
See http://stackoverflow.com/a/21486462/380384
Or follow these steps
- Create two vectors $A=(S-E)$ and $B=(W-E)$
- Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
- Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
- Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
- Get the desired angle by $\pi - \theta$
See https://stackoverflow.com/a/21486462/380384
Or follow these steps
- Create two vectors $A=(S-E)$ and $B=(W-E)$
- Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
- Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
- Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
- Get the desired angle by $\pi - \theta$
See http://stackoverflow.com/a/21486462/380384
Or follow these steps
- Create two vectors $A=(S-E)$ and $B=(W-E)$
- Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
- Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
- Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
- Get the desired angle by $\pi - \theta$