WCSLIB 5.17

Data Structures | Macros | Enumerations | Functions | Variables
prj.h File Reference

Go to the source code of this file.

## Data Structures
struct | prjprm
| Projection parameters. More...

## Macros
#define | PVN 30
| Total number of projection parameters. More...
#define | PRJX2S_ARGS
| For use in declaring deprojection function prototypes. More...
#define | PRJS2X_ARGS
| For use in declaring projection function prototypes. More...
#define | PRJLEN (sizeof(struct prjprm)/sizeof(int))
| Size of the prjprm struct in int units. More...
#define | prjini_errmsg prj_errmsg
| Deprecated. More...
#define | prjprt_errmsg prj_errmsg
| Deprecated. More...
#define | prjset_errmsg prj_errmsg
| Deprecated. More...
#define | prjx2s_errmsg prj_errmsg
| Deprecated. More...
#define | prjs2x_errmsg prj_errmsg
| Deprecated. More...

## Enumerations
enum | prj_errmsg_enum { PRJERR_SUCCESS = 0, PRJERR_NULL_POINTER = 1, PRJERR_BAD_PARAM = 2, PRJERR_BAD_PIX = 3, PRJERR_BAD_WORLD = 4 }

## Functions
int | prjini (struct prjprm *prj)
| Default constructor for the prjprm struct. More...
int | prjfree (struct prjprm *prj)
| Destructor for the prjprm struct. More...
int | prjprt (const struct prjprm *prj)
| Print routine for the prjprm struct. More...
int | prjperr (const struct prjprm *prj, const char *prefix)
| Print error messages from a prjprm struct. More...
int | prjbchk (double tol, int nx, int ny, int spt, double phi[], double theta[], int stat[])
| Bounds checking on native coordinates. More...
int | prjset (struct prjprm *prj)
| Generic setup routine for the prjprm struct. More...
int | prjx2s (PRJX2S_ARGS)
| Generic Cartesian-to-spherical deprojection. More...
int | prjs2x (PRJS2X_ARGS)
| Generic spherical-to-Cartesian projection. More...
int | azpset (struct prjprm *prj)
| Set up a prjprm struct for the zenithal/azimuthal perspective (`AZP`) projection. More...
int | azpx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the zenithal/azimuthal perspective (`AZP`) projection. More...
int | azps2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the zenithal/azimuthal perspective (`AZP`) projection. More...
int | szpset (struct prjprm *prj)
| Set up a prjprm struct for the slant zenithal perspective (`SZP`) projection. More...
int | szpx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the slant zenithal perspective (`SZP`) projection. More...
int | szps2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the slant zenithal perspective (`SZP`) projection. More...
int | tanset (struct prjprm *prj)
| Set up a prjprm struct for the gnomonic (`TAN`) projection. More...
int | tanx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the gnomonic (`TAN`) projection. More...
int | tans2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the gnomonic (`TAN`) projection. More...
int | stgset (struct prjprm *prj)
| Set up a prjprm struct for the stereographic (`STG`) projection. More...
int | stgx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the stereographic (`STG`) projection. More...
int | stgs2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the stereographic (`STG`) projection. More...
int | sinset (struct prjprm *prj)
| Set up a prjprm struct for the orthographic/synthesis (`SIN`) projection. More...
int | sinx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the orthographic/synthesis (`SIN`) projection. More...
int | sins2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the orthographic/synthesis (`SIN`) projection. More...
int | arcset (struct prjprm *prj)
| Set up a prjprm struct for the zenithal/azimuthal equidistant (`ARC`) projection. More...
int | arcx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the zenithal/azimuthal equidistant (`ARC`) projection. More...
int | arcs2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the zenithal/azimuthal equidistant (`ARC`) projection. More...
int | zpnset (struct prjprm *prj)
| Set up a prjprm struct for the zenithal/azimuthal polynomial (`ZPN`) projection. More...
int | zpnx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the zenithal/azimuthal polynomial (`ZPN`) projection. More...
int | zpns2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the zenithal/azimuthal polynomial (`ZPN`) projection. More...
int | zeaset (struct prjprm *prj)
| Set up a prjprm struct for the zenithal/azimuthal equal area (`ZEA`) projection. More...
int | zeax2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the zenithal/azimuthal equal area (`ZEA`) projection. More...
int | zeas2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the zenithal/azimuthal equal area (`ZEA`) projection. More...
int | airset (struct prjprm *prj)
| Set up a prjprm struct for Airy's (`AIR`) projection. More...
int | airx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for Airy's (`AIR`) projection. More...
int | airs2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for Airy's (`AIR`) projection. More...
int | cypset (struct prjprm *prj)
| Set up a prjprm struct for the cylindrical perspective (`CYP`) projection. More...
int | cypx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the cylindrical perspective (`CYP`) projection. More...
int | cyps2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the cylindrical perspective (`CYP`) projection. More...
int | ceaset (struct prjprm *prj)
| Set up a prjprm struct for the cylindrical equal area (`CEA`) projection. More...
int | ceax2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the cylindrical equal area (`CEA`) projection. More...
int | ceas2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the cylindrical equal area (`CEA`) projection. More...
int | carset (struct prjprm *prj)
| Set up a prjprm struct for the plate carrée (`CAR`) projection. More...
int | carx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the plate carrée (`CAR`) projection. More...
int | cars2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the plate carrée (`CAR`) projection. More...
int | merset (struct prjprm *prj)
| Set up a prjprm struct for Mercator's (`MER`) projection. More...
int | merx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for Mercator's (`MER`) projection. More...
int | mers2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for Mercator's (`MER`) projection. More...
int | sflset (struct prjprm *prj)
| Set up a prjprm struct for the Sanson-Flamsteed (`SFL`) projection. More...
int | sflx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the Sanson-Flamsteed (`SFL`) projection. More...
int | sfls2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the Sanson-Flamsteed (`SFL`) projection. More...
int | parset (struct prjprm *prj)
| Set up a prjprm struct for the parabolic (`PAR`) projection. More...
int | parx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the parabolic (`PAR`) projection. More...
int | pars2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the parabolic (`PAR`) projection. More...
int | molset (struct prjprm *prj)
| Set up a prjprm struct for Mollweide's (`MOL`) projection. More...
int | molx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for Mollweide's (`MOL`) projection. More...
int | mols2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for Mollweide's (`MOL`) projection. More...
int | aitset (struct prjprm *prj)
| Set up a prjprm struct for the Hammer-Aitoff (`AIT`) projection. More...
int | aitx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the Hammer-Aitoff (`AIT`) projection. More...
int | aits2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the Hammer-Aitoff (`AIT`) projection. More...
int | copset (struct prjprm *prj)
| Set up a prjprm struct for the conic perspective (`COP`) projection. More...
int | copx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the conic perspective (`COP`) projection. More...
int | cops2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the conic perspective (`COP`) projection. More...
int | coeset (struct prjprm *prj)
| Set up a prjprm struct for the conic equal area (`COE`) projection. More...
int | coex2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the conic equal area (`COE`) projection. More...
int | coes2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the conic equal area (`COE`) projection. More...
int | codset (struct prjprm *prj)
| Set up a prjprm struct for the conic equidistant (`COD`) projection. More...
int | codx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the conic equidistant (`COD`) projection. More...
int | cods2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the conic equidistant (`COD`) projection. More...
int | cooset (struct prjprm *prj)
| Set up a prjprm struct for the conic orthomorphic (`COO`) projection. More...
int | coox2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the conic orthomorphic (`COO`) projection. More...
int | coos2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the conic orthomorphic (`COO`) projection. More...
int | bonset (struct prjprm *prj)
| Set up a prjprm struct for Bonne's (`BON`) projection. More...
int | bonx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for Bonne's (`BON`) projection. More...
int | bons2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for Bonne's (`BON`) projection. More...
int | pcoset (struct prjprm *prj)
| Set up a prjprm struct for the polyconic (`PCO`) projection. More...
int | pcox2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the polyconic (`PCO`) projection. More...
int | pcos2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the polyconic (`PCO`) projection. More...
int | tscset (struct prjprm *prj)
| Set up a prjprm struct for the tangential spherical cube (`TSC`) projection. More...
int | tscx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the tangential spherical cube (`TSC`) projection. More...
int | tscs2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the tangential spherical cube (`TSC`) projection. More...
int | cscset (struct prjprm *prj)
| Set up a prjprm struct for the COBE spherical cube (`CSC`) projection. More...
int | cscx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the COBE spherical cube (`CSC`) projection. More...
int | cscs2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the COBE spherical cube (`CSC`) projection. More...
int | qscset (struct prjprm *prj)
| Set up a prjprm struct for the quadrilateralized spherical cube (`QSC`) projection. More...
int | qscx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the quadrilateralized spherical cube (`QSC`) projection. More...
int | qscs2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the quadrilateralized spherical cube (`QSC`) projection. More...
int | hpxset (struct prjprm *prj)
| Set up a prjprm struct for the HEALPix (`HPX`) projection. More...
int | hpxx2s (PRJX2S_ARGS)
| Cartesian-to-spherical transformation for the HEALPix (`HPX`) projection. More...
int | hpxs2x (PRJS2X_ARGS)
| Spherical-to-Cartesian transformation for the HEALPix (`HPX`) projection. More...
int | xphset (struct prjprm *prj)
int | xphx2s (PRJX2S_ARGS)
int | xphs2x (PRJS2X_ARGS)

