## Introduction

Today, I’d like to share a few geometric formulae I’ve found useful in worldbuilding. There are formulae here for determining the distance between two points with known latitudes and longitudes, the inverse function(latitude and longitude of a destination given a known origin location and a direction and distance. The area of polygons on a sphere and the distance to the horizon for a planet of a given radius given a viewpoint height, and the area of a circle of given radius on a sphere.

## Great Circle Distance Between Two Points on a Sphere

If you know the latitude and longitude of two points on a sphere, you can figure out the arc distance in radians between those points with just a little trigonometry. Point A is at latitude, , longitude, . Point B is at latitude, , longitude, . The difference of longitude is, P =  .

Once, you know the distance, you can readily calculate the initial bearing from point A to point B. Bearing, . You can figure out the final bearing by interchanging b and a. This will prove useful in determining the area of spherical polygons. Keep it in mind.

## Destination Given Distance and Bearing from Origin Point

Given a known point at  , a planet’s radius, R, a bearing, θ, and a distance, d, how do we find the new point  ? Note, since Mathematica’s implementation of the atan2(y,x) function is apparently functionally identical to its atan(y/x) function, and its the same function name overloaded with inverted input order(ArcTan[x,y] == Arctan[y/x]), I decided to just go with the y/x form. In a Java or Python or, apparently, JS program, you’d use atan2(num, denom), instead. For further information, check this page out.

## Area of Spherical Polygons

The formula for the area of a spherical triangle is pretty simple looking. Just, . A, B and C are the three inner angles of the triangle, R is the radius of the sphere and S is the surface area of the triangle. For each vertex, use the Great Circle formulas above to determine the distance and bearing to both neighboring vertices. The inner vertex angle is equal to the distance between the bearings to the two neighboring vertices.

The same principle is used to find the area of more complicated polygons. In the general polygon case, though, it’s important to keep track of convex and concave angles. It might be necessary to make diagrams to keep track of which angles are internal. , where σ is the sum of angles in radians, and n is the number of sides.

Distance to the Horizon

As shown in figure 1, point, P, is our central point of interest, point, H, is the point on the horizon of view from P, point, A, is the point on the surface directly beneath P, angle, θ, is the angle subtended, at the center of the sphere, between points P and H. As before, R is the radius of the sphere.

D, the direct distance between points P and H, is also known as the slant distance. The formula for slant distance is , where h is the distance of the viewing point above the ground(length PA).

The distance along the arc AH is , with θ in radians. Thus, the arc distance, which I call the map distance, since it would be the distance measured on a map, would be .

The area of a planet observable from a point at height, h, is, .

The fraction of a planet observable from that height would be, .

For reference , which is the formula for the total surface area of the planet.

## Area of a Circle on the Surface of a Sphere

My next formula will be for the surface area of the circular region within a distance, d, of a point, P, on the surface of a sphere of radius, R, as shown in figure 2. From page 128 of the CRC Standard Mathematical Tables, 26th edition(similar information, with 3d figures, here), I find under spherical figures that the zone and segment of one base has a surface area of . Incidentally, the volume of this portion of the sphere is, , not that we’re using that here. The arc distance from P to the edge of the area is . An examination of the geometry leads us to the conclusion that , so the area of the spherical surface within angular distance θ of the center is, .