Interior angle of spherical polygon given the coordinates of vertices in spherical coordinates

Context:

On a sphere, I'm given a positively oriented spherical polygon whose vertices are (in order) $$A(R,\phi_1,\theta_1),\ B(R,\phi_2,\theta_2),\ C(R,\phi_3,\theta_3),\ \cdots, (R,\phi_n,\theta_n).$$ How can I calculate the area of the spherical polygon?

I know that the area $S$ of spherical polygon is tightly related to the spherical excess and therefore $$S = R^2\left[\sum_{i=1}^{n}\alpha_i - (n-2)\pi\right].$$

Question: How could I obtain the interior angles $\alpha_i$ of the spherical polygon?

As an illustration, the three vertices $A$, $B$ and $C$ will contribute to $\alpha_2$ which is the interior angle at vertex $B(R,\phi_2,\theta_2)$.

Since the length of arcs $\newcommand{arc}[1]{\stackrel{\Large\frown}{#1}}\arc{AB}$, $\arc{BC}$ and $\arc{CA}$ could be calculated easily from the great circle distances, I think I have a good starting point to calculate the interior angle $B$ because

• I have three sides of the spherical triangle $\Delta ABC$, which means that
• the spherical angle at $B$ in spherical triangle $\Delta ABC$ is uniquely determined.

However, I don't really know how to solve for the spherical angle given three sides.

To make matters worse, solving the spherical triangle doesn't actually tell me whether I should pick $\alpha_2=B$ or $\alpha_2=2\pi-B$ as the interior angle. As seen in the illustrated case, the reflex angle $2\pi-B$ is the interior angle.

Answers that can contribute to my learning could calculate the interior angle from the list of spherical coordinates

• by solving the spherical triangle and then account for the concave / convex angle,
• by illustrating the use of vectors, or
• from an entirely new perspective.
• $\phi$ is the azimuth and $\theta$ is the polar angle. Aug 22, 2016 at 17:13
• You can use the cosine rules. Aug 22, 2016 at 17:15
• @aretino I'm aware of the cosine rule, but from the looks of it, it only gets me the cosine value $\cos B$. I'm afraid that information is not enough for me to decide whether to take $B$ or $2\pi-B$? If I also knew $\sin B$, I could use the double-argument tangent function. Aug 22, 2016 at 17:21
• To decide whether your angle is greater than $\pi$ or not, you could examine four consecutive vertices $ABCD$ and check if $A$ and $D$ are on the same side of $BC$: if that is not the case, then one of angles $B$, $C$ is convex and the other one is concave. Aug 22, 2016 at 17:27
• @Aretino $B$ and $C$ can be both concave, aka between $0& and$\pi$or both be convex, aka between$\pi$and$2\pi$if$A$and$D$are on the same side of sphere as divided by the great circle passing through$B and $C$. Aug 22, 2016 at 17:32

I'd ignore the radius $R$ (i.e. take the earth's radius as unit of length) and then convert to Cartesian coordinates:

\begin{align*} x&=\cos\phi\cos\lambda\\ y&=\cos\phi\sin\lambda\\ z&=\sin\phi \end{align*}

These vectors point from the center of the sphere to the vertices of your polygon. Two such vertices are joined by a greatcircle arc. That greatcircle is the intersection of your sphere with a plane through the origin. That plane through the origin is defined by its normal vector. The cross product of two vectors is perpendicular to both of them, so you can use the cross product to compute these normal vectors. Writing $v_i=(x_i,y_iz_i)$ for the vertices, you get the normals of the edges as

$$n_i = v_i\times v_{i+1}$$

The angle at a vertex is equal to the angle between the corresponding normal vectors. You can compute that using the dot product, dividing by the lengths to ensure normalization:

$$\alpha_i = \pm\arccos- \frac{n_{i-1}\cdot n_{i}}{\lVert n_{i-1}\rVert\,\lVert n_i\rVert}$$

The minus sign in there is because for a normalized dot product of $1$, both normals point in the same direction, so you have zero change in direction but the inner angle there is $180$.

So which sign should you choose for the $\pm$ in there? For that, look at the determinant of the $3\times3$ matrix formed by $v_{i-1}$, $v_i$ and $v_{i+1}$. The sign of that matrix will tell you whether the triangle these three vectors form on the surface is oriented clockwise or counter-clockwise. Take the sign from this and the value from the $\arccos$ above and you should be almost done.

As usual with signs, you have a decision to make: which sign is which? Well, one choice of sign (e.g. exactly as described above) will lead you one polygon, the other (with the sign of the determinant flipped, or eqivalently the order of vectors inside the determinant reversed) leads to the complementary polygon. One will have all its vertices in clockwise order, the other in counter-clockwise order. Trying this out on a tiny example (e.g. three points forming three right angles) will tell you which one is which.