## Variables
const char * | prj_errmsg []
| Status return messages. More...
const int | CONIC
| Identifier for conic projections. More...
const int | CONVENTIONAL
| Identifier for conventional projections. More...
const int | CYLINDRICAL
| Identifier for cylindrical projections. More...
const int | POLYCONIC
| Identifier for polyconic projections. More...
const int | PSEUDOCYLINDRICAL
| Identifier for pseudocylindrical projections. More...
const int | QUADCUBE
| Identifier for quadcube projections. More...
const int | ZENITHAL
| Identifier for zenithal/azimuthal projections. More...
const int | HEALPIX
| Identifier for the HEALPix projection. More...
const char | prj_categories [9][32]
| Projection categories. More...
const int | prj_ncode
| The number of recognized three-letter projection codes. More...
const char | prj_codes [28][4]
| Recognized three-letter projection codes. More...

## Detailed Description

Routines in this suite implement the spherical map projections defined by the FITS World Coordinate System (WCS) standard, as described in

"Representations of world coordinates in FITS",
Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)
"Representations of celestial coordinates in FITS",
Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)
"Mapping on the HEALPix grid",
Calabretta, M.R., & Roukema, B.F. 2007, MNRAS, 381, 865 (WCS Paper V)
"Representing the 'Butterfly' Projection in FITS -- Projection Code XPH",
Calabretta, M.R., & Lowe, S.R. 2013, PASA, 30, e050 (WCS Paper VI)

