| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | /* | 
| 2 |  |  |  |  |  |  | *+ | 
| 3 |  |  |  |  |  |  | *  Name: | 
| 4 |  |  |  |  |  |  | *     palEqgal | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | *  Purpose: | 
| 7 |  |  |  |  |  |  | *     Convert from J2000.0 equatorial coordinates to Galactic | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | *  Language: | 
| 10 |  |  |  |  |  |  | *     Starlink ANSI C | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | *  Type of Module: | 
| 13 |  |  |  |  |  |  | *     Library routine | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | *  Invocation: | 
| 16 |  |  |  |  |  |  | *     void palEqgal ( double dr, double dd, double *dl, double *db ); | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | *  Arguments: | 
| 19 |  |  |  |  |  |  | *     dr = double (Given) | 
| 20 |  |  |  |  |  |  | *       J2000.0 RA (radians) | 
| 21 |  |  |  |  |  |  | *     dd = double (Given) | 
| 22 |  |  |  |  |  |  | *       J2000.0 Dec (radians | 
| 23 |  |  |  |  |  |  | *     dl = double * (Returned) | 
| 24 |  |  |  |  |  |  | *       Galactic longitude (radians). | 
| 25 |  |  |  |  |  |  | *     db = double * (Returned) | 
| 26 |  |  |  |  |  |  | *       Galactic latitude (radians). | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | *  Description: | 
| 29 |  |  |  |  |  |  | *     Transformation from J2000.0 equatorial coordinates | 
| 30 |  |  |  |  |  |  | *     to IAU 1958 galactic coordinates. | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | *  Authors: | 
| 33 |  |  |  |  |  |  | *     PTW: Pat Wallace (STFC) | 
| 34 |  |  |  |  |  |  | *     TIMJ: Tim Jenness (JAC, Hawaii) | 
| 35 |  |  |  |  |  |  | *     {enter_new_authors_here} | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | *  Notes: | 
| 38 |  |  |  |  |  |  | *     The equatorial coordinates are J2000.0.  Use the routine | 
| 39 |  |  |  |  |  |  | *     palGe50 if conversion to B1950.0 'FK4' coordinates is | 
| 40 |  |  |  |  |  |  | *     required. | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | *  See Also: | 
| 43 |  |  |  |  |  |  | *     Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | *  History: | 
| 46 |  |  |  |  |  |  | *     2012-02-12(TIMJ): | 
| 47 |  |  |  |  |  |  | *        Initial version with documentation taken from Fortran SLA | 
| 48 |  |  |  |  |  |  | *        Adapted with permission from the Fortran SLALIB library. | 
| 49 |  |  |  |  |  |  | *     {enter_further_changes_here} | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | *  Copyright: | 
| 52 |  |  |  |  |  |  | *     Copyright (C) 1998 Rutherford Appleton Laboratory | 
| 53 |  |  |  |  |  |  | *     Copyright (C) 2012 Science and Technology Facilities Council. | 
| 54 |  |  |  |  |  |  | *     All Rights Reserved. | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | *  Licence: | 
| 57 |  |  |  |  |  |  | *     This program is free software: you can redistribute it and/or | 
| 58 |  |  |  |  |  |  | *     modify it under the terms of the GNU Lesser General Public | 
| 59 |  |  |  |  |  |  | *     License as published by the Free Software Foundation, either | 
| 60 |  |  |  |  |  |  | *     version 3 of the License, or (at your option) any later | 
| 61 |  |  |  |  |  |  | *     version. | 
| 62 |  |  |  |  |  |  | * | 
| 63 |  |  |  |  |  |  | *     This program is distributed in the hope that it will be useful, | 
| 64 |  |  |  |  |  |  | *     but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 65 |  |  |  |  |  |  | *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 66 |  |  |  |  |  |  | *     GNU Lesser General Public License for more details. | 
| 67 |  |  |  |  |  |  | * | 
| 68 |  |  |  |  |  |  | *     You should have received a copy of the GNU Lesser General | 
| 69 |  |  |  |  |  |  | *     License along with this program.  If not, see | 
| 70 |  |  |  |  |  |  | *     . | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | *  Bugs: | 
| 73 |  |  |  |  |  |  | *     {note_any_bugs_here} | 
| 74 |  |  |  |  |  |  | *- | 
| 75 |  |  |  |  |  |  | */ | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | #include "pal.h" | 
| 78 |  |  |  |  |  |  | #include "pal1sofa.h" | 
| 79 |  |  |  |  |  |  |  | 
| 80 | 0 |  |  |  |  |  | void palEqgal ( double dr, double dd, double *dl, double *db ) { | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | double v1[3]; | 
| 83 |  |  |  |  |  |  | double v2[3]; | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | /* | 
| 86 |  |  |  |  |  |  | *  L2,B2 system of galactic coordinates | 
| 87 |  |  |  |  |  |  | * | 
| 88 |  |  |  |  |  |  | *  P = 192.25       RA of galactic north pole (mean B1950.0) | 
| 89 |  |  |  |  |  |  | *  Q =  62.6        inclination of galactic to mean B1950.0 equator | 
| 90 |  |  |  |  |  |  | *  R =  33          longitude of ascending node | 
| 91 |  |  |  |  |  |  | * | 
| 92 |  |  |  |  |  |  | *  P,Q,R are degrees | 
| 93 |  |  |  |  |  |  | * | 
| 94 |  |  |  |  |  |  | *  Equatorial to galactic rotation matrix (J2000.0), obtained by | 
| 95 |  |  |  |  |  |  | *  applying the standard FK4 to FK5 transformation, for zero proper | 
| 96 |  |  |  |  |  |  | *  motion in FK5, to the columns of the B1950 equatorial to | 
| 97 |  |  |  |  |  |  | *  galactic rotation matrix: | 
| 98 |  |  |  |  |  |  | */ | 
| 99 | 0 |  |  |  |  |  | double rmat[3][3] = { | 
| 100 |  |  |  |  |  |  | { -0.054875539726,-0.873437108010,-0.483834985808 }, | 
| 101 |  |  |  |  |  |  | { +0.494109453312,-0.444829589425,+0.746982251810 }, | 
| 102 |  |  |  |  |  |  | { -0.867666135858,-0.198076386122,+0.455983795705 } | 
| 103 |  |  |  |  |  |  | }; | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | /* Spherical to Cartesian */ | 
| 106 | 0 |  |  |  |  |  | eraS2c( dr, dd, v1 ); | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | /* Equatorial to Galactic */ | 
| 109 | 0 |  |  |  |  |  | eraRxp( rmat, v1, v2 ); | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | /* Cartesian to spherical */ | 
| 112 | 0 |  |  |  |  |  | eraC2s( v2, dl, db ); | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | /* Express in conventional ranges */ | 
| 115 | 0 |  |  |  |  |  | *dl = eraAnp( *dl ); | 
| 116 | 0 |  |  |  |  |  | *db = eraAnpm( *db ); | 
| 117 |  |  |  |  |  |  |  | 
| 118 | 0 |  |  |  |  |  | } |