From projection plane to celestial coordinates
The reverse operation first computes the polar coordinates in the
projection plane, and the angular distance by inverting
Eq.
:
Then the spherical trigonometry relations Eqs.
to
are inverted. Eqs.
and
form a linear system in
and
:
Multiplying the first equation by
and the second one by
and adding them gives
, while multiplying
the first one by
and the second one by
and subtracting them gives
(using
). Eq.
gives
directly:
The declination is in the range
, i.e.
. As a consequence,
is obtained from its
sine with the
function, whose range is precisely
, and the non-negative factor
common to
the 2 last relations does not change the quadrant of
returned by the
atan2 function (same argument as for
and
in section
):
The right ascension is undefined at the celestial poles (
), where both arguments of the
atan2 function vanish.
These formulae, in both directions, are valid for any reference point,
including
and
: no case distinction
is needed.