These routines are based on the prjprm struct which contains all information needed for the computations. The struct contains some members that must be set by the user, and others that are maintained by these routines, somewhat like a C++ class but with no encapsulation.

Routine prjini() is provided to initialize the prjprm struct with default values, prjfree() reclaims any memory that may have been allocated to store an error message, and prjprt() prints its contents.

prjperr() prints the error message(s) (if any) stored in a prjprm struct. prjbchk() performs bounds checking on native spherical coordinates.

Setup routines for each projection with names of the form ???set(), where "???" is the down-cased three-letter projection code, compute intermediate values in the prjprm struct from parameters in it that were supplied by the user. The struct always needs to be set by the projection's setup routine but that need not be called explicitly - refer to the explanation of prjprm::flag.

Each map projection is implemented via separate functions for the spherical projection, ???s2x(), and deprojection, ???x2s().

A set of driver routines, prjset(), prjx2s(), and prjs2x(), provides a generic interface to the specific projection routines which they invoke via pointers-to-functions stored in the prjprm struct.

In summary, the routines are:

- prjini() Initialization routine for the prjprm struct.
- prjfree() Reclaim memory allocated for error messages.
- prjprt() Print the prjprm struct.
- prjperr() Print error message (if any).

- prjbchk() Bounds checking on native coordinates.

- prjset(), prjx2s(), prjs2x(): Generic driver routines

- azpset(), azpx2s(), azps2x(): `AZP` (zenithal/azimuthal perspective)
- szpset(), szpx2s(), szps2x(): `SZP` (slant zenithal perspective)
- tanset(), tanx2s(), tans2x(): `TAN` (gnomonic)
- stgset(), stgx2s(), stgs2x(): `STG` (stereographic)
- sinset(), sinx2s(), sins2x(): `SIN` (orthographic/synthesis)
- arcset(), arcx2s(), arcs2x(): `ARC` (zenithal/azimuthal equidistant)
- zpnset(), zpnx2s(), zpns2x(): `ZPN` (zenithal/azimuthal polynomial)
- zeaset(), zeax2s(), zeas2x(): `ZEA` (zenithal/azimuthal equal area)
- airset(), airx2s(), airs2x(): `AIR` (Airy)
- cypset(), cypx2s(), cyps2x(): `CYP` (cylindrical perspective)
- ceaset(), ceax2s(), ceas2x(): `CEA` (cylindrical equal area)
- carset(), carx2s(), cars2x(): `CAR` (Plate carée)
- merset(), merx2s(), mers2x(): `MER` (Mercator)
- sflset(), sflx2s(), sfls2x(): `SFL` (Sanson-Flamsteed)
- parset(), parx2s(), pars2x(): `PAR` (parabolic)
- molset(), molx2s(), mols2x(): `MOL` (Mollweide)
- aitset(), aitx2s(), aits2x(): `AIT` (Hammer-Aitoff)
- copset(), copx2s(), cops2x(): `COP` (conic perspective)
- coeset(), coex2s(), coes2x(): `COE` (conic equal area)
- codset(), codx2s(), cods2x(): `COD` (conic equidistant)
- cooset(), coox2s(), coos2x(): `COO` (conic orthomorphic)
- bonset(), bonx2s(), bons2x(): `BON` (Bonne)
- pcoset(), pcox2s(), pcos2x(): `PCO` (polyconic)
- tscset(), tscx2s(), tscs2x(): `TSC` (tangential spherical cube)
- cscset(), cscx2s(), cscs2x(): `CSC` (COBE spherical cube)
- qscset(), qscx2s(), qscs2x(): `QSC` (quadrilateralized spherical cube)
- hpxset(), hpxx2s(), hpxs2x(): `HPX` (HEALPix)
- xphset(), xphx2s(), xphs2x(): XPH (HEALPix polar, aka "butterfly")

Argument checking (projection routines):
The values of and (the native longitude and latitude) normally lie in the range for , and for . However, all projection routines will accept any value of and will not normalize it.

The projection routines do not explicitly check that lies within the range . They do check for any value of that produces an invalid argument to the projection equations (e.g. leading to division by zero). The projection routines for `AZP`, `SZP`, `TAN`, `SIN`, `ZPN`, and `COP` also return error 2 if corresponds to the overlapped (far) side of the projection but also return the corresponding value of . This strict bounds checking may be relaxed at any time by setting prjprm::bounds%2 to 0 (rather than 1); the projections need not be reinitialized.

Argument checking (deprojection routines):
Error checking on the projected coordinates is limited to that required to ascertain whether a solution exists. Where a solution does exist, an optional check is made that the value of and obtained lie within the ranges for , and for . This check, performed by prjbchk(), is enabled by default. It may be disabled by setting prjprm::bounds%4 to 0 (rather than 1); the projections need not be reinitialized.

Accuracy:
No warranty is given for the accuracy of these routines (refer to the copyright notice); intending users must satisfy for themselves their adequacy for the intended purpose. However, closure to a precision of at least of longitude and latitude has been verified for typical projection parameters on the degree graticule of native longitude and latitude (to within of any latitude where the projection may diverge). Refer to the tprj1.c and tprj2.c test routines that accompany this software.

