I have two points in the sky and I have their coordinates in Azimuth and Elevation angles with respect to position O. I want to find the scalar angle between the two points w.r.t. position O. Thank you so much for your help!
3 Answers
The simplest is to convert from spherical to Cartesian coordinates and take the dot product (cosine of the angle).
https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates
The angle may be calculated as the angle between the two unit vectors starting at position $O$ and pointing to each location in the sky. The angle between any two vectors with the same origin may be calculated using the dot product in Cartesian coordinates but since we just have unit vectors, we can simplify the math a bit.
The angle $\theta$ between any two vectors with the same origin $\vec{v}$ and $\vec{u}$ is $$\theta_{u,v}=\cos^{-1}\left(\frac{\vec{v}\cdot\vec{u}}{\|\vec{v}\|\|\vec{u}\|}\right).$$ However, since we have unit vectors, i.e., $\|\vec{v}\| = 1$ and $\|\vec{u}\|=1$, we can simplify to $$\theta_{u,v}=\cos^{-1}\left(\vec{v}\cdot\vec{u}\right),$$ which in Cartesian coordinates is $$\theta_{u,v}=\cos^{-1}\left(x_vx_u+y_vy_u+z_vz_u\right).$$ To get Cartesian coordinates from the $Az$ and $El$ angles (remembering that we are using unit vectors so $r$ is 1): $$x = \cos El \cos Az,$$ $$y = \cos El \sin Az,$$ and $$z = \sin El.$$ Note that here $El$ is defined as the angle from the $x$-$y$ plane.
Thus, if we have two points in the sky defined by ($Az_1$,$El_1$) and ($Az_2$,$El_2$) relative to a common origin $O$, the angle between them may be calculated as $$\theta_{u,v}=\cos^{-1}\left[ \cos El_1 \cos El_2 \cos (Az_1 - Az_2) + \sin El_1 \sin El_2 \right].$$
Directly using Cosine rule of the spherical triangle, given also in (Wiki)with standard nomeclature.
$$\Delta \sigma=\cos ^{-1}( \sin \phi_1\sin \phi_2 + \cos \phi_1\cos \phi_2)\Delta \lambda$$
The angle is subtended by a part of the great circle at sphere at the centre, a geodesic arc segment.