Ok. So maybe this is not quite strictly and astronomical calculation, but the calculation is valid for any spherical object, so is equally applicable for finding the distance to the horizon on Earth, as it is on the Moon, or Mars, so have decided to include it with my astronomical calculations.

The distance to the horizon is dependent on the height above the surface of the sphere, which, in most cases which we care about would be the surface of the Earth.

So, given a height, h, in metres, and a radius, r (which for the Earth is 6371km), we can use the following formula to find the distance (in km) to the horizon:

D = √(2 * r) * √(h / 1000).

The inverse of this can be used to find the height required to see a horizon of particular distance.

	public class UraniaHorizon
	{

		public static double fEarthRadius = 6371.0;
		
		public static double HorizonDistance(double pdHeight, double pdRadius)
		{
			if (pdRadius == 0)
			{
				pdRadius = UraniaHorizon.fEarthRadius;
			}
			return System.Math.Sqrt(pdRadius * 2.0) * System.Math.Sqrt(pdHeight / 1000.0);
		}
		
		public static double HorizonHeight(double pdDistance, double pdRadius)
		{
			if (pdRadius == 0)
			{
				pdRadius = UraniaHorizon.fEarthRadius;
			}
			return ((pdDistance / System.Math.Sqrt(pdRadius * 2.0)) *(pdDistance / 112.88)) * 1000.0;
		}
	}

Share