## Macro Definition Documentation

## ◆ PVN

#define PVN 30

The total number of projection parameters numbered 0 to PVN-1.

## ◆ PRJX2S_ARGS

#define PRJX2S_ARGS

Value:
struct prjprm *prj, int nx, int ny, int sxy, int spt, \
const double x[], const double y[], double phi[], double theta[], int stat[]
prjprm
Projection parameters.
Definition: prj.h:667

Preprocessor macro used for declaring deprojection function prototypes.

## ◆ PRJS2X_ARGS

#define PRJS2X_ARGS

Value:
struct prjprm *prj, int nx, int ny, int sxy, int spt, \
const double phi[], const double theta[], double x[], double y[], int stat[]
prjprm
Projection parameters.
Definition: prj.h:667

Preprocessor macro used for declaring projection function prototypes.

## ◆ PRJLEN

#define PRJLEN (sizeof(struct prjprm)/sizeof(int))

Size of the prjprm struct in int units, used by the Fortran wrappers.

## ◆ prjini_errmsg

#define prjini_errmsg prj_errmsg

Deprecated:
  Added for backwards compatibility, use prj_errmsg directly now instead.

## ◆ prjprt_errmsg

#define prjprt_errmsg prj_errmsg

Deprecated:
  Added for backwards compatibility, use prj_errmsg directly now instead.

## ◆ prjset_errmsg

#define prjset_errmsg prj_errmsg

Deprecated:
  Added for backwards compatibility, use prj_errmsg directly now instead.

## ◆ prjx2s_errmsg

#define prjx2s_errmsg prj_errmsg

Deprecated:
  Added for backwards compatibility, use prj_errmsg directly now instead.

## ◆ prjs2x_errmsg

#define prjs2x_errmsg prj_errmsg

Deprecated:
  Added for backwards compatibility, use prj_errmsg directly now instead.

## Enumeration Type Documentation

## ◆ prj_errmsg_enum

enum prj_errmsg_enum

Enumerator
PRJERR_SUCCESS |
PRJERR_NULL_POINTER |
PRJERR_BAD_PARAM |
PRJERR_BAD_PIX |
PRJERR_BAD_WORLD |

## Function Documentation

## ◆ prjini()

int prjini | ( | struct prjprm * | prj | ) |

prjini() sets all members of a prjprm struct to default values. It should be used to initialize every prjprm struct.

Parameters

  [out] | prj | Projection parameters.

Returns
  Status return value:
  - 0: Success.
  - 1: Null prjprm pointer passed.

## ◆ prjfree()

int prjfree | ( | struct prjprm * | prj | ) |

prjfree() frees any memory that may have been allocated to store an error message in the prjprm struct.

Parameters

  [in] | prj | Projection parameters.

Returns
  Status return value:
  - 0: Success.
  - 1: Null prjprm pointer passed.

## ◆ prjprt()

int prjprt | ( | const struct prjprm * | prj | ) |

prjprt() prints the contents of a prjprm struct using wcsprintf(). Mainly intended for diagnostic purposes.

Parameters

  [in] | prj | Projection parameters.

Returns
  Status return value:
  - 0: Success.
  - 1: Null prjprm pointer passed.

## ◆ prjperr()

int prjperr | ( | const struct prjprm * | prj,
|  | const char * | prefix
| ) |  |

prjperr() prints the error message(s) (if any) stored in a prjprm struct. If there are no errors then nothing is printed. It uses wcserr_prt(), q.v.

Parameters

  [in] | prj | Projection parameters.
  [in] | prefix | If non-NULL, each output line will be prefixed with this string.

Returns
  Status return value:
  - 0: Success.
  - 1: Null prjprm pointer passed.

## ◆ prjbchk()

int prjbchk | ( | double | tol,
|  | int | nx,
|  | int | ny,
|  | int | spt,
|  | double | phi[],
|  | double | theta[],
|  | int | stat[]
| ) |  |

prjbchk() performs bounds checking on native spherical coordinates. As returned by the deprojection (x2s) routines, native longitude is expected to lie in the closed interval , with latitude in .

A tolerance may be specified to provide a small allowance for numerical imprecision. Values that lie outside the allowed range by not more than the specified tolerance will be adjusted back into range.

If prjprm::bounds&4 is set, as it is by prjini(), then prjbchk() will be invoked automatically by the Cartesian-to-spherical deprojection (x2s) routines with an appropriate tolerance set for each projection.

Parameters

  [in] | tol | Tolerance for the bounds check [deg].
  [in] | nphi,ntheta | Vector lengths.
  [in] | spt | Vector stride.
  [in,out] | phi,theta | Native longitude and latitude [deg].
  [out] | stat | Status value for each vector element: 0: Valid value of . 1: Invalid value.

Returns
  Status return value:
  - 0: Success.
  - 1: One or more of the coordinates were, invalid, as indicated by the stat vector.

## ◆ prjset()

int prjset | ( | struct prjprm * | prj | ) |

prjset() sets up a prjprm struct according to information supplied within it.

Note that this routine need not be called directly; it will be invoked by prjx2s() and prjs2x() if prj.flag is anything other than a predefined magic value.

The one important distinction between prjset() and the setup routines for the specific projections is that the projection code must be defined in the prjprm struct in order for prjset() to identify the required projection. Once prjset() has initialized the prjprm struct, prjx2s() and prjs2x() use the pointers to the specific projection and deprojection routines contained therein.

