SkyCoordinates.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Jolien Creighton, Reinhard Prix, Teviet Creighton
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 /** \file
00021  *  \ingroup SkyCoordinates
00022  *  \author Creighton, T. D.
00023  *  \date 2002
00024  *  \brief This header covers routines to perform coordinate transformations
00025  *   among the various spherical coordinate systems used in astronomy.
00026  */
00027 
00028 #ifndef _SKYCOORDINATES_H
00029 #define _SKYCOORDINATES_H
00030 
00031 #include <lal/LALStdlib.h>
00032 
00033 #ifdef  __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 NRCSID( SKYCOORDINATESH, "$Id: SkyCoordinates.h,v 1.19 2007/06/08 14:41:47 bema Exp $" );
00038 
00039 /** \name Error codes */
00040 /*@{*/
00041 #define SKYCOORDINATESH_ENUL  1
00042 #define SKYCOORDINATESH_ESYS  2
00043 #define SKYCOORDINATESH_EZERO 3
00044 #define SKYCOORDINATESH_ESING 4
00045 
00046 #define SKYCOORDINATESH_MSGENUL  "Unexpected null pointer in arguments"
00047 #define SKYCOORDINATESH_MSGESYS  "Wrong coordinate system in input"
00048 #define SKYCOORDINATESH_MSGEZERO "Angular coordinates undefined at origin"
00049 #define SKYCOORDINATESH_MSGESING "Point is inside singular ellipsoid"
00050 /*@}*/
00051 
00052 /*---------- exported types ---------- */
00053 
00054 /** This enumerated type is used to identify data as being in one of the
00055  *  coordinate systems discussed in \ref SkyCoordinates.  */
00056 typedef enum {
00057   COORDINATESYSTEM_HORIZON,     /**< A horizon coordinate system. */
00058   COORDINATESYSTEM_GEOGRAPHIC,  /**< The Earth-fixed geographic coordinate system. */
00059   COORDINATESYSTEM_EQUATORIAL,  /**< The sky-fixed equatorial coordinate system. */
00060   COORDINATESYSTEM_ECLIPTIC,    /**< The ecliptic coordinate system. */
00061   COORDINATESYSTEM_GALACTIC     /**< The galactic coordinate system. */
00062 } CoordinateSystem;
00063 
00064 /** This structure stores the two spherical coordinates of a sky position;
00065  * ie a generic latitude and longitude; the structure is not defined
00066  * specific to a particular coordinate system, but maintains a tag
00067  * indicating which coordinate system it is expressed in.
00068  */
00069 typedef struct tagSkyPosition {
00070   REAL8 longitude;              /**< The longitudinal coordinate (in radians), as defined above.*/
00071   REAL8 latitude;               /**< The latitudinal coordinate (in radians), as defined above. */
00072   CoordinateSystem system;      /**< The coordinate system in which latitude/longitude are expressed. */
00073 } SkyPosition;
00074 
00075 /** This structure stores the location of a point on (or near) the surface
00076  * of the Earth in both geodetic and geocentric coordinates, as described
00077  * in TerrestrialCoordinates.c .
00078  */
00079 typedef struct tagEarthPosition {
00080   SkyPosition geodetic;         /**< The geographic coordinates of the
00081                                  * upward vertical direction from the point; that is, the point's
00082                                  * <em>geodetic</em> latitude and longitude. */
00083 
00084   REAL8 elevation;              /**< The vertical distance of the point above the reference ellipsoid, 
00085                                  * in metres.*/
00086 
00087   REAL8 x, y, z;                /**< The Earth-fixed geocentric Cartesian coordinates of the point, 
00088                                  *in metres.*/
00089 
00090   REAL8 radius;                 /**< The distance of the point from the geocentre, in metres. */
00091 
00092   SkyPosition geocentric;       /**<  The geographic coordinates of the direction from the centre 
00093                                  * of the Earth through the point; that is, the point's 
00094                                  * <em>geocentric</em> latitude and longitude.*/
00095 } EarthPosition;
00096 
00097 
00098 /** This structure stores parameters for the function <tt>LALConvertSkyPosition()</tt>. 
00099  */
00100 typedef struct tagConvertSkyParams {
00101   CoordinateSystem system;      /**<  The coordinate system to which one is transforming. */
00102 
00103   SkyPosition *zenith;          /**< The position of the zenith of the horizon coordinate system; 
00104                                  * may be <tt>NULL</tt> if one is neither converting to nor from 
00105                                  * a horizon system. */
00106 
00107   LIGOTimeGPS *gpsTime;         /**< The GPS time for conversions between Earth-fixed and 
00108                                  * sky-fixed coordinates; may be <tt>NULL</tt> if no such conversion 
00109                                  * is required (or if one is transforming to or from horizon 
00110                                  * coordinates and <tt>*zenith</tt> is given in the sky-fixed 
00111                                  * equatorial system). */
00112 } ConvertSkyParams;
00113 
00114 
00115 /* ---------- Function prototypes ---------- */
00116 
00117 void
00118 LALGalacticToEquatorial( LALStatus   *,
00119                          SkyPosition *output,
00120                          SkyPosition *input );
00121 
00122 void
00123 LALEquatorialToGalactic( LALStatus   *,
00124                          SkyPosition *output,
00125                          SkyPosition *input );
00126 
00127 void
00128 LALEclipticToEquatorial( LALStatus   *,
00129                          SkyPosition *output,
00130                          SkyPosition *input );
00131 
00132 void
00133 LALEquatorialToEcliptic( LALStatus   *,
00134                          SkyPosition *output,
00135                          SkyPosition *input );
00136 
00137 void
00138 LALGeographicToEquatorial( LALStatus   *,
00139                            SkyPosition *output,
00140                            SkyPosition *input,
00141                            LIGOTimeGPS *gpsTime );
00142 
00143 void
00144 LALEquatorialToGeographic( LALStatus   *,
00145                            SkyPosition *output,
00146                            SkyPosition *input,
00147                            LIGOTimeGPS *gpsTime );
00148 
00149 void
00150 LALSystemToHorizon( LALStatus   *,
00151                     SkyPosition *output,
00152                     SkyPosition *input,
00153                     const SkyPosition *zenith );
00154 
00155 void
00156 LALHorizonToSystem( LALStatus   *,
00157                     SkyPosition *output,
00158                     SkyPosition *input,
00159                     const SkyPosition *zenith );
00160 
00161 void
00162 LALGeodeticToGeocentric( LALStatus *, EarthPosition *location );
00163 
00164 void
00165 LALGeocentricToGeodetic( LALStatus *, EarthPosition *location );
00166 
00167 void
00168 LALConvertSkyCoordinates( LALStatus        *,
00169                           SkyPosition      *output,
00170                           SkyPosition      *input,
00171                           ConvertSkyParams *params );
00172 
00173 void LALNormalizeSkyPosition (LALStatus *status, SkyPosition *posOut, const SkyPosition *posIn);
00174 int XLALNormalizeSkyPosition ( SkyPosition *posInOut );
00175 
00176 #ifdef  __cplusplus
00177 }
00178 #endif
00179 
00180 #endif /* _SKYCOORDINATES_H */

Generated on Fri Sep 5 03:07:27 2008 for LAL by  doxygen 1.5.2