- Main Page
- Related Pages
- Data Structures
- Files

# prj.h

Go to the documentation of this file.

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