Parameters

  [in,out] | prj | Projection parameters.

Returns
  Status return value:
  - 0: Success.
  - 1: Null prjprm pointer passed.
  - 2: Invalid projection parameters.
  For returns > 1, a detailed error message is set in prjprm::err if enabled, see wcserr_enable().

## ◆ prjx2s()

int prjx2s | ( | PRJX2S_ARGS |  | ) |

Deproject Cartesian coordinates in the plane of projection to native spherical coordinates .

The projection is that specified by prjprm::code.

Parameters

  [in,out] | prj | Projection parameters.
  [in] | nx,ny | Vector lengths.
  [in] | sxy,spt | Vector strides.
  [in] | x,y | Projected coordinates.
  [out] | phi,theta | Longitude and latitude of the projected point in native spherical coordinates [deg].
  [out] | stat | Status value for each vector element: 0: Success. 1: Invalid value of .

Returns
  Status return value:
  - 0: Success.
  - 1: Null prjprm pointer passed.
  - 2: Invalid projection parameters.
  - 3: One or more of the coordinates were invalid, as indicated by the stat vector.
  For returns > 1, a detailed error message is set in prjprm::err if enabled, see wcserr_enable().

## ◆ prjs2x()

int prjs2x | ( | PRJS2X_ARGS |  | ) |

Project native spherical coordinates to Cartesian coordinates in the plane of projection.

The projection is that specified by prjprm::code.

Parameters

  [in,out] | prj | Projection parameters.
  [in] | nphi,ntheta | Vector lengths.
  [in] | spt,sxy | Vector strides.
  [in] | phi,theta | Longitude and latitude of the projected point in native spherical coordinates [deg].
  [out] | x,y | Projected coordinates.
  [out] | stat | Status value for each vector element: 0: Success. 1: Invalid value of .

Returns
  Status return value:
  - 0: Success.
  - 1: Null prjprm pointer passed.
  - 2: Invalid projection parameters.
  - 4: One or more of the coordinates were, invalid, as indicated by the stat vector.
  For returns > 1, a detailed error message is set in prjprm::err if enabled, see wcserr_enable().

## ◆ azpset()

int azpset | ( | struct prjprm * | prj | ) |

azpset() sets up a prjprm struct for a zenithal/azimuthal perspective (`AZP`) projection.

See prjset() for a description of the API.

## ◆ azpx2s()

int azpx2s | ( | PRJX2S_ARGS |  | ) |

