Skip to main content
Mathematics

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

See http://stackoverflow.com/a/21486462/380384 https://stackoverflow.com/a/21486462/380384

Or follow these steps

  1. Create two vectors $A=(S-E)$ and $B=(W-E)$
  2. Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
  3. Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
  4. Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
  5. Get the desired angle by $\pi - \theta$

See http://stackoverflow.com/a/21486462/380384

Or follow these steps

  1. Create two vectors $A=(S-E)$ and $B=(W-E)$
  2. Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
  3. Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
  4. Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
  5. Get the desired angle by $\pi - \theta$

See https://stackoverflow.com/a/21486462/380384

Or follow these steps

  1. Create two vectors $A=(S-E)$ and $B=(W-E)$
  2. Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
  3. Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
  4. Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
  5. Get the desired angle by $\pi - \theta$
Source Link
John Alexiou
  • 14.8k
  • 1
  • 41
  • 78

See http://stackoverflow.com/a/21486462/380384

Or follow these steps

  1. Create two vectors $A=(S-E)$ and $B=(W-E)$
  2. Calculate the dot product $$\cos\theta = A\cdot B = A_x B_x + A_z B_z$$
  3. Calculate the magnitude of the cross product $$\sin\theta = |A \times B| = A_x B_y - A_y B_x $$
  4. Use the ATAN2() function to get the included angle $$\theta = {\rm atan2}(\sin \theta, \cos \theta)$$
  5. Get the desired angle by $\pi - \theta$

AltStyle によって変換されたページ (->オリジナル) /