WCSLIB  4.25.1
prj.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  WCSLIB 5.1 - an implementation of the FITS WCS standard.
4  Copyright (C) 1995-2015, Mark Calabretta
5 
6  This file is part of WCSLIB.
7 
8  WCSLIB is free software: you can redistribute it and/or modify it under the
9  terms of the GNU Lesser General Public License as published by the Free
10  Software Foundation, either version 3 of the License, or (at your option)
11  any later version.
12 
13  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
16  more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with WCSLIB. If not, see http://www.gnu.org/licenses.
20 
21  Direct correspondence concerning WCSLIB to mark@calabretta.id.au
22 
23  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
24  http://www.atnf.csiro.au/people/Mark.Calabretta
25  $Id: prj.h,v 5.1 2015/04/07 10:56:36 mcalabre Exp $
26 *=============================================================================
27 *
28 * WCSLIB 5.1 - C routines that implement the spherical map projections
29 * recognized by the FITS World Coordinate System (WCS) standard. Refer to
30 *
31 * "Representations of world coordinates in FITS",
32 * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I)
33 *
34 * "Representations of celestial coordinates in FITS",
35 * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II)
36 *
37 * Refer to the README file provided with WCSLIB for an overview of the
38 * library.
39 *
40 *
41 * Summary of the prj routines
42 * ---------------------------
43 * These routines implement the spherical map projections defined by the FITS
44 * WCS standard. They are based on the prjprm struct which contains all
45 * information needed for the computations. The struct contains some members
46 * that must be set by the user, and others that are maintained by these
47 * routines, somewhat like a C++ class but with no encapsulation.
48 *
49 * Routine prjini() is provided to initialize the prjprm struct with default
50 * values, prjfree() reclaims any memory that may have been allocated to store
51 * an error message, and prjprt() prints its contents. prjbchk() performs
52 * bounds checking on native spherical coordinates.
53 *
54 * Setup routines for each projection with names of the form ???set(), where
55 * "???" is the down-cased three-letter projection code, compute intermediate
56 * values in the prjprm struct from parameters in it that were supplied by the
57 * user. The struct always needs to be set by the projection's setup routine
58 * but that need not be called explicitly - refer to the explanation of
59 * prjprm::flag.
60 *
61 * Each map projection is implemented via separate functions for the spherical
62 * projection, ???s2x(), and deprojection, ???x2s().
63 *
64 * A set of driver routines, prjset(), prjx2s(), and prjs2x(), provides a
65 * generic interface to the specific projection routines which they invoke
66 * via pointers-to-functions stored in the prjprm struct.
67 *
68 * In summary, the routines are:
69 * - prjini() Initialization routine for the prjprm struct.
70 * - prjfree() Reclaim memory allocated for error messages.
71 * - prjprt() Print the prjprm struct.
72 * - prjbchk() Bounds checking on native coordinates.
73 *
74 * - prjset(), prjx2s(), prjs2x(): Generic driver routines
75 *
76 * - azpset(), azpx2s(), azps2x(): AZP (zenithal/azimuthal perspective)
77 * - szpset(), szpx2s(), szps2x(): SZP (slant zenithal perspective)
78 * - tanset(), tanx2s(), tans2x(): TAN (gnomonic)
79 * - stgset(), stgx2s(), stgs2x(): STG (stereographic)
80 * - sinset(), sinx2s(), sins2x(): SIN (orthographic/synthesis)
81 * - arcset(), arcx2s(), arcs2x(): ARC (zenithal/azimuthal equidistant)
82 * - zpnset(), zpnx2s(), zpns2x(): ZPN (zenithal/azimuthal polynomial)
83 * - zeaset(), zeax2s(), zeas2x(): ZEA (zenithal/azimuthal equal area)
84 * - airset(), airx2s(), airs2x(): AIR (Airy)
85 * - cypset(), cypx2s(), cyps2x(): CYP (cylindrical perspective)
86 * - ceaset(), ceax2s(), ceas2x(): CEA (cylindrical equal area)
87 * - carset(), carx2s(), cars2x(): CAR (Plate carree)
88 * - merset(), merx2s(), mers2x(): MER (Mercator)
89 * - sflset(), sflx2s(), sfls2x(): SFL (Sanson-Flamsteed)
90 * - parset(), parx2s(), pars2x(): PAR (parabolic)
91 * - molset(), molx2s(), mols2x(): MOL (Mollweide)
92 * - aitset(), aitx2s(), aits2x(): AIT (Hammer-Aitoff)
93 * - copset(), copx2s(), cops2x(): COP (conic perspective)
94 * - coeset(), coex2s(), coes2x(): COE (conic equal area)
95 * - codset(), codx2s(), cods2x(): COD (conic equidistant)
96 * - cooset(), coox2s(), coos2x(): COO (conic orthomorphic)
97 * - bonset(), bonx2s(), bons2x(): BON (Bonne)
98 * - pcoset(), pcox2s(), pcos2x(): PCO (polyconic)
99 * - tscset(), tscx2s(), tscs2x(): TSC (tangential spherical cube)
100 * - cscset(), cscx2s(), cscs2x(): CSC (COBE spherical cube)
101 * - qscset(), qscx2s(), qscs2x(): QSC (quadrilateralized spherical cube)
102 * - hpxset(), hpxx2s(), hpxs2x(): HPX (HEALPix)
103 * - xphset(), xphx2s(), xphs2x(): XPH (HEALPix polar, aka "butterfly")
104 *
105 * Argument checking (projection routines):
106 * ----------------------------------------
107 * The values of phi and theta (the native longitude and latitude) normally lie
108 * in the range [-180,180] for phi, and [-90,90] for theta. However, all
109 * projection routines will accept any value of phi and will not normalize it.
110 *
111 * The projection routines do not explicitly check that theta lies within the
112 * range [-90,90]. They do check for any value of theta that produces an
113 * invalid argument to the projection equations (e.g. leading to division by
114 * zero). The projection routines for AZP, SZP, TAN, SIN, ZPN, and COP also
115 * return error 2 if (phi,theta) corresponds to the overlapped (far) side of
116 * the projection but also return the corresponding value of (x,y). This
117 * strict bounds checking may be relaxed at any time by setting
118 * prjprm::bounds%2 to 0 (rather than 1); the projections need not be
119 * reinitialized.
120 *
121 * Argument checking (deprojection routines):
122 * ------------------------------------------
123 * Error checking on the projected coordinates (x,y) is limited to that
124 * required to ascertain whether a solution exists. Where a solution does
125 * exist, an optional check is made that the value of phi and theta obtained
126 * lie within the ranges [-180,180] for phi, and [-90,90] for theta. This
127 * check, performed by prjbchk(), is enabled by default. It may be disabled by
128 * setting prjprm::bounds%4 to 0 (rather than 1); the projections need not be
129 * reinitialized.
130 *
131 * Accuracy:
132 * ---------
133 * No warranty is given for the accuracy of these routines (refer to the
134 * copyright notice); intending users must satisfy for themselves their
135 * adequacy for the intended purpose. However, closure to a precision of at
136 * least 1E-10 degree of longitude and latitude has been verified for typical
137 * projection parameters on the 1 degree graticule of native longitude and
138 * latitude (to within 5 degrees of any latitude where the projection may
139 * diverge). Refer to the tprj1.c and tprj2.c test routines that accompany
140 * this software.
141 *
142 *
143 * prjini() - Default constructor for the prjprm struct
144 * ----------------------------------------------------
145 * prjini() sets all members of a prjprm struct to default values. It should
146 * be used to initialize every prjprm struct.
147 *
148 * Returned:
149 * prj struct prjprm*
150 * Projection parameters.
151 *
152 * Function return value:
153 * int Status return value:
154 * 0: Success.
155 * 1: Null prjprm pointer passed.
156 *
157 *
158 * prjfree() - Destructor for the prjprm struct
159 * --------------------------------------------
160 * prjfree() frees any memory that may have been allocated to store an error
161 * message in the prjprm struct.
162 *
163 * Given:
164 * prj struct prjprm*
165 * Projection parameters.
166 *
167 * Function return value:
168 * int Status return value:
169 * 0: Success.
170 * 1: Null prjprm pointer passed.
171 *
172 *
173 * prjprt() - Print routine for the prjprm struct
174 * ----------------------------------------------
175 * prjprt() prints the contents of a prjprm struct using wcsprintf(). Mainly
176 * intended for diagnostic purposes.
177 *
178 * Given:
179 * prj const struct prjprm*
180 * Projection parameters.
181 *
182 * Function return value:
183 * int Status return value:
184 * 0: Success.
185 * 1: Null prjprm pointer passed.
186 *
187 *
188 * prjbchk() - Bounds checking on native coordinates
189 * -------------------------------------------------
190 * prjbchk() performs bounds checking on native spherical coordinates. As
191 * returned by the deprojection (x2s) routines, native longitude is expected
192 * to lie in the closed interval [-180,180], with latitude in [-90,90].
193 *
194 * A tolerance may be specified to provide a small allowance for numerical
195 * imprecision. Values that lie outside the allowed range by not more than
196 * the specified tolerance will be adjusted back into range.
197 *
198 * If prjprm::bounds&4 is set, as it is by prjini(), then prjbchk() will be
199 * invoked automatically by the Cartesian-to-spherical deprojection (x2s)
200 * routines with an appropriate tolerance set for each projection.
201 *
202 * Given:
203 * tol double Tolerance for the bounds check [deg].
204 *
205 * nphi,
206 * ntheta int Vector lengths.
207 *
208 * spt int Vector stride.
209 *
210 * Given and returned:
211 * phi,theta double[] Native longitude and latitude (phi,theta) [deg].
212 *
213 * Returned:
214 * stat int[] Status value for each vector element:
215 * 0: Valid value of (phi,theta).
216 * 1: Invalid value.
217 *
218 * Function return value:
219 * int Status return value:
220 * 0: Success.
221 * 1: One or more of the (phi,theta) coordinates
222 * were, invalid, as indicated by the stat vector.
223 *
224 *
225 * prjset() - Generic setup routine for the prjprm struct
226 * ------------------------------------------------------
227 * prjset() sets up a prjprm struct according to information supplied within
228 * it.
229 *
230 * Note that this routine need not be called directly; it will be invoked by
231 * prjx2s() and prjs2x() if prj.flag is anything other than a predefined magic
232 * value.
233 *
234 * The one important distinction between prjset() and the setup routines for
235 * the specific projections is that the projection code must be defined in the
236 * prjprm struct in order for prjset() to identify the required projection.
237 * Once prjset() has initialized the prjprm struct, prjx2s() and prjs2x() use
238 * the pointers to the specific projection and deprojection routines contained
239 * therein.
240 *
241 * Given and returned:
242 * prj struct prjprm*
243 * Projection parameters.
244 *
245 * Function return value:
246 * int Status return value:
247 * 0: Success.
248 * 1: Null prjprm pointer passed.
249 * 2: Invalid projection parameters.
250 *
251 * For returns > 1, a detailed error message is set in
252 * prjprm::err if enabled, see wcserr_enable().
253 *
254 *
255 * prjx2s() - Generic Cartesian-to-spherical deprojection
256 * ------------------------------------------------------
257 * Deproject Cartesian (x,y) coordinates in the plane of projection to native
258 * spherical coordinates (phi,theta).
259 *
260 * The projection is that specified by prjprm::code.
261 *
262 * Given and returned:
263 * prj struct prjprm*
264 * Projection parameters.
265 *
266 * Given:
267 * nx,ny int Vector lengths.
268 *
269 * sxy,spt int Vector strides.
270 *
271 * x,y const double[]
272 * Projected coordinates.
273 *
274 * Returned:
275 * phi,theta double[] Longitude and latitude (phi,theta) of the projected
276 * point in native spherical coordinates [deg].
277 *
278 * stat int[] Status value for each vector element:
279 * 0: Success.
280 * 1: Invalid value of (x,y).
281 *
282 * Function return value:
283 * int Status return value:
284 * 0: Success.
285 * 1: Null prjprm pointer passed.
286 * 2: Invalid projection parameters.
287 * 3: One or more of the (x,y) coordinates were
288 * invalid, as indicated by the stat vector.
289 *
290 * For returns > 1, a detailed error message is set in
291 * prjprm::err if enabled, see wcserr_enable().
292 *
293 *
294 * prjs2x() - Generic spherical-to-Cartesian projection
295 * ----------------------------------------------------
296 * Project native spherical coordinates (phi,theta) to Cartesian (x,y)
297 * coordinates in the plane of projection.
298 *
299 * The projection is that specified by prjprm::code.
300 *
301 * Given and returned:
302 * prj struct prjprm*
303 * Projection parameters.
304 *
305 * Given:
306 * nphi,
307 * ntheta int Vector lengths.
308 *
309 * spt,sxy int Vector strides.
310 *
311 * phi,theta const double[]
312 * Longitude and latitude (phi,theta) of the projected
313 * point in native spherical coordinates [deg].
314 *
315 * Returned:
316 * x,y double[] Projected coordinates.
317 *
318 * stat int[] Status value for each vector element:
319 * 0: Success.
320 * 1: Invalid value of (phi,theta).
321 *
322 * Function return value:
323 * int Status return value:
324 * 0: Success.
325 * 1: Null prjprm pointer passed.
326 * 2: Invalid projection parameters.
327 * 4: One or more of the (phi,theta) coordinates
328 * were, invalid, as indicated by the stat vector.
329 *
330 * For returns > 1, a detailed error message is set in
331 * prjprm::err if enabled, see wcserr_enable().
332 *
333 *
334 * ???set() - Specific setup routines for the prjprm struct
335 * --------------------------------------------------------
336 * Set up a prjprm struct for a particular projection according to information
337 * supplied within it.
338 *
339 * Given and returned:
340 * prj struct prjprm*
341 * Projection parameters.
342 *
343 * Function return value:
344 * int Status return value:
345 * 0: Success.
346 * 1: Null prjprm pointer passed.
347 * 2: Invalid projection parameters.
348 *
349 * For returns > 1, a detailed error message is set in
350 * prjprm::err if enabled, see wcserr_enable().
351 *
352 *
353 * ???x2s() - Specific Cartesian-to-spherical deprojection routines
354 * ----------------------------------------------------------------
355 * Transform (x,y) coordinates in the plane of projection to native spherical
356 * coordinates (phi,theta).
357 *
358 * Given and returned:
359 * prj struct prjprm*
360 * Projection parameters.
361 *
362 * Given:
363 * nx,ny int Vector lengths.
364 *
365 * sxy,spt int Vector strides.
366 *
367 * x,y const double[]
368 * Projected coordinates.
369 *
370 * Returned:
371 * phi,theta double[] Longitude and latitude of the projected point in
372 * native spherical coordinates [deg].
373 *
374 * stat int[] Status value for each vector element:
375 * 0: Success.
376 * 1: Invalid value of (x,y).
377 *
378 * Function return value:
379 * int Status return value:
380 * 0: Success.
381 * 1: Null prjprm pointer passed.
382 * 2: Invalid projection parameters.
383 * 3: One or more of the (x,y) coordinates were
384 * invalid, as indicated by the stat vector.
385 *
386 * For returns > 1, a detailed error message is set in
387 * prjprm::err if enabled, see wcserr_enable().
388 *
389 *
390 * ???s2x() - Specific spherical-to-Cartesian projection routines
391 *---------------------------------------------------------------
392 * Transform native spherical coordinates (phi,theta) to (x,y) coordinates in
393 * the plane of projection.
394 *
395 * Given and returned:
396 * prj struct prjprm*
397 * Projection parameters.
398 *
399 * Given:
400 * nphi,
401 * ntheta int Vector lengths.
402 *
403 * spt,sxy int Vector strides.
404 *
405 * phi,theta const double[]
406 * Longitude and latitude of the projected point in
407 * native spherical coordinates [deg].
408 *
409 * Returned:
410 * x,y double[] Projected coordinates.
411 *
412 * stat int[] Status value for each vector element:
413 * 0: Success.
414 * 1: Invalid value of (phi,theta).
415 *
416 * Function return value:
417 * int Status return value:
418 * 0: Success.
419 * 1: Null prjprm pointer passed.
420 * 2: Invalid projection parameters.
421 * 4: One or more of the (phi,theta) coordinates
422 * were, invalid, as indicated by the stat vector.
423 *
424 * For returns > 1, a detailed error message is set in
425 * prjprm::err if enabled, see wcserr_enable().
426 *
427 *
428 * prjprm struct - Projection parameters
429 * -------------------------------------
430 * The prjprm struct contains all information needed to project or deproject
431 * native spherical coordinates. It consists of certain members that must be
432 * set by the user ("given") and others that are set by the WCSLIB routines
433 * ("returned"). Some of the latter are supplied for informational purposes
434 * while others are for internal use only.
435 *
436 * int flag
437 * (Given and returned) This flag must be set to zero whenever any of the
438 * following prjprm struct members are set or changed:
439 *
440 * - prjprm::code,
441 * - prjprm::r0,
442 * - prjprm::pv[],
443 * - prjprm::phi0,
444 * - prjprm::theta0.
445 *
446 * This signals the initialization routine (prjset() or ???set()) to
447 * recompute the returned members of the prjprm struct. flag will then be
448 * reset to indicate that this has been done.
449 *
450 * Note that flag need not be reset when prjprm::bounds is changed.
451 *
452 * char code[4]
453 * (Given) Three-letter projection code defined by the FITS standard.
454 *
455 * double r0
456 * (Given) The radius of the generating sphere for the projection, a linear
457 * scaling parameter. If this is zero, it will be reset to its default
458 * value of 180/pi (the value for FITS WCS).
459 *
460 * double pv[30]
461 * (Given) Projection parameters. These correspond to the PVi_ma keywords
462 * in FITS, so pv[0] is PVi_0a, pv[1] is PVi_1a, etc., where i denotes the
463 * latitude-like axis. Many projections use pv[1] (PVi_1a), some also use
464 * pv[2] (PVi_2a) and SZP uses pv[3] (PVi_3a). ZPN is currently the only
465 * projection that uses any of the others.
466 *
467 * Usage of the pv[] array as it applies to each projection is described in
468 * the prologue to each trio of projection routines in prj.c.
469 *
470 * double phi0
471 * (Given) The native longitude, phi_0 [deg], and ...
472 * double theta0
473 * (Given) ... the native latitude, theta_0 [deg], of the reference point,
474 * i.e. the point (x,y) = (0,0). If undefined (set to a magic value by
475 * prjini()) the initialization routine will set this to a
476 * projection-specific default.
477 *
478 * int bounds
479 * (Given) Controls bounds checking. If bounds&1 then enable strict bounds
480 * checking for the spherical-to-Cartesian (s2x) transformation for the
481 * AZP, SZP, TAN, SIN, ZPN, and COP projections. If bounds&2 then enable
482 * strict bounds checking for the Cartesian-to-spherical transformation
483 * (x2s) for the HPX and XPH projections. If bounds&4 then the Cartesian-
484 * to-spherical transformations (x2s) will invoke prjbchk() to perform
485 * bounds checking on the computed native coordinates, with a tolerance set
486 * to suit each projection. bounds is set to 7 by prjini() by default
487 * which enables all checks. Zero it to disable all checking.
488 *
489 * It is not necessary to reset the prjprm struct (via prjset() or
490 * ???set()) when prjprm::bounds is changed.
491 *
492 * The remaining members of the prjprm struct are maintained by the setup
493 * routines and must not be modified elsewhere:
494 *
495 * char name[40]
496 * (Returned) Long name of the projection.
497 *
498 * Provided for information only, not used by the projection routines.
499 *
500 * int category
501 * (Returned) Projection category matching the value of the relevant global
502 * variable:
503 *
504 * - ZENITHAL,
505 * - CYLINDRICAL,
506 * - PSEUDOCYLINDRICAL,
507 * - CONVENTIONAL,
508 * - CONIC,
509 * - POLYCONIC,
510 * - QUADCUBE, and
511 * - HEALPIX.
512 *
513 * The category name may be identified via the prj_categories character
514 * array, e.g.
515 *
516 = struct prjprm prj;
517 = ...
518 = printf("%s\n", prj_categories[prj.category]);
519 *
520 * Provided for information only, not used by the projection routines.
521 *
522 * int pvrange
523 * (Returned) Range of projection parameter indices: 100 times the first
524 * allowed index plus the number of parameters, e.g. TAN is 0 (no
525 * parameters), SZP is 103 (1 to 3), and ZPN is 30 (0 to 29).
526 *
527 * Provided for information only, not used by the projection routines.
528 *
529 * int simplezen
530 * (Returned) True if the projection is a radially-symmetric zenithal
531 * projection.
532 *
533 * Provided for information only, not used by the projection routines.
534 *
535 * int equiareal
536 * (Returned) True if the projection is equal area.
537 *
538 * Provided for information only, not used by the projection routines.
539 *
540 * int conformal
541 * (Returned) True if the projection is conformal.
542 *
543 * Provided for information only, not used by the projection routines.
544 *
545 * int global
546 * (Returned) True if the projection can represent the whole sphere in a
547 * finite, non-overlapped mapping.
548 *
549 * Provided for information only, not used by the projection routines.
550 *
551 * int divergent
552 * (Returned) True if the projection diverges in latitude.
553 *
554 * Provided for information only, not used by the projection routines.
555 *
556 * double x0
557 * (Returned) The offset in x, and ...
558 * double y0
559 * (Returned) ... the offset in y used to force (x,y) = (0,0) at
560 * (phi_0,theta_0).
561 *
562 * struct wcserr *err
563 * (Returned) If enabled, when an error status is returned, this struct
564 * contains detailed information about the error, see wcserr_enable().
565 *
566 * void *padding
567 * (An unused variable inserted for alignment purposes only.)
568 *
569 * double w[10]
570 * (Returned) Intermediate floating-point values derived from the
571 * projection parameters, cached here to save recomputation.
572 *
573 * Usage of the w[] array as it applies to each projection is described in
574 * the prologue to each trio of projection routines in prj.c.
575 *
576 * int n
577 * (Returned) Intermediate integer value (used only for the ZPN and HPX
578 * projections).
579 *
580 * int (*prjx2s)(PRJX2S_ARGS)
581 * (Returned) Pointer to the spherical projection ...
582 * int (*prjs2x)(PRJ_ARGS)
583 * (Returned) ... and deprojection routines.
584 *
585 *
586 * Global variable: const char *prj_errmsg[] - Status return messages
587 * ------------------------------------------------------------------
588 * Error messages to match the status value returned from each function.
589 *
590 *===========================================================================*/
591 
592 #ifndef WCSLIB_PROJ
593 #define WCSLIB_PROJ
594 
595 #ifdef __cplusplus
596 extern "C" {
597 #endif
598 
599 
600 /* Total number of projection parameters; 0 to PVN-1. */
601 #define PVN 30
602 
603 extern const char *prj_errmsg[];
604 
606  PRJERR_SUCCESS = 0, /* Success. */
607  PRJERR_NULL_POINTER = 1, /* Null prjprm pointer passed. */
608  PRJERR_BAD_PARAM = 2, /* Invalid projection parameters. */
609  PRJERR_BAD_PIX = 3, /* One or more of the (x, y) coordinates were
610  invalid. */
611  PRJERR_BAD_WORLD = 4 /* One or more of the (phi, theta) coordinates
612  were invalid. */
613 };
614 
615 extern const int CONIC, CONVENTIONAL, CYLINDRICAL, POLYCONIC,
617 extern const char prj_categories[9][32];
618 
619 extern const int prj_ncode;
620 extern const char prj_codes[28][4];
621 
622 #ifdef PRJX2S_ARGS
623 #undef PRJX2S_ARGS
624 #endif
625 
626 #ifdef PRJS2X_ARGS
627 #undef PRJS2X_ARGS
628 #endif
629 
630 /* For use in declaring deprojection function prototypes. */
631 #define PRJX2S_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \
632 const double x[], const double y[], double phi[], double theta[], int stat[]
633 
634 /* For use in declaring projection function prototypes. */
635 #define PRJS2X_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \
636 const double phi[], const double theta[], double x[], double y[], int stat[]
637 
638 
639 struct prjprm {
640  /* Initialization flag (see the prologue above). */
641  /*------------------------------------------------------------------------*/
642  int flag; /* Set to zero to force initialization. */
643 
644  /* Parameters to be provided (see the prologue above). */
645  /*------------------------------------------------------------------------*/
646  char code[4]; /* Three-letter projection code. */
647  double r0; /* Radius of the generating sphere. */
648  double pv[PVN]; /* Projection parameters. */
649  double phi0, theta0; /* Fiducial native coordinates. */
650  int bounds; /* Controls bounds checking. */
651 
652  /* Information derived from the parameters supplied. */
653  /*------------------------------------------------------------------------*/
654  char name[40]; /* Projection name. */
655  int category; /* Projection category. */
656  int pvrange; /* Range of projection parameter indices. */
657  int simplezen; /* Is it a simple zenithal projection? */
658  int equiareal; /* Is it an equal area projection? */
659  int conformal; /* Is it a conformal projection? */
660  int global; /* Can it map the whole sphere? */
661  int divergent; /* Does the projection diverge in latitude? */
662  double x0, y0; /* Fiducial offsets. */
663 
664  /* Error handling */
665  /*------------------------------------------------------------------------*/
666  struct wcserr *err;
667 
668  /* Private */
669  /*------------------------------------------------------------------------*/
670  void *padding; /* (Dummy inserted for alignment purposes.) */
671  double w[10]; /* Intermediate values. */
672  int m, n; /* Intermediate values. */
673 
674  int (*prjx2s)(PRJX2S_ARGS); /* Pointers to the spherical projection and */
675  int (*prjs2x)(PRJS2X_ARGS); /* deprojection functions. */
676 };
677 
678 /* Size of the prjprm struct in int units, used by the Fortran wrappers. */
679 #define PRJLEN (sizeof(struct prjprm)/sizeof(int))
680 
681 
682 /* Use the preprocessor to help declare function prototypes (see above). */
683 int prjini(struct prjprm *prj);
684 int prjfree(struct prjprm *prj);
685 int prjprt(const struct prjprm *prj);
686 int prjbchk(double tol, int nx, int ny, int spt, double phi[], double theta[],
687  int stat[]);
688 
689 int prjset(struct prjprm *prj);
690 int prjx2s(PRJX2S_ARGS);
691 int prjs2x(PRJS2X_ARGS);
692 
693 int azpset(struct prjprm *prj);
694 int azpx2s(PRJX2S_ARGS);
695 int azps2x(PRJS2X_ARGS);
696 
697 int szpset(struct prjprm *prj);
698 int szpx2s(PRJX2S_ARGS);
699 int szps2x(PRJS2X_ARGS);
700 
701 int tanset(struct prjprm *prj);
702 int tanx2s(PRJX2S_ARGS);
703 int tans2x(PRJS2X_ARGS);
704 
705 int stgset(struct prjprm *prj);
706 int stgx2s(PRJX2S_ARGS);
707 int stgs2x(PRJS2X_ARGS);
708 
709 int sinset(struct prjprm *prj);
710 int sinx2s(PRJX2S_ARGS);
711 int sins2x(PRJS2X_ARGS);
712 
713 int arcset(struct prjprm *prj);
714 int arcx2s(PRJX2S_ARGS);
715 int arcs2x(PRJS2X_ARGS);
716 
717 int zpnset(struct prjprm *prj);
718 int zpnx2s(PRJX2S_ARGS);
719 int zpns2x(PRJS2X_ARGS);
720 
721 int zeaset(struct prjprm *prj);
722 int zeax2s(PRJX2S_ARGS);
723 int zeas2x(PRJS2X_ARGS);
724 
725 int airset(struct prjprm *prj);
726 int airx2s(PRJX2S_ARGS);
727 int airs2x(PRJS2X_ARGS);
728 
729 int cypset(struct prjprm *prj);
730 int cypx2s(PRJX2S_ARGS);
731 int cyps2x(PRJS2X_ARGS);
732 
733 int ceaset(struct prjprm *prj);
734 int ceax2s(PRJX2S_ARGS);
735 int ceas2x(PRJS2X_ARGS);
736 
737 int carset(struct prjprm *prj);
738 int carx2s(PRJX2S_ARGS);
739 int cars2x(PRJS2X_ARGS);
740 
741 int merset(struct prjprm *prj);
742 int merx2s(PRJX2S_ARGS);
743 int mers2x(PRJS2X_ARGS);
744 
745 int sflset(struct prjprm *prj);
746 int sflx2s(PRJX2S_ARGS);
747 int sfls2x(PRJS2X_ARGS);
748 
749 int parset(struct prjprm *prj);
750 int parx2s(PRJX2S_ARGS);
751 int pars2x(PRJS2X_ARGS);
752 
753 int molset(struct prjprm *prj);
754 int molx2s(PRJX2S_ARGS);
755 int mols2x(PRJS2X_ARGS);
756 
757 int aitset(struct prjprm *prj);
758 int aitx2s(PRJX2S_ARGS);
759 int aits2x(PRJS2X_ARGS);
760 
761 int copset(struct prjprm *prj);
762 int copx2s(PRJX2S_ARGS);
763 int cops2x(PRJS2X_ARGS);
764 
765 int coeset(struct prjprm *prj);
766 int coex2s(PRJX2S_ARGS);
767 int coes2x(PRJS2X_ARGS);
768 
769 int codset(struct prjprm *prj);
770 int codx2s(PRJX2S_ARGS);
771 int cods2x(PRJS2X_ARGS);
772 
773 int cooset(struct prjprm *prj);
774 int coox2s(PRJX2S_ARGS);
775 int coos2x(PRJS2X_ARGS);
776 
777 int bonset(struct prjprm *prj);
778 int bonx2s(PRJX2S_ARGS);
779 int bons2x(PRJS2X_ARGS);
780 
781 int pcoset(struct prjprm *prj);
782 int pcox2s(PRJX2S_ARGS);
783 int pcos2x(PRJS2X_ARGS);
784 
785 int tscset(struct prjprm *prj);
786 int tscx2s(PRJX2S_ARGS);
787 int tscs2x(PRJS2X_ARGS);
788 
789 int cscset(struct prjprm *prj);
790 int cscx2s(PRJX2S_ARGS);
791 int cscs2x(PRJS2X_ARGS);
792 
793 int qscset(struct prjprm *prj);
794 int qscx2s(PRJX2S_ARGS);
795 int qscs2x(PRJS2X_ARGS);
796 
797 int hpxset(struct prjprm *prj);
798 int hpxx2s(PRJX2S_ARGS);
799 int hpxs2x(PRJS2X_ARGS);
800 
801 int xphset(struct prjprm *prj);
802 int xphx2s(PRJX2S_ARGS);
803 int xphs2x(PRJS2X_ARGS);
804 
805 
806 /* Deprecated. */
807 #define prjini_errmsg prj_errmsg
808 #define prjprt_errmsg prj_errmsg
809 #define prjset_errmsg prj_errmsg
810 #define prjx2s_errmsg prj_errmsg
811 #define prjs2x_errmsg prj_errmsg
812 
813 #ifdef __cplusplus
814 }
815 #endif
816 
817 #endif /* WCSLIB_PROJ */
int sinx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the orthographic/synthesis (SIN) projection.
int cars2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the plate carrée (CAR) projection.
int molset(struct prjprm *prj)
Set up a prjprm struct for Mollweide's (MOL) projection.
int stgset(struct prjprm *prj)
Set up a prjprm struct for the stereographic (STG) projection.
int tanset(struct prjprm *prj)
Set up a prjprm struct for the gnomonic (TAN) projection.
int prjprt(const struct prjprm *prj)
Print routine for the prjprm struct.
const int CONVENTIONAL
Identifier for conventional projections.
int arcx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the zenithal/azimuthal equidistant (ARC) projection...
int arcset(struct prjprm *prj)
Set up a prjprm struct for the zenithal/azimuthal equidistant (ARC) projection.
int bonx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for Bonne's (BON) projection.
int simplezen
Definition: prj.h:657
int coeset(struct prjprm *prj)
Set up a prjprm struct for the conic equal area (COE) projection.
Error message handling.
Definition: wcserr.h:221
int equiareal
Definition: prj.h:658
int sflset(struct prjprm *prj)
Set up a prjprm struct for the Sanson-Flamsteed (SFL) projection.
int bons2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for Bonne's (BON) projection.
int m
Definition: prj.h:672
const char prj_categories[9][32]
Projection categories.
int copset(struct prjprm *prj)
Set up a prjprm struct for the conic perspective (COP) projection.
int tanx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the gnomonic (TAN) projection.
int airx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for Airy's (AIR) projection.
int xphs2x(PRJS2X_ARGS)
prj_errmsg_enum
Definition: prj.h:605
int stgx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the stereographic (STG) projection.
const char prj_codes[28][4]
Recognized three-letter projection codes.
int szpset(struct prjprm *prj)
Set up a prjprm struct for the slant zenithal perspective (SZP) projection.
int aits2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the Hammer-Aitoff (AIT) projection.
int cooset(struct prjprm *prj)
Set up a prjprm struct for the conic orthomorphic (COO) projection.
int zpns2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the zenithal/azimuthal polynomial (ZPN) projection...
int merx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for Mercator's (MER) projection.
int merset(struct prjprm *prj)
Set up a prjprm struct for Mercator's (MER) projection.
int parx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the parabolic (PAR) projection.
int coes2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the conic equal area (COE) projection.
Definition: prj.h:611
Definition: prj.h:608
int carx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the plate carrée (CAR) projection.
void * padding
Definition: prj.h:670
double pv[PVN]
Definition: prj.h:648
int(* prjs2x)(PRJS2X_ARGS)
Definition: prj.h:675
int cypx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the cylindrical perspective (CYP) projection.
int cscset(struct prjprm *prj)
Set up a prjprm struct for the COBE spherical cube (CSC) projection.
int category
Definition: prj.h:655
int aitset(struct prjprm *prj)
Set up a prjprm struct for the Hammer-Aitoff (AIT) projection.
const int CYLINDRICAL
Identifier for cylindrical projections.
int cops2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the conic perspective (COP) projection. ...
int pcox2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the polyconic (PCO) projection.
int prjfree(struct prjprm *prj)
Destructor for the prjprm struct.
int carset(struct prjprm *prj)
Set up a prjprm struct for the plate carrée (CAR) projection.
int xphx2s(PRJX2S_ARGS)
int tscset(struct prjprm *prj)
Set up a prjprm struct for the tangential spherical cube (TSC) projection.
int prjs2x(PRJS2X_ARGS)
Generic spherical-to-Cartesian projection.
int cscx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the COBE spherical cube (CSC) projection.
int airset(struct prjprm *prj)
Set up a prjprm struct for Airy's (AIR) projection.
int cscs2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the COBE spherical cube (CSC) projection.
Projection parameters.
Definition: prj.h:639
int pcos2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the polyconic (PCO) projection.
int szps2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the slant zenithal perspective (SZP) projection.
int zeax2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the zenithal/azimuthal equal area (ZEA) projection...
int qscx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the quadrilateralized spherical cube (QSC) projection...
double phi0
Definition: prj.h:649
double r0
Definition: prj.h:647
const int POLYCONIC
Identifier for polyconic projections.
int qscset(struct prjprm *prj)
Set up a prjprm struct for the quadrilateralized spherical cube (QSC) projection. ...
int prjbchk(double tol, int nx, int ny, int spt, double phi[], double theta[], int stat[])
Bounds checking on native coordinates.
int zeaset(struct prjprm *prj)
Set up a prjprm struct for the zenithal/azimuthal equal area (ZEA) projection.
int sinset(struct prjprm *prj)
Set up a prjprm struct for the orthographic/synthesis (SIN) projection.
char code[4]
Definition: prj.h:646
int(* prjx2s)(PRJX2S_ARGS)
Definition: prj.h:674
#define PRJS2X_ARGS
For use in declaring projection function prototypes.
Definition: prj.h:635
int hpxset(struct prjprm *prj)
Set up a prjprm struct for the HEALPix (HPX) projection.
const int QUADCUBE
Identifier for quadcube projections.
int sflx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the Sanson-Flamsteed (SFL) projection.
const char * prj_errmsg[]
Status return messages.
const int prj_ncode
The number of recognized three-letter projection codes.
int zeas2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the zenithal/azimuthal equal area (ZEA) projection...
int airs2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for Airy's (AIR) projection.
int tscx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the tangential spherical cube (TSC) projection.
char name[40]
Definition: prj.h:654
int copx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the conic perspective (COP) projection. ...
double x0
Definition: prj.h:662
int cods2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the conic equidistant (COD) projection. ...
int prjset(struct prjprm *prj)
Generic setup routine for the prjprm struct.
int conformal
Definition: prj.h:659
int pvrange
Definition: prj.h:656
int sins2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the orthographic/synthesis (SIN) projection.
const int CONIC
Identifier for conic projections.
int cyps2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the cylindrical perspective (CYP) projection.
int arcs2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the zenithal/azimuthal equidistant (ARC) projection...
double w[10]
Definition: prj.h:671
int n
Definition: prj.h:672
const int HEALPIX
Identifier for the HEALPix projection.
int mers2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for Mercator's (MER) projection.
int codset(struct prjprm *prj)
Set up a prjprm struct for the conic equidistant (COD) projection.
int tscs2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the tangential spherical cube (TSC) projection.
const int ZENITHAL
Identifier for zenithal/azimuthal projections.
int coox2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the conic orthomorphic (COO) projection.
int qscs2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the quadrilateralized spherical cube (QSC) projection...
int hpxx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the HEALPix (HPX) projection.
int bonset(struct prjprm *prj)
Set up a prjprm struct for Bonne's (BON) projection.
int coex2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the conic equal area (COE) projection.
int xphset(struct prjprm *prj)
const int PSEUDOCYLINDRICAL
Identifier for pseudocylindrical projections.
Definition: prj.h:607
int szpx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the slant zenithal perspective (SZP) projection.
#define PVN
Total number of projection parameters.
Definition: prj.h:601
Definition: prj.h:609
int ceas2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the cylindrical equal area (CEA) projection.
double y0
Definition: prj.h:662
int coos2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the conic orthomorphic (COO) projection.
int aitx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the Hammer-Aitoff (AIT) projection.
int zpnset(struct prjprm *prj)
Set up a prjprm struct for the zenithal/azimuthal polynomial (ZPN) projection.
int sfls2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the Sanson-Flamsteed (SFL) projection.
int mols2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for Mollweide's (MOL) projection.
int global
Definition: prj.h:660
int pcoset(struct prjprm *prj)
Set up a prjprm struct for the polyconic (PCO) projection.
int ceaset(struct prjprm *prj)
Set up a prjprm struct for the cylindrical equal area (CEA) projection.
int prjini(struct prjprm *prj)
Default constructor for the prjprm struct.
int bounds
Definition: prj.h:650
struct wcserr * err
Definition: prj.h:666
int tans2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the gnomonic (TAN) projection.
int azpset(struct prjprm *prj)
Set up a prjprm struct for the zenithal/azimuthal perspective (AZP) projection.
int flag
Definition: prj.h:642
int parset(struct prjprm *prj)
Set up a prjprm struct for the parabolic (PAR) projection.
int azps2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the zenithal/azimuthal perspective (AZP) projection...
int stgs2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the stereographic (STG) projection.
int ceax2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the cylindrical equal area (CEA) projection.
int hpxs2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the HEALPix (HPX) projection.
int zpnx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the zenithal/azimuthal polynomial (ZPN) projection...
int azpx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the zenithal/azimuthal perspective (AZP) projection...
int prjx2s(PRJX2S_ARGS)
Generic Cartesian-to-spherical deprojection.
int molx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for Mollweide's (MOL) projection.
Definition: prj.h:606
#define PRJX2S_ARGS
For use in declaring deprojection function prototypes.
Definition: prj.h:631
double theta0
Definition: prj.h:649
int divergent
Definition: prj.h:661
int pars2x(PRJS2X_ARGS)
Spherical-to-Cartesian transformation for the parabolic (PAR) projection.
int cypset(struct prjprm *prj)
Set up a prjprm struct for the cylindrical perspective (CYP) projection.
int codx2s(PRJX2S_ARGS)
Cartesian-to-spherical transformation for the conic equidistant (COD) projection. ...