azpx2s() deprojects Cartesian coordinates in the plane of a zenithal/azimuthal perspective (`AZP`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ azps2x()

int azps2x | ( | PRJS2X_ARGS |  | ) |

azps2x() projects native spherical coordinates to Cartesian coordinates in the plane of a zenithal/azimuthal perspective (`AZP`) projection.

See prjs2x() for a description of the API.

## ◆ szpset()

int szpset | ( | struct prjprm * | prj | ) |

szpset() sets up a prjprm struct for a slant zenithal perspective (`SZP`) projection.

See prjset() for a description of the API.

## ◆ szpx2s()

int szpx2s | ( | PRJX2S_ARGS |  | ) |

szpx2s() deprojects Cartesian coordinates in the plane of a slant zenithal perspective (`SZP`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ szps2x()

int szps2x | ( | PRJS2X_ARGS |  | ) |

szps2x() projects native spherical coordinates to Cartesian coordinates in the plane of a slant zenithal perspective (`SZP`) projection.

See prjs2x() for a description of the API.

## ◆ tanset()

int tanset | ( | struct prjprm * | prj | ) |

tanset() sets up a prjprm struct for a gnomonic (`TAN`) projection.

See prjset() for a description of the API.

## ◆ tanx2s()

int tanx2s | ( | PRJX2S_ARGS |  | ) |

tanx2s() deprojects Cartesian coordinates in the plane of a gnomonic (`TAN`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ tans2x()

int tans2x | ( | PRJS2X_ARGS |  | ) |

tans2x() projects native spherical coordinates to Cartesian coordinates in the plane of a gnomonic (`TAN`) projection.

See prjs2x() for a description of the API.

## ◆ stgset()

int stgset | ( | struct prjprm * | prj | ) |

stgset() sets up a prjprm struct for a stereographic (`STG`) projection.

See prjset() for a description of the API.

## ◆ stgx2s()

int stgx2s | ( | PRJX2S_ARGS |  | ) |

stgx2s() deprojects Cartesian coordinates in the plane of a stereographic (`STG`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ stgs2x()

int stgs2x | ( | PRJS2X_ARGS |  | ) |

stgs2x() projects native spherical coordinates to Cartesian coordinates in the plane of a stereographic (`STG`) projection.

See prjs2x() for a description of the API.

## ◆ sinset()

int sinset | ( | struct prjprm * | prj | ) |

stgset() sets up a prjprm struct for an orthographic/synthesis (`SIN`) projection.

See prjset() for a description of the API.

## ◆ sinx2s()

int sinx2s | ( | PRJX2S_ARGS |  | ) |

sinx2s() deprojects Cartesian coordinates in the plane of an orthographic/synthesis (`SIN`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ sins2x()

int sins2x | ( | PRJS2X_ARGS |  | ) |

sins2x() projects native spherical coordinates to Cartesian coordinates in the plane of an orthographic/synthesis (`SIN`) projection.

See prjs2x() for a description of the API.

## ◆ arcset()

int arcset | ( | struct prjprm * | prj | ) |

arcset() sets up a prjprm struct for a zenithal/azimuthal equidistant (`ARC`) projection.

See prjset() for a description of the API.

## ◆ arcx2s()

int arcx2s | ( | PRJX2S_ARGS |  | ) |

arcx2s() deprojects Cartesian coordinates in the plane of a zenithal/azimuthal equidistant (`ARC`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ arcs2x()

int arcs2x | ( | PRJS2X_ARGS |  | ) |

arcs2x() projects native spherical coordinates to Cartesian coordinates in the plane of a zenithal/azimuthal equidistant (`ARC`) projection.

See prjs2x() for a description of the API.

## ◆ zpnset()

int zpnset | ( | struct prjprm * | prj | ) |

zpnset() sets up a prjprm struct for a zenithal/azimuthal polynomial (`ZPN`) projection.

See prjset() for a description of the API.

## ◆ zpnx2s()

int zpnx2s | ( | PRJX2S_ARGS |  | ) |

zpnx2s() deprojects Cartesian coordinates in the plane of a zenithal/azimuthal polynomial (`ZPN`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ zpns2x()

int zpns2x | ( | PRJS2X_ARGS |  | ) |

zpns2x() projects native spherical coordinates to Cartesian coordinates in the plane of a zenithal/azimuthal polynomial (`ZPN`) projection.

See prjs2x() for a description of the API.

## ◆ zeaset()

int zeaset | ( | struct prjprm * | prj | ) |

zeaset() sets up a prjprm struct for a zenithal/azimuthal equal area (`ZEA`) projection.

See prjset() for a description of the API.

## ◆ zeax2s()

int zeax2s | ( | PRJX2S_ARGS |  | ) |

zeax2s() deprojects Cartesian coordinates in the plane of a zenithal/azimuthal equal area (`ZEA`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ zeas2x()

int zeas2x | ( | PRJS2X_ARGS |  | ) |

zeas2x() projects native spherical coordinates to Cartesian coordinates in the plane of a zenithal/azimuthal equal area (`ZEA`) projection.

See prjs2x() for a description of the API.

## ◆ airset()

int airset | ( | struct prjprm * | prj | ) |

airset() sets up a prjprm struct for an Airy (`AIR`) projection.

See prjset() for a description of the API.

## ◆ airx2s()

int airx2s | ( | PRJX2S_ARGS |  | ) |

airx2s() deprojects Cartesian coordinates in the plane of an Airy (`AIR`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ airs2x()

int airs2x | ( | PRJS2X_ARGS |  | ) |

airs2x() projects native spherical coordinates to Cartesian coordinates in the plane of an Airy (`AIR`) projection.

See prjs2x() for a description of the API.

## ◆ cypset()

int cypset | ( | struct prjprm * | prj | ) |

cypset() sets up a prjprm struct for a cylindrical perspective (`CYP`) projection.

See prjset() for a description of the API.

## ◆ cypx2s()

int cypx2s | ( | PRJX2S_ARGS |  | ) |

cypx2s() deprojects Cartesian coordinates in the plane of a cylindrical perspective (`CYP`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ cyps2x()

int cyps2x | ( | PRJS2X_ARGS |  | ) |

cyps2x() projects native spherical coordinates to Cartesian coordinates in the plane of a cylindrical perspective (`CYP`) projection.

See prjs2x() for a description of the API.

## ◆ ceaset()

int ceaset | ( | struct prjprm * | prj | ) |

ceaset() sets up a prjprm struct for a cylindrical equal area (`CEA`) projection.

See prjset() for a description of the API.

## ◆ ceax2s()

int ceax2s | ( | PRJX2S_ARGS |  | ) |

ceax2s() deprojects Cartesian coordinates in the plane of a cylindrical equal area (`CEA`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ ceas2x()

int ceas2x | ( | PRJS2X_ARGS |  | ) |

ceas2x() projects native spherical coordinates to Cartesian coordinates in the plane of a cylindrical equal area (`CEA`) projection.

See prjs2x() for a description of the API.

## ◆ carset()

int carset | ( | struct prjprm * | prj | ) |

carset() sets up a prjprm struct for a plate carrée (`CAR`) projection.

See prjset() for a description of the API.

## ◆ carx2s()

int carx2s | ( | PRJX2S_ARGS |  | ) |

carx2s() deprojects Cartesian coordinates in the plane of a plate carrée (`CAR`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ cars2x()

int cars2x | ( | PRJS2X_ARGS |  | ) |

cars2x() projects native spherical coordinates to Cartesian coordinates in the plane of a plate carrée (`CAR`) projection.

See prjs2x() for a description of the API.

## ◆ merset()

int merset | ( | struct prjprm * | prj | ) |

merset() sets up a prjprm struct for a Mercator (`MER`) projection.

See prjset() for a description of the API.

## ◆ merx2s()

int merx2s | ( | PRJX2S_ARGS |  | ) |

merx2s() deprojects Cartesian coordinates in the plane of a Mercator (`MER`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ mers2x()

int mers2x | ( | PRJS2X_ARGS |  | ) |

mers2x() projects native spherical coordinates to Cartesian coordinates in the plane of a Mercator (`MER`) projection.

See prjs2x() for a description of the API.

## ◆ sflset()

int sflset | ( | struct prjprm * | prj | ) |

sflset() sets up a prjprm struct for a Sanson-Flamsteed (`SFL`) projection.

See prjset() for a description of the API.

## ◆ sflx2s()

int sflx2s | ( | PRJX2S_ARGS |  | ) |

sflx2s() deprojects Cartesian coordinates in the plane of a Sanson-Flamsteed (`SFL`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ sfls2x()

int sfls2x | ( | PRJS2X_ARGS |  | ) |

sfls2x() projects native spherical coordinates to Cartesian coordinates in the plane of a Sanson-Flamsteed (`SFL`) projection.

See prjs2x() for a description of the API.

## ◆ parset()

int parset | ( | struct prjprm * | prj | ) |

parset() sets up a prjprm struct for a parabolic (`PAR`) projection.

See prjset() for a description of the API.

## ◆ parx2s()

int parx2s | ( | PRJX2S_ARGS |  | ) |

parx2s() deprojects Cartesian coordinates in the plane of a parabolic (`PAR`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ pars2x()

int pars2x | ( | PRJS2X_ARGS |  | ) |

pars2x() projects native spherical coordinates to Cartesian coordinates in the plane of a parabolic (`PAR`) projection.

See prjs2x() for a description of the API.

## ◆ molset()

int molset | ( | struct prjprm * | prj | ) |

molset() sets up a prjprm struct for a Mollweide (`MOL`) projection.

See prjset() for a description of the API.

## ◆ molx2s()

int molx2s | ( | PRJX2S_ARGS |  | ) |

molx2s() deprojects Cartesian coordinates in the plane of a Mollweide (`MOL`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ mols2x()

int mols2x | ( | PRJS2X_ARGS |  | ) |

mols2x() projects native spherical coordinates to Cartesian coordinates in the plane of a Mollweide (`MOL`) projection.

See prjs2x() for a description of the API.

## ◆ aitset()

int aitset | ( | struct prjprm * | prj | ) |

aitset() sets up a prjprm struct for a Hammer-Aitoff (`AIT`) projection.

See prjset() for a description of the API.

## ◆ aitx2s()

int aitx2s | ( | PRJX2S_ARGS |  | ) |

aitx2s() deprojects Cartesian coordinates in the plane of a Hammer-Aitoff (`AIT`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ aits2x()

int aits2x | ( | PRJS2X_ARGS |  | ) |

aits2x() projects native spherical coordinates to Cartesian coordinates in the plane of a Hammer-Aitoff (`AIT`) projection.

See prjs2x() for a description of the API.

## ◆ copset()

int copset | ( | struct prjprm * | prj | ) |

copset() sets up a prjprm struct for a conic perspective (`COP`) projection.

See prjset() for a description of the API.

## ◆ copx2s()

int copx2s | ( | PRJX2S_ARGS |  | ) |

copx2s() deprojects Cartesian coordinates in the plane of a conic perspective (`COP`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ cops2x()

int cops2x | ( | PRJS2X_ARGS |  | ) |

cops2x() projects native spherical coordinates to Cartesian coordinates in the plane of a conic perspective (`COP`) projection.

See prjs2x() for a description of the API.

## ◆ coeset()

int coeset | ( | struct prjprm * | prj | ) |

coeset() sets up a prjprm struct for a conic equal area (`COE`) projection.

See prjset() for a description of the API.

## ◆ coex2s()

int coex2s | ( | PRJX2S_ARGS |  | ) |

coex2s() deprojects Cartesian coordinates in the plane of a conic equal area (`COE`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ coes2x()

int coes2x | ( | PRJS2X_ARGS |  | ) |

coes2x() projects native spherical coordinates to Cartesian coordinates in the plane of a conic equal area (`COE`) projection.

See prjs2x() for a description of the API.

## ◆ codset()

int codset | ( | struct prjprm * | prj | ) |

codset() sets up a prjprm struct for a conic equidistant (`COD`) projection.

See prjset() for a description of the API.

## ◆ codx2s()

int codx2s | ( | PRJX2S_ARGS |  | ) |

codx2s() deprojects Cartesian coordinates in the plane of a conic equidistant (`COD`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ cods2x()

int cods2x | ( | PRJS2X_ARGS |  | ) |

cods2x() projects native spherical coordinates to Cartesian coordinates in the plane of a conic equidistant (`COD`) projection.

See prjs2x() for a description of the API.

## ◆ cooset()

int cooset | ( | struct prjprm * | prj | ) |

cooset() sets up a prjprm struct for a conic orthomorphic (`COO`) projection.

See prjset() for a description of the API.

## ◆ coox2s()

int coox2s | ( | PRJX2S_ARGS |  | ) |

coox2s() deprojects Cartesian coordinates in the plane of a conic orthomorphic (`COO`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ coos2x()

int coos2x | ( | PRJS2X_ARGS |  | ) |

coos2x() projects native spherical coordinates to Cartesian coordinates in the plane of a conic orthomorphic (`COO`) projection.

See prjs2x() for a description of the API.

## ◆ bonset()

int bonset | ( | struct prjprm * | prj | ) |

bonset() sets up a prjprm struct for a Bonne (`BON`) projection.

See prjset() for a description of the API.

## ◆ bonx2s()

int bonx2s | ( | PRJX2S_ARGS |  | ) |

bonx2s() deprojects Cartesian coordinates in the plane of a Bonne (`BON`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ bons2x()

int bons2x | ( | PRJS2X_ARGS |  | ) |

bons2x() projects native spherical coordinates to Cartesian coordinates in the plane of a Bonne (`BON`) projection.

See prjs2x() for a description of the API.

## ◆ pcoset()

int pcoset | ( | struct prjprm * | prj | ) |

pcoset() sets up a prjprm struct for a polyconic (`PCO`) projection.

See prjset() for a description of the API.

## ◆ pcox2s()

int pcox2s | ( | PRJX2S_ARGS |  | ) |

pcox2s() deprojects Cartesian coordinates in the plane of a polyconic (`PCO`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ pcos2x()

int pcos2x | ( | PRJS2X_ARGS |  | ) |

pcos2x() projects native spherical coordinates to Cartesian coordinates in the plane of a polyconic (`PCO`) projection.

See prjs2x() for a description of the API.

## ◆ tscset()

int tscset | ( | struct prjprm * | prj | ) |

tscset() sets up a prjprm struct for a tangential spherical cube (`TSC`) projection.

See prjset() for a description of the API.

## ◆ tscx2s()

int tscx2s | ( | PRJX2S_ARGS |  | ) |

tscx2s() deprojects Cartesian coordinates in the plane of a tangential spherical cube (`TSC`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ tscs2x()

int tscs2x | ( | PRJS2X_ARGS |  | ) |

tscs2x() projects native spherical coordinates to Cartesian coordinates in the plane of a tangential spherical cube (`TSC`) projection.

See prjs2x() for a description of the API.

## ◆ cscset()

int cscset | ( | struct prjprm * | prj | ) |

cscset() sets up a prjprm struct for a COBE spherical cube (`CSC`) projection.

See prjset() for a description of the API.

## ◆ cscx2s()

int cscx2s | ( | PRJX2S_ARGS |  | ) |

cscx2s() deprojects Cartesian coordinates in the plane of a COBE spherical cube (`CSC`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ cscs2x()

int cscs2x | ( | PRJS2X_ARGS |  | ) |

cscs2x() projects native spherical coordinates to Cartesian coordinates in the plane of a COBE spherical cube (`CSC`) projection.

See prjs2x() for a description of the API.

## ◆ qscset()

int qscset | ( | struct prjprm * | prj | ) |

qscset() sets up a prjprm struct for a quadrilateralized spherical cube (`QSC`) projection.

See prjset() for a description of the API.

## ◆ qscx2s()

int qscx2s | ( | PRJX2S_ARGS |  | ) |

qscx2s() deprojects Cartesian coordinates in the plane of a quadrilateralized spherical cube (`QSC`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ qscs2x()

int qscs2x | ( | PRJS2X_ARGS |  | ) |

qscs2x() projects native spherical coordinates to Cartesian coordinates in the plane of a quadrilateralized spherical cube (`QSC`) projection.

See prjs2x() for a description of the API.

## ◆ hpxset()

int hpxset | ( | struct prjprm * | prj | ) |

hpxset() sets up a prjprm struct for a HEALPix (`HPX`) projection.

See prjset() for a description of the API.

## ◆ hpxx2s()

int hpxx2s | ( | PRJX2S_ARGS |  | ) |

hpxx2s() deprojects Cartesian coordinates in the plane of a HEALPix (`HPX`) projection to native spherical coordinates .

See prjx2s() for a description of the API.

## ◆ hpxs2x()

int hpxs2x | ( | PRJS2X_ARGS |  | ) |

hpxs2x() projects native spherical coordinates to Cartesian coordinates in the plane of a HEALPix (`HPX`) projection.

See prjs2x() for a description of the API.

## ◆ xphset()

int xphset | ( | struct prjprm * | prj | ) |

## ◆ xphx2s()

int xphx2s | ( | PRJX2S_ARGS |  | ) |

## ◆ xphs2x()

int xphs2x | ( | PRJS2X_ARGS |  | ) |

## Variable Documentation

## ◆ prj_errmsg

const char * prj_errmsg[]

Error messages to match the status value returned from each function.

## ◆ CONIC

const int CONIC

Identifier for conic projections, see prjprm::category.

## ◆ CONVENTIONAL

const int CONVENTIONAL

Identifier for conventional projections, see prjprm::category.

## ◆ CYLINDRICAL

const int CYLINDRICAL

Identifier for cylindrical projections, see prjprm::category.

## ◆ POLYCONIC

const int POLYCONIC

Identifier for polyconic projections, see prjprm::category.

## ◆ PSEUDOCYLINDRICAL

const int PSEUDOCYLINDRICAL

Identifier for pseudocylindrical projections, see prjprm::category.

## ◆ QUADCUBE

const int QUADCUBE

Identifier for quadcube projections, see prjprm::category.

## ◆ ZENITHAL

const int ZENITHAL

Identifier for zenithal/azimuthal projections, see prjprm::category.

## ◆ HEALPIX

const int HEALPIX

Identifier for the HEALPix projection, see prjprm::category.

## ◆ prj_categories

const char prj_categories[9][32]

Names of the projection categories, all in lower-case except for "HEALPix".

Provided for information only, not used by the projection routines.

## ◆ prj_ncode

const int prj_ncode

The number of recognized three-letter projection codes (currently 27), see prj_codes.

## ◆ prj_codes

const char prj_codes[27][4]

List of all recognized three-letter projection codes (currently 27), e.g. `SIN`, `TAN`, etc.