In spherical geometry, the “straight lines” are not Euclidean lines. The shortest paths on the
surface of a sphere are called geodesics, and they are arcs of great circles.
A great circle is any circle obtained by intersecting the sphere with a plane that passes through the sphere’s
center (examples include the equator and any meridian). Because these circles have the same radius as the sphere,
their arcs represent the minimum travel distance along the surface between two points.
Locations on a sphere are usually given by latitude \(\varphi\) and longitude
\(\lambda\). Latitude measures angle north/south of the equator (\(-90^\circ\) to \(90^\circ\)); longitude measures
angle around the equator (often \(-180^\circ\) to \(180^\circ\), but any wrapped angle is equivalent). To compute a
great-circle distance, you first compute the central angle \(\theta\) between the two radius vectors
from the sphere’s center to the surface points. Once \(\theta\) is known, the surface distance is
\[
d = r\,\theta,
\]
where \(r\) is the sphere’s radius and \(\theta\) is in radians. This is exactly the same arc-length rule used on a
circle: arc length equals radius times angle.
One standard way to find \(\theta\) is the spherical law of cosines:
\[
\cos\theta=\sin\varphi_1\sin\varphi_2+\cos\varphi_1\cos\varphi_2\cos(\Delta\lambda),
\]
where \(\Delta\lambda=\lambda_2-\lambda_1\). Then \(\theta=\arccos(\cos\theta)\). This formula is compact and works well,
but it can lose numerical precision when the points are extremely close, because \(\theta\) is then very small and
\(\cos\theta\) is extremely close to 1.
For improved stability, many calculators use the haversine form:
\[
a=\sin^2\!\left(\frac{\Delta\varphi}{2}\right)+\cos\varphi_1\cos\varphi_2\sin^2\!\left(\frac{\Delta\lambda}{2}\right),
\qquad \theta=2\arcsin(\sqrt{a}).
\]
The haversine avoids subtracting nearly equal numbers and tends to behave better for short distances. Both methods
produce the same \(\theta\) in exact arithmetic; the difference is mainly numerical robustness.
The visualization helps interpret these formulas: the globe shows the sphere’s boundary as a circle using an
orthographic projection, like viewing a physical globe from far away. The great-circle route is drawn
as the projected arc. Dragging rotates the view so you can keep the route visible without the drawing drifting out of
frame. Remember that Earth is not a perfect sphere (it is slightly oblate), but the spherical model is often accurate
enough for education, navigation estimates, and understanding why flight routes curve on flat maps.