cos c = cos a cos b + sin a sin b cos C
where a, b, and c are the angular lengths of the sides of a spherical triangle; and C is the angle of the vertex opposite line c.
By definition, for a sphere of radius 1, the length of a side is equal to its angular length in radians.
cos c = ±√(1 − sin2a) cos b + sin a sin b cos C
cos c − sin a sin b cos C = ±√(1 − sin2a) cos b
cos2c + sin2a sin2b cos2C − 2 cos c sin a sin b cos C = (1 − sin2a) cos2b
cos2c + sin2a sin2b cos2C − 2 cos c sin a sin b cos C = cos2b − sin2a cos2b
sin2a sin2b cos2C + sin2a cos2b − 2 cos c sin a sin b cos C + cos2c − cos2b = 0
(sin2b cos2C + cos2b) sin2a − (2 cos c sin b cos C) sin a + (cos2c − cos2b) = 0
Now solve the quadratic equation for sin a, yielding up to 2 unique intermediate solutions. Note that since the sine function does not have a unique inverse, there may be more than 2 unique final solutions.
cos c − cos a cos b = sin a sin b cos C
(cos c − cos a cos b) ⁄ (sin a sin b) = cos C
cos−1[(cos c − cos a cos b) ⁄ (sin a sin b)] = C
All POV-Ray trigonometric functions use radians. To take a function of an angle in degrees, use:
sin (radians (AngleInDegrees)) cos (radians (AngleInDegrees))
or
#include "math.inc" sind (AngleInDegrees) cosd (AngleInDegrees)
To convert an inverse trigonometric function to degrees (e.g., for use in a rotate
transformation) use:
degrees (asin (X)) degrees (acos (X))
or
#include "math.inc" asind (X) acosd (X)
Derivation | Spherical trigonometry | POV-Ray