Computing The Ideal Straight LineofSight Distance to a Point On a Spherical Horizon From Any General Distance Above the Surface and the Corresponding Surface Distance to the Same Point Assuming the mean radius ( R ) and distance (d ) above the surface, measured in the same units, the ideal straight lineofsight distance (H ) to the lunar horizon may be found by:
For the moon, with ( d, R, H ) expressed in miles (R = 1079.4 mi):
miles For example, if we were ( d=852 ) miles above the lunar surface, the lineofsight distance to the lunar horizon would work out to about 1601.6 miles. So ideally, we could theoretically see some lunar features about 1602 miles or so from the eye from an altitude of 852 miles above the surface. Some very highaltitude lunar features would be visible at even greater distance, since they would extend above the ideal mean horizon.
For ( d, R, H ) expressed in kilometers (R = 1737.1 km):
kilometers The following PHP function performs the above computation and returns the value of (H) for any given distance from the surface of a sphere of any given radius. In this case we are applying it to the moon. /* This function computes the straight lineofsight distance (H) from the eye to the spherical horizon. $SurfDist = Distance from surface of sphere $radius = Radius of sphere Distance and radius can be in any consistent units and the result will also be in the same units (eg. km, mi, etc.) */ function Horizon_Distance_H ($SurfDist, $radius) { return sqrt($SurfDist*$SurfDist + 2*$radius*$SurfDist); } Surface Distance (S) to Horizon Point, Corresponding to Distance (H) Assuming angles are in radians and the given the mean lunar radius ( R ) and distance (d ) above the surface, measured in the same units, the ideal curved surface distance (S ) to the spherical horizon, corresponding to the linear distance (H ) to the same point (P ), may be found by:
For ( d, R, S ) expressed in miles (R = 1079.4 mi):
miles For ( d, R, S ) expressed in kilometers (R = 1737.1 km):
kilometers The following PHP function computes and returns the surface distance (S) corresponding to lineofsight distance (H) for any given distance from the surface of a sphere of any given radius. /* This function computes the ideal surface distance (S) from the eye to the spherical horizon. $SurfDist = Distance from surface of sphere $radius = Radius of sphere Distance and radius can be in any consistent units and the result will also be in the same units (eg. km, mi, etc.) */ function Horizon_Distance_S ($SurfDist, $radius) { $H = sqrt($SurfDist*$SurfDist + 2*$radius*$SurfDist); return $radius*(M_PI/2  acos($H / ($radius+$SurfDist))); } © Jay Tanner  2017
