Documentation / @interstellar-tools/maps / inverseOrthographic
Function: inverseOrthographic()
ts
function inverseOrthographic(
x: number,
y: number,
R: number,
options?: AzimuthalOptionsInterface
): GeographicCoordinatesInterface;Defined in: projections/orthographic.ts:118
Find the point on a sphere for a point on an orthographic map: the inverse of orthographic.
Units
- Inputs:
x,yandRin m,phi0andlambda0in radians. - Output:
{ phi, lambda }in radians, within (−π, π].
Notes
- Only points within
of the centre, on the globe's disc, have an inverse: a point beyond it throws a RangeError. The answer is always on the near hemisphere. - Near the edge of the disc, where the globe is seen edge-on, a small step on the map is a long way on the sphere, so the inverse loses precision there.
and are found with atan2, which keeps full precision near the poles, and the arctangent takes the quadrant into account. At a pole, anyis the same point.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | Distance east of the centre in m (finite, on the map). |
y | number | Distance north of the centre in m (finite, on the map). |
R | number | Radius |
options? | AzimuthalOptionsInterface | phi0 and lambda0, the map's centre (radians, both default to 0). |
Returns
GeographicCoordinatesInterface
The point on the sphere, { phi, lambda } in radians.
Throws
- If any input is not a finite number.
- If the point is more than
from the centre, phi0is outside [−π/2, π/2], orR <= 0.
Example
ts
inverseOrthographic(2_542_125, 1_694_750, 3_389_500);
// ≈ { phi: 30° N, lambda: 60° E }, in radiansSee
- orthographic
- https://doi.org/10.3133/pp1395 Snyder (1987), Map projections: a working manual, ch. 20