- Main Page
- Related Pages
- Data Structures
- Files

# prj.h

Go to the documentation of this file.

    00001 /*============================================================================
    00002
    00003   WCSLIB 4.10 - an implementation of the FITS WCS standard.
    00004   Copyright (C) 1995-2012, Mark Calabretta
    00005
    00006   This file is part of WCSLIB.
    00007
    00008   WCSLIB is free software: you can redistribute it and/or modify it under the
    00009   terms of the GNU Lesser General Public License as published by the Free
    00010   Software Foundation, either version 3 of the License, or (at your option)
    00011   any later version.
    00012
    00013   WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
    00014   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00015   FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    00016   more details.
    00017
    00018   You should have received a copy of the GNU Lesser General Public License
    00019   along with WCSLIB.  If not, see <http://www.gnu.org/licenses/>.
    00020
    00021   Correspondence concerning WCSLIB may be directed to:
    00022     Internet email: mcalabre@atnf.csiro.au
    00023     Postal address: Dr. Mark Calabretta
    00024                     Australia Telescope National Facility, CSIRO
    00025                     PO Box 76
    00026                     Epping NSW 1710
    00027                     AUSTRALIA
    00028
    00029   Author: Mark Calabretta, Australia Telescope National Facility
    00030   http://www.atnf.csiro.au/~mcalabre/index.html
    00031   $Id: prj.h,v 4.10 2012/02/05 23:41:44 cal103 Exp $
    00032 *=============================================================================
    00033 *
    00034 * WCSLIB 4.10 - C routines that implement the spherical map projections
    00035 * recognized by the FITS World Coordinate System (WCS) standard.  Refer to
    00036 *
    00037 *   "Representations of world coordinates in FITS",
    00038 *   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I)
    00039 *
    00040 *   "Representations of celestial coordinates in FITS",
    00041 *   Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II)
    00042 *
    00043 * Refer to the README file provided with WCSLIB for an overview of the
    00044 * library.
    00045 *
    00046 *
    00047 * Summary of the prj routines
    00048 * ---------------------------
    00049 * These routines implement the spherical map projections defined by the FITS
    00050 * WCS standard.  They are based on the prjprm struct which contains all
    00051 * information needed for the computations.  The struct contains some members
    00052 * that must be set by the user, and others that are maintained by these
    00053 * routines, somewhat like a C++ class but with no encapsulation.
    00054 *
    00055 * Routine prjini() is provided to initialize the prjprm struct with default
    00056 * values, prjfree() reclaims any memory that may have been allocated to store
    00057 * an error message, and prjprt() prints its contents.
    00058 *
    00059 * Setup routines for each projection with names of the form ???set(), where
    00060 * "???" is the down-cased three-letter projection code, compute intermediate
    00061 * values in the prjprm struct from parameters in it that were supplied by the
    00062 * user.  The struct always needs to be set by the projection's setup routine
    00063 * but that need not be called explicitly - refer to the explanation of
    00064 * prjprm::flag.
    00065 *
    00066 * Each map projection is implemented via separate functions for the spherical
    00067 * projection, ???s2x(), and deprojection, ???x2s().
    00068 *
    00069 * A set of driver routines, prjset(), prjx2s(), and prjs2x(), provides a
    00070 * generic interface to the specific projection routines which they invoke
    00071 * via pointers-to-functions stored in the prjprm struct.
    00072 *
    00073 * In summary, the routines are:
    00074 *   - prjini()                Initialization routine for the prjprm struct.
    00075 *   - prjprt()                Routine to print the prjprm struct.
    00076 *
    00077 *   - prjset(), prjx2s(), prjs2x():   Generic driver routines
    00078 *
    00079 *   - azpset(), azpx2s(), azps2x():   AZP (zenithal/azimuthal perspective)
    00080 *   - szpset(), szpx2s(), szps2x():   SZP (slant zenithal perspective)
    00081 *   - tanset(), tanx2s(), tans2x():   TAN (gnomonic)
    00082 *   - stgset(), stgx2s(), stgs2x():   STG (stereographic)
    00083 *   - sinset(), sinx2s(), sins2x():   SIN (orthographic/synthesis)
    00084 *   - arcset(), arcx2s(), arcs2x():   ARC (zenithal/azimuthal equidistant)
    00085 *   - zpnset(), zpnx2s(), zpns2x():   ZPN (zenithal/azimuthal polynomial)
    00086 *   - zeaset(), zeax2s(), zeas2x():   ZEA (zenithal/azimuthal equal area)
    00087 *   - airset(), airx2s(), airs2x():   AIR (Airy)
    00088 *   - cypset(), cypx2s(), cyps2x():   CYP (cylindrical perspective)
    00089 *   - ceaset(), ceax2s(), ceas2x():   CEA (cylindrical equal area)
    00090 *   - carset(), carx2s(), cars2x():   CAR (Plate carree)
    00091 *   - merset(), merx2s(), mers2x():   MER (Mercator)
    00092 *   - sflset(), sflx2s(), sfls2x():   SFL (Sanson-Flamsteed)
    00093 *   - parset(), parx2s(), pars2x():   PAR (parabolic)
    00094 *   - molset(), molx2s(), mols2x():   MOL (Mollweide)
    00095 *   - aitset(), aitx2s(), aits2x():   AIT (Hammer-Aitoff)
    00096 *   - copset(), copx2s(), cops2x():   COP (conic perspective)
    00097 *   - coeset(), coex2s(), coes2x():   COE (conic equal area)
    00098 *   - codset(), codx2s(), cods2x():   COD (conic equidistant)
    00099 *   - cooset(), coox2s(), coos2x():   COO (conic orthomorphic)
    00100 *   - bonset(), bonx2s(), bons2x():   BON (Bonne)
    00101 *   - pcoset(), pcox2s(), pcos2x():   PCO (polyconic)
    00102 *   - tscset(), tscx2s(), tscs2x():   TSC (tangential spherical cube)
    00103 *   - cscset(), cscx2s(), cscs2x():   CSC (COBE spherical cube)
    00104 *   - qscset(), qscx2s(), qscs2x():   QSC (quadrilateralized spherical cube)
    00105 *   - hpxset(), hpxx2s(), hpxs2x():   HPX (HEALPix)
    00106 *
    00107 * Argument checking (projection routines):
    00108 * ----------------------------------------
    00109 * The values of phi and theta (the native longitude and latitude) normally lie
    00110 * in the range [-180,180] for phi, and [-90,90] for theta.  However, all
    00111 * projection routines will accept any value of phi and will not normalize it.
    00112 *
    00113 * The projection routines do not explicitly check that theta lies within the
    00114 * range [-90,90].  They do check for any value of theta that produces an
    00115 * invalid argument to the projection equations (e.g. leading to division by
    00116 * zero).  The projection routines for AZP, SZP, TAN, SIN, ZPN, and COP also
    00117 * return error 2 if (phi,theta) corresponds to the overlapped (far) side of
    00118 * the projection but also return the corresponding value of (x,y).  This
    00119 * strict bounds checking may be relaxed at any time by setting prjprm::bounds
    00120 * to 0 (rather than 1); the projections need not be reinitialized.
    00121 *
    00122 * Argument checking (deprojection routines):
    00123 * ------------------------------------------
    00124 * Error checking on the projected coordinates (x,y) is limited to that
    00125 * required to ascertain whether a solution exists.  Where a solution does
    00126 * exist no check is made that the value of phi and theta obtained lie within
    00127 * the ranges [-180,180] for phi, and [-90,90] for theta.
    00128 *
    00129 * Accuracy:
    00130 * ---------
    00131 * No warranty is given for the accuracy of these routines (refer to the
    00132 * copyright notice); intending users must satisfy for themselves their
    00133 * adequacy for the intended purpose.  However, closure to a precision of at
    00134 * least 1E-10 degree of longitude and latitude has been verified for typical
    00135 * projection parameters on the 1 degree graticule of native longitude and
    00136 * latitude (to within 5 degrees of any latitude where the projection may
    00137 * diverge).  Refer to the tprj1.c and tprj2.c test routines that accompany
    00138 * this software.
    00139 *
    00140 *
    00141 * prjini() - Default constructor for the prjprm struct
    00142 * ----------------------------------------------------
    00143 * prjini() sets all members of a prjprm struct to default values.  It should
    00144 * be used to initialize every prjprm struct.
    00145 *
    00146 * Returned:
    00147 *   prj       struct prjprm*
    00148 *                       Projection parameters.
    00149 *
    00150 * Function return value:
    00151 *             int       Status return value:
    00152 *                         0: Success.
    00153 *                         1: Null prjprm pointer passed.
    00154 *
    00155 *
    00156 * prjfree() - Destructor for the prjprm struct
    00157 * --------------------------------------------
    00158 * prjfree() frees any memory that may have been allocated to store an error
    00159 * message in the prjprm struct.
    00160 *
    00161 * Given:
    00162 *   prj       struct prjprm*
    00163 *                       Projection parameters.
    00164 *
    00165 * Function return value:
    00166 *             int       Status return value:
    00167 *                         0: Success.
    00168 *                         1: Null prjprm pointer passed.
    00169 *
    00170 *
    00171 * prjprt() - Print routine for the prjprm struct
    00172 * ----------------------------------------------
    00173 * prjprt() prints the contents of a prjprm struct using wcsprintf().  Mainly
    00174 * intended for diagnostic purposes.
    00175 *
    00176 * Given:
    00177 *   prj       const struct prjprm*
    00178 *                       Projection parameters.
    00179 *
    00180 * Function return value:
    00181 *             int       Status return value:
    00182 *                         0: Success.
    00183 *                         1: Null prjprm pointer passed.
    00184 *
    00185 *
    00186 * prjset() - Generic setup routine for the prjprm struct
    00187 * ------------------------------------------------------
    00188 * prjset() sets up a prjprm struct according to information supplied within
    00189 * it.
    00190 *
    00191 * Note that this routine need not be called directly; it will be invoked by
    00192 * prjx2s() and prjs2x() if prj.flag is anything other than a predefined magic
    00193 * value.
    00194 *
    00195 * The one important distinction between prjset() and the setup routines for
    00196 * the specific projections is that the projection code must be defined in the
    00197 * prjprm struct in order for prjset() to identify the required projection.
    00198 * Once prjset() has initialized the prjprm struct, prjx2s() and prjs2x() use
    00199 * the pointers to the specific projection and deprojection routines contained
    00200 * therein.
    00201 *
    00202 * Given and returned:
    00203 *   prj       struct prjprm*
    00204 *                       Projection parameters.
    00205 *
    00206 * Function return value:
    00207 *             int       Status return value:
    00208 *                         0: Success.
    00209 *                         1: Null prjprm pointer passed.
    00210 *                         2: Invalid projection parameters.
    00211 *
    00212 *                       For returns > 1, a detailed error message is set in
    00213 *                       prjprm::err if enabled, see wcserr_enable().
    00214 *
    00215 *
    00216 * prjx2s() - Generic Cartesian-to-spherical deprojection
    00217 * ------------------------------------------------------
    00218 * Deproject Cartesian (x,y) coordinates in the plane of projection to native
    00219 * spherical coordinates (phi,theta).
    00220 *
    00221 * The projection is that specified by prjprm::code.
    00222 *
    00223 * Given and returned:
    00224 *   prj       struct prjprm*
    00225 *                       Projection parameters.
    00226 *
    00227 * Given:
    00228 *   nx,ny     int       Vector lengths.
    00229 *
    00230 *   sxy,spt   int       Vector strides.
    00231 *
    00232 *   x,y       const double[]
    00233 *                       Projected coordinates.
    00234 *
    00235 * Returned:
    00236 *   phi,theta double[]  Longitude and latitude (phi,theta) of the projected
    00237 *                       point in native spherical coordinates [deg].
    00238 *
    00239 *   stat      int[]     Status return value for each vector element:
    00240 *                         0: Success.
    00241 *                         1: Invalid value of (x,y).
    00242 *
    00243 * Function return value:
    00244 *             int       Status return value:
    00245 *                         0: Success.
    00246 *                         1: Null prjprm pointer passed.
    00247 *                         2: Invalid projection parameters.
    00248 *                         3: One or more of the (x,y) coordinates were
    00249 *                            invalid, as indicated by the stat vector.
    00250 *
    00251 *                       For returns > 1, a detailed error message is set in
    00252 *                       prjprm::err if enabled, see wcserr_enable().
    00253 *
    00254 *
    00255 * prjs2x() - Generic spherical-to-Cartesian projection
    00256 * ----------------------------------------------------
    00257 * Project native spherical coordinates (phi,theta) to Cartesian (x,y)
    00258 * coordinates in the plane of projection.
    00259 *
    00260 * The projection is that specified by prjprm::code.
    00261 *
    00262 * Given and returned:
    00263 *   prj       struct prjprm*
    00264 *                       Projection parameters.
    00265 *
    00266 * Given:
    00267 *   nphi,
    00268 *   ntheta    int       Vector lengths.
    00269 *
    00270 *   spt,sxy   int       Vector strides.
    00271 *
    00272 *   phi,theta const double[]
    00273 *                       Longitude and latitude (phi,theta) of the projected
    00274 *                       point in native spherical coordinates [deg].
    00275 *
    00276 * Returned:
    00277 *   x,y       double[]  Projected coordinates.
    00278 *
    00279 *   stat      int[]     Status return value for each vector element:
    00280 *                         0: Success.
    00281 *                         1: Invalid value of (phi,theta).
    00282 *
    00283 * Function return value:
    00284 *             int       Status return value:
    00285 *                         0: Success.
    00286 *                         1: Null prjprm pointer passed.
    00287 *                         2: Invalid projection parameters.
    00288 *                         4: One or more of the (phi,theta) coordinates
    00289 *                            were, invalid, as indicated by the stat vector.
    00290 *
    00291 *                       For returns > 1, a detailed error message is set in
    00292 *                       prjprm::err if enabled, see wcserr_enable().
    00293 *
    00294 *
    00295 * ???set() - Specific setup routines for the prjprm struct
    00296 * --------------------------------------------------------
    00297 * Set up a prjprm struct for a particular projection according to information
    00298 * supplied within it.
    00299 *
    00300 * Given and returned:
    00301 *   prj       struct prjprm*
    00302 *                       Projection parameters.
    00303 *
    00304 * Function return value:
    00305 *             int       Status return value:
    00306 *                         0: Success.
    00307 *                         1: Null prjprm pointer passed.
    00308 *                         2: Invalid projection parameters.
    00309 *
    00310 *                       For returns > 1, a detailed error message is set in
    00311 *                       prjprm::err if enabled, see wcserr_enable().
    00312 *
    00313 *
    00314 * ???x2s() - Specific Cartesian-to-spherical deprojection routines
    00315 * ----------------------------------------------------------------
    00316 * Transform (x,y) coordinates in the plane of projection to native spherical
    00317 * coordinates (phi,theta).
    00318 *
    00319 * Given and returned:
    00320 *   prj       struct prjprm*
    00321 *                       Projection parameters.
    00322 *
    00323 * Given:
    00324 *   nx,ny     int       Vector lengths.
    00325 *
    00326 *   sxy,spt   int       Vector strides.
    00327 *
    00328 *   x,y       const double[]
    00329 *                       Projected coordinates.
    00330 *
    00331 * Returned:
    00332 *   phi,theta double[]  Longitude and latitude of the projected point in
    00333 *                       native spherical coordinates [deg].
    00334 *
    00335 *   stat      int[]     Status return value for each vector element:
    00336 *                         0: Success.
    00337 *                         1: Invalid value of (x,y).
    00338 *
    00339 * Function return value:
    00340 *             int       Status return value:
    00341 *                         0: Success.
    00342 *                         1: Null prjprm pointer passed.
    00343 *                         2: Invalid projection parameters.
    00344 *                         3: One or more of the (x,y) coordinates were
    00345 *                            invalid, as indicated by the stat vector.
    00346 *
    00347 *                       For returns > 1, a detailed error message is set in
    00348 *                       prjprm::err if enabled, see wcserr_enable().
    00349 *
    00350 *
    00351 * ???s2x() - Specific spherical-to-Cartesian projection routines
    00352 *---------------------------------------------------------------
    00353 * Transform native spherical coordinates (phi,theta) to (x,y) coordinates in
    00354 * the plane of projection.
    00355 *
    00356 * Given and returned:
    00357 *   prj       struct prjprm*
    00358 *                       Projection parameters.
    00359 *
    00360 * Given:
    00361 *   nphi,
    00362 *   ntheta    int       Vector lengths.
    00363 *
    00364 *   spt,sxy   int       Vector strides.
    00365 *
    00366 *   phi,theta const double[]
    00367 *                       Longitude and latitude of the projected point in
    00368 *                       native spherical coordinates [deg].
    00369 *
    00370 * Returned:
    00371 *   x,y       double[]  Projected coordinates.
    00372 *
    00373 *   stat      int[]     Status return value for each vector element:
    00374 *                         0: Success.
    00375 *                         1: Invalid value of (phi,theta).
    00376 *
    00377 * Function return value:
    00378 *             int       Status return value:
    00379 *                         0: Success.
    00380 *                         1: Null prjprm pointer passed.
    00381 *                         2: Invalid projection parameters.
    00382 *                         4: One or more of the (phi,theta) coordinates
    00383 *                            were, invalid, as indicated by the stat vector.
    00384 *
    00385 *                       For returns > 1, a detailed error message is set in
    00386 *                       prjprm::err if enabled, see wcserr_enable().
    00387 *
    00388 *
    00389 * prjprm struct - Projection parameters
    00390 * -------------------------------------
    00391 * The prjprm struct contains all information needed to project or deproject
    00392 * native spherical coordinates.  It consists of certain members that must be
    00393 * set by the user ("given") and others that are set by the WCSLIB routines
    00394 * ("returned").  Some of the latter are supplied for informational purposes
    00395 * while others are for internal use only.
    00396 *
    00397 *   int flag
    00398 *     (Given and returned) This flag must be set to zero whenever any of the
    00399 *     following prjprm struct members are set or changed:
    00400 *
    00401 *       - prjprm::code,
    00402 *       - prjprm::r0,
    00403 *       - prjprm::pv[],
    00404 *       - prjprm::phi0,
    00405 *       - prjprm::theta0.
    00406 *
    00407 *     This signals the initialization routine (prjset() or ???set()) to
    00408 *     recompute the returned members of the prjprm struct.  flag will then be
    00409 *     reset to indicate that this has been done.
    00410 *
    00411 *     Note that flag need not be reset when prjprm::bounds is changed.
    00412 *
    00413 *   char code[4]
    00414 *     (Given) Three-letter projection code defined by the FITS standard.
    00415 *
    00416 *   double r0
    00417 *     (Given) The radius of the generating sphere for the projection, a linear
    00418 *     scaling parameter.  If this is zero, it will be reset to its default
    00419 *     value of 180/pi (the value for FITS WCS).
    00420 *
    00421 *   double pv[30]
    00422 *     (Given) Projection parameters.  These correspond to the PVi_ma keywords
    00423 *     in FITS, so pv[0] is PVi_0a, pv[1] is PVi_1a, etc., where i denotes the
    00424 *     latitude-like axis.  Many projections use pv[1] (PVi_1a), some also use
    00425 *     pv[2] (PVi_2a) and SZP uses pv[3] (PVi_3a).  ZPN is currently the only
    00426 *     projection that uses any of the others.
    00427 *
    00428 *     Usage of the pv[] array as it applies to each projection is described in
    00429 *     the prologue to each trio of projection routines in prj.c.
    00430 *
    00431 *   double phi0
    00432 *     (Given) The native longitude, phi_0 [deg], and ...
    00433 *   double theta0
    00434 *     (Given) ... the native latitude, theta_0 [deg], of the reference point,
    00435 *     i.e. the point (x,y) = (0,0).  If undefined (set to a magic value by
    00436 *     prjini()) the initialization routine will set this to a
    00437 *     projection-specific default.
    00438 *
    00439 *   int bounds
    00440 *     (Given) Controls strict bounds checking for the AZP, SZP, TAN, SIN, ZPN,
    00441 *     and COP projections; set to zero to disable checking.
    00442 *
    00443 * The remaining members of the prjprm struct are maintained by the setup
    00444 * routines and must not be modified elsewhere:
    00445 *
    00446 *   char name[40]
    00447 *     (Returned) Long name of the projection.
    00448 *
    00449 *     Provided for information only, not used by the projection routines.
    00450 *
    00451 *   int  category
    00452 *     (Returned) Projection category matching the value of the relevant global
    00453 *     variable:
    00454 *
    00455 *     - ZENITHAL,
    00456 *     - CYLINDRICAL,
    00457 *     - PSEUDOCYLINDRICAL,
    00458 *     - CONVENTIONAL,
    00459 *     - CONIC,
    00460 *     - POLYCONIC,
    00461 *     - QUADCUBE, and
    00462 *     - HEALPIX.
    00463 *
    00464 *     The category name may be identified via the prj_categories character
    00465 *     array, e.g.
    00466 *
    00467 =       struct prjprm prj;
    00468 =         ...
    00469 =       printf("%s\n", prj_categories[prj.category]);
    00470 *
    00471 *     Provided for information only, not used by the projection routines.
    00472 *
    00473 *   int  pvrange
    00474 *     (Returned) Range of projection parameter indices: 100 times the first
    00475 *     allowed index plus the number of parameters, e.g. TAN is 0 (no
    00476 *     parameters), SZP is 103 (1 to 3), and ZPN is 30 (0 to 29).
    00477 *
    00478 *     Provided for information only, not used by the projection routines.
    00479 *
    00480 *   int  simplezen
    00481 *     (Returned) True if the projection is a radially-symmetric zenithal
    00482 *     projection.
    00483 *
    00484 *     Provided for information only, not used by the projection routines.
    00485 *
    00486 *   int  equiareal
    00487 *     (Returned) True if the projection is equal area.
    00488 *
    00489 *     Provided for information only, not used by the projection routines.
    00490 *
    00491 *   int  conformal
    00492 *     (Returned) True if the projection is conformal.
    00493 *
    00494 *     Provided for information only, not used by the projection routines.
    00495 *
    00496 *   int  global
    00497 *     (Returned) True if the projection can represent the whole sphere in a
    00498 *     finite, non-overlapped mapping.
    00499 *
    00500 *     Provided for information only, not used by the projection routines.
    00501 *
    00502 *   int  divergent
    00503 *     (Returned) True if the projection diverges in latitude.
    00504 *
    00505 *     Provided for information only, not used by the projection routines.
    00506 *
    00507 *   double x0
    00508 *     (Returned) The offset in x, and ...
    00509 *   double y0
    00510 *     (Returned) ... the offset in y used to force (x,y) = (0,0) at
    00511 *     (phi_0,theta_0).
    00512 *
    00513 *   struct wcserr *err
    00514 *     (Returned) If enabled, when an error status is returned this struct
    00515 *     contains detailed information about the error, see wcserr_enable().
    00516 *
    00517 *   void *padding
    00518 *     (An unused variable inserted for alignment purposes only.)
    00519 *
    00520 *   double w[10]
    00521 *     (Returned) Intermediate floating-point values derived from the
    00522 *     projection parameters, cached here to save recomputation.
    00523 *
    00524 *     Usage of the w[] array as it applies to each projection is described in
    00525 *     the prologue to each trio of projection routines in prj.c.
    00526 *
    00527 *   int n
    00528 *     (Returned) Intermediate integer value (used only for the ZPN and HPX
    00529 *     projections).
    00530 *
    00531 *   int (*prjx2s)(PRJX2S_ARGS)
    00532 *     (Returned) Pointer to the projection ...
    00533 *   int (*prjs2x)(PRJ_ARGS)
    00534 *     (Returned) ... and deprojection routines.
    00535 *
    00536 *
    00537 * Global variable: const char *prj_errmsg[] - Status return messages
    00538 * ------------------------------------------------------------------
    00539 * Error messages to match the status value returned from each function.
    00540 *
    00541 *===========================================================================*/
    00542
    00543 #ifndef WCSLIB_PROJ
    00544 #define WCSLIB_PROJ
    00545
    00546 #include "wcserr.h"
    00547
    00548 #ifdef __cplusplus
    00549 extern "C" {
    00550 #endif
    00551
    00552
    00553 /* Total number of projection parameters; 0 to PVN-1. */
    00554 #define PVN 30
    00555
    00556 extern const char *prj_errmsg[];
    00557
    00558 enum prj_errmsg_enum {
    00559   PRJERR_SUCCESS      = 0,      /* Success. */
    00560   PRJERR_NULL_POINTER = 1,      /* Null prjprm pointer passed. */
    00561   PRJERR_BAD_PARAM    = 2,      /* Invalid projection parameters. */
    00562   PRJERR_BAD_PIX      = 3,      /* One or more of the (x, y) coordinates were
    00563                                    invalid. */
    00564   PRJERR_BAD_WORLD    = 4       /* One or more of the (phi, theta) coordinates
    00565                                    were invalid. */
    00566 };
    00567
    00568 extern const int CONIC, CONVENTIONAL, CYLINDRICAL, POLYCONIC,
    00569                  PSEUDOCYLINDRICAL, QUADCUBE, ZENITHAL, HEALPIX;
    00570 extern const char prj_categories[9][32];
    00571
    00572 extern const int  prj_ncode;
    00573 extern const char prj_codes[27][4];
    00574
    00575 #ifdef PRJX2S_ARGS
    00576 #undef PRJX2S_ARGS
    00577 #endif
    00578
    00579 #ifdef PRJS2X_ARGS
    00580 #undef PRJS2X_ARGS
    00581 #endif
    00582
    00583 /* For use in declaring deprojection function prototypes. */
    00584 #define PRJX2S_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \
    00585 const double x[], const double y[], double phi[], double theta[], int stat[]
    00586
    00587 /* For use in declaring projection function prototypes. */
    00588 #define PRJS2X_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \
    00589 const double phi[], const double theta[], double x[], double y[], int stat[]
    00590
    00591
    00592 struct prjprm {
    00593   /* Initialization flag (see the prologue above).                          */
    00594   /*------------------------------------------------------------------------*/
    00595   int    flag;                  /* Set to zero to force initialization.     */
    00596
    00597   /* Parameters to be provided (see the prologue above).                    */
    00598   /*------------------------------------------------------------------------*/
    00599   char   code[4];               /* Three-letter projection code.            */
    00600   double r0;                    /* Radius of the generating sphere.         */
    00601   double pv[PVN];               /* Projection parameters.                   */
    00602   double phi0, theta0;          /* Fiducial native coordinates.             */
    00603   int    bounds;                /* Enable strict bounds checking.           */
    00604
    00605   /* Information derived from the parameters supplied.                      */
    00606   /*------------------------------------------------------------------------*/
    00607   char   name[40];              /* Projection name.                         */
    00608   int    category;              /* Projection category.                     */
    00609   int    pvrange;               /* Range of projection parameter indices.   */
    00610   int    simplezen;             /* Is it a simple zenithal projection?      */
    00611   int    equiareal;             /* Is it an equal area projection?          */
    00612   int    conformal;             /* Is it a conformal projection?            */
    00613   int    global;                /* Can it map the whole sphere?             */
    00614   int    divergent;             /* Does the projection diverge in latitude? */
    00615   double x0, y0;                /* Fiducial offsets.                        */
    00616
    00617   /* Error handling                                                         */
    00618   /*------------------------------------------------------------------------*/
    00619   struct wcserr *err;
    00620
    00621   /* Private                                                                */
    00622   /*------------------------------------------------------------------------*/
    00623   void   *padding;              /* (Dummy inserted for alignment purposes.) */
    00624   double w[10];                 /* Intermediate values.                     */
    00625   int    m, n;                  /* Intermediate values.                     */
    00626
    00627   int (*prjx2s)(PRJX2S_ARGS);   /* Pointers to the spherical projection and */
    00628   int (*prjs2x)(PRJS2X_ARGS);   /* deprojection functions.                  */
    00629 };
    00630
    00631 /* Size of the prjprm struct in int units, used by the Fortran wrappers. */
    00632 #define PRJLEN (sizeof(struct prjprm)/sizeof(int))
    00633
    00634
    00635 /* Use the preprocessor to help declare function prototypes (see above). */
    00636 int prjini(struct prjprm *prj);
    00637 int prjfree(struct prjprm *prj);
    00638 int prjprt(const struct prjprm *prj);
    00639
    00640 int prjset(struct prjprm *prj);
    00641 int prjx2s(PRJX2S_ARGS);
    00642 int prjs2x(PRJS2X_ARGS);
    00643
    00644 int azpset(struct prjprm *prj);
    00645 int azpx2s(PRJX2S_ARGS);
    00646 int azps2x(PRJS2X_ARGS);
    00647
    00648 int szpset(struct prjprm *prj);
    00649 int szpx2s(PRJX2S_ARGS);
    00650 int szps2x(PRJS2X_ARGS);
    00651
    00652 int tanset(struct prjprm *prj);
    00653 int tanx2s(PRJX2S_ARGS);
    00654 int tans2x(PRJS2X_ARGS);
    00655
    00656 int stgset(struct prjprm *prj);
    00657 int stgx2s(PRJX2S_ARGS);
    00658 int stgs2x(PRJS2X_ARGS);
    00659
    00660 int sinset(struct prjprm *prj);
    00661 int sinx2s(PRJX2S_ARGS);
    00662 int sins2x(PRJS2X_ARGS);
    00663
    00664 int arcset(struct prjprm *prj);
    00665 int arcx2s(PRJX2S_ARGS);
    00666 int arcs2x(PRJS2X_ARGS);
    00667
    00668 int zpnset(struct prjprm *prj);
    00669 int zpnx2s(PRJX2S_ARGS);
    00670 int zpns2x(PRJS2X_ARGS);
    00671
    00672 int zeaset(struct prjprm *prj);
    00673 int zeax2s(PRJX2S_ARGS);
    00674 int zeas2x(PRJS2X_ARGS);
    00675
    00676 int airset(struct prjprm *prj);
    00677 int airx2s(PRJX2S_ARGS);
    00678 int airs2x(PRJS2X_ARGS);
    00679
    00680 int cypset(struct prjprm *prj);
    00681 int cypx2s(PRJX2S_ARGS);
    00682 int cyps2x(PRJS2X_ARGS);
    00683
    00684 int ceaset(struct prjprm *prj);
    00685 int ceax2s(PRJX2S_ARGS);
    00686 int ceas2x(PRJS2X_ARGS);
    00687
    00688 int carset(struct prjprm *prj);
    00689 int carx2s(PRJX2S_ARGS);
    00690 int cars2x(PRJS2X_ARGS);
    00691
    00692 int merset(struct prjprm *prj);
    00693 int merx2s(PRJX2S_ARGS);
    00694 int mers2x(PRJS2X_ARGS);
    00695
    00696 int sflset(struct prjprm *prj);
    00697 int sflx2s(PRJX2S_ARGS);
    00698 int sfls2x(PRJS2X_ARGS);
    00699
    00700 int parset(struct prjprm *prj);
    00701 int parx2s(PRJX2S_ARGS);
    00702 int pars2x(PRJS2X_ARGS);
    00703
    00704 int molset(struct prjprm *prj);
    00705 int molx2s(PRJX2S_ARGS);
    00706 int mols2x(PRJS2X_ARGS);
    00707
    00708 int aitset(struct prjprm *prj);
    00709 int aitx2s(PRJX2S_ARGS);
    00710 int aits2x(PRJS2X_ARGS);
    00711
    00712 int copset(struct prjprm *prj);
    00713 int copx2s(PRJX2S_ARGS);
    00714 int cops2x(PRJS2X_ARGS);
    00715
    00716 int coeset(struct prjprm *prj);
    00717 int coex2s(PRJX2S_ARGS);
    00718 int coes2x(PRJS2X_ARGS);
    00719
    00720 int codset(struct prjprm *prj);
    00721 int codx2s(PRJX2S_ARGS);
    00722 int cods2x(PRJS2X_ARGS);
    00723
    00724 int cooset(struct prjprm *prj);
    00725 int coox2s(PRJX2S_ARGS);
    00726 int coos2x(PRJS2X_ARGS);
    00727
    00728 int bonset(struct prjprm *prj);
    00729 int bonx2s(PRJX2S_ARGS);
    00730 int bons2x(PRJS2X_ARGS);
    00731
    00732 int pcoset(struct prjprm *prj);
    00733 int pcox2s(PRJX2S_ARGS);
    00734 int pcos2x(PRJS2X_ARGS);
    00735
    00736 int tscset(struct prjprm *prj);
    00737 int tscx2s(PRJX2S_ARGS);
    00738 int tscs2x(PRJS2X_ARGS);
    00739
    00740 int cscset(struct prjprm *prj);
    00741 int cscx2s(PRJX2S_ARGS);
    00742 int cscs2x(PRJS2X_ARGS);
    00743
    00744 int qscset(struct prjprm *prj);
    00745 int qscx2s(PRJX2S_ARGS);
    00746 int qscs2x(PRJS2X_ARGS);
    00747
    00748 int hpxset(struct prjprm *prj);
    00749 int hpxx2s(PRJX2S_ARGS);
    00750 int hpxs2x(PRJS2X_ARGS);
    00751
    00752
    00753 /* Deprecated. */
    00754 #define prjini_errmsg prj_errmsg
    00755 #define prjprt_errmsg prj_errmsg
    00756 #define prjset_errmsg prj_errmsg
    00757 #define prjx2s_errmsg prj_errmsg
    00758 #define prjs2x_errmsg prj_errmsg
    00759
    00760 #ifdef __cplusplus
    00761 }
    00762 #endif
    00763
    00764 #endif /* WCSLIB_PROJ */