Subject: worldpos.c -- WCS Algorithms from Classic AIPS

From: dwells at nrao.edu (Don Wells)
Date: Thu, 13 Oct 1994 21:15:51 GMT

I am pleased to announce the availability of URL

    ftp://fits.cv.nrao.edu/fits/src/wcs/worldpos.tar.gz

                 16489 Oct 13 17:04 worldpos.tar.gz

This is the code which was mentioned during the FITS-WCS BOF at ADASS'94.
The tar file contains:

tar tvf worldpos.tar
rwxr-xr-x106/16      0 Oct 13 17:04 1994 worldpos/
rw-r--r--106/16  17535 Oct 13 16:01 1994 worldpos/worldpos.c
rw-r--r--106/16   5143 Oct 13 16:23 1994 worldpos/testpos.c
rw-r--r--106/16   2721 Oct 13 17:04 1994 worldpos/testpos.ref
rw-r--r--106/16  25265 Oct 10 16:46 1994 worldpos/COPYING.LIB-2.0
rw-r--r--106/16   2277 Oct 13 16:31 1994 worldpos/Makefile

I append selected text from file worldpos.c.

    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

/*  worldpos.c -- WCS Algorithms from Classic AIPS.
    Copyright (C) 1994
    Associated Universities, Inc. Washington DC, USA.
   
    This library is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License..

    These two ANSI C functions, worldpos() and xypix(), perform
    forward and reverse WCS computations for 8 types of projective
    geometries ("-SIN", "-TAN", "-ARC", "-NCP", "-GLS", "-MER", "-AIT"
    and "-STG"):

        worldpos() converts from pixel location to RA,Dec 
        xypix()    converts from RA,Dec         to pixel location   

    where "(RA,Dec)" are more generically (long,lat). These functions
    are based on the WCS implementation of Classic AIPS, an
    implementation which has been in production use for more than ten
    years. See the two memos by Eric Greisen

        ftp://fits.cv.nrao.edu/fits/documents/wcs/aips27.ps.Z
	ftp://fits.cv.nrao.edu/fits/documents/wcs/aips46.ps.Z

    for descriptions of the 8 projective geometries and the
    algorithms.  Footnotes in these two documents describe the
    differences between these algorithms and the 1993-94 WCS draft
    proposal (see URL below). In particular, these algorithms support
    ordinary field rotation, but not skew geometries (CD or PC matrix
    cases). Also, the MER and AIT algorithms work correctly only for
    CRVALi=(0,0). Users should note that GLS projections with yref!=0
    will behave differently in this code than in the draft WCS
    proposal.  The NCP projection is now obsolete (it is a special
    case of SIN).  WCS syntax and semantics for various advanced
    features is discussed in the draft WCS proposal by Greisen and
    Calabretta at:
    
        ftp://fits.cv.nrao.edu/fits/documents/wcs/wcs.all.ps.Z
...
int worldpos(double xpix, double ypix, double xref, double yref,
      double xrefpix, double yrefpix, double xinc, double yinc, double rot,
      char *type, double *xpos, double *ypos)
...
int xypix(double xpos, double ypos, double xref, double yref, 
      double xrefpix, double yrefpix, double xinc, double yinc, double rot,
      char *type, double *xpix, double *ypix)
...
--
  Donald C. Wells         Associate Scientist         dwells at nrao.edu
                    http://fits.cv.nrao.edu/~dwells
  National Radio Astronomy Observatory                +1-804-296-0277
  520 Edgemont Road,   Charlottesville, Virginia       22903-2475 USA