## FITS formalism

The AIPS Memos 271 and 462 introduced a number of projections and the equations to convert between the 2D projection plane coordinates and 3D spherical celestial coordinates. The Calabretta & Greisen 2002 paper3 (hereafter CG02) extended the AIPS conventions and introduced a fully generic formalism to describe many kind of projections in the FITS file headers. Given the parameters reproduced in the table 1, the CG02 general idea, as described in their section 2, going from the projected plane to the celestial sphere consists in 3 major steps:

Definition:
  the 2D projected plane is defined as a regular coordinate system with a reference point located at by design. Its extents might be finite or infinite depending on the projection kind.
Unprojection:
  one converts from the projected coordinates to the unprojected native spherical coordinate: are converted to . Unprojection obviously depends on the projection kind and parameters. The native sphere is defined such as the reference point transforms to the sphere fiducial point . This point is typically either on the Equator (coordinates for e.g. cylindrical projections) or located on a pole (coordinates for e.g. zenithal projections); this is an intrinsic property of the projection kind.
Euler rotation:
  then one rotates the native coordinates to celestial coordinates by an Euler rotation of the native sphere. The Euler angles are defined thanks to matching , plus a possible inclination angle.

Table 1: CG02 coordinate definitions (from their Table 1).
| Projection plane coordinates
| Native longitude and latitude
| Celestial longitude and latitude
| Projection plane coordinates of the fiducial point
| Native longitude and latitude of the fiducial point
| Celestial longitude and latitude of the fiducial point (CRVALia)
| Native longitude and latitude of the celestial pole (LONPOLEa)
| Celestial longitude and latitude of the native pole

Figure 1: Visual representation of the CG02 formalism. In all the plots, the grey region and the star marker are at the same position on sky. Top left: the grey region symbolizes a square degrees in the 2D projected plane. Blue lines show the abscissa and ordinate origins. For simplicity the region is centered on the reference point, but it could be anywhere allowed in the plane. Top right: the same area is unprojected to spherical coordinates on the 3D native sphere (the unprojection kind chosen for this example is not detailed here). The equator and zero reference meridian are shown in green. In this example, the fiducial point has coordinates . Bottom left: the whole sky orientation is kept the same as before, but the coordinate system represented is now the 3D celestial sphere, with arbitrary reference point and inclination angle for the example. The equator and zero reference meridian are shown in red. Bottom right: Same as previous plot but the celestial sphere is rotated and displayed with its origin of coordinates in front. In this process, the coordinates have to be Euler-rotated from to to be expressed in this new system.

The Figure 1 offers a visual representation of these transformations. The opposite conversion (from absolute celestial coordinates to projected plane offsets) is done by reverting these operations.