Documentation / @interstellar-tools/equations / horizonSurfaceDistance
Function: horizonSurfaceDistance()
ts
function horizonSurfaceDistance(h: number, R: number): number;Defined in: cartography/horizon-surface-distance.ts:42
Compute the distance along the surface to the horizon for an observer at a height above a sphere.
Where:
is the sphere's radius (m) is the observer's height above the surface (m)
Units
- Inputs:
handRin m. - Output:
in m, along the surface from the point below the observer to the horizon.
Notes
- Computed with
atan2, which stays accurate for small heights whereof a number close to 1 loses most of its digits. - Slightly shorter than the line of sight horizonDistance; the two agree for
and part ways from orbit. is the central angle from the observer to the horizon: the radius of what a satellite can see, as an angle.
Parameters
| Parameter | Type | Description |
|---|---|---|
h | number | Height |
R | number | Radius |
Returns
number
The distance along the surface to the horizon
Throws
- If any input is not a finite number.
- If
h < 0orR <= 0.
Example
ts
// The ISS, 420 km above a 6 371 km Earth
horizonSurfaceDistance(420_000, 6_371_000); // ≈ 2 252 km, against 2 351 km in a straight line