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