| 1 | /* | 
|---|
| 2 | *+ | 
|---|
| 3 | *  Name: | 
|---|
| 4 | *     palGalsup | 
|---|
| 5 |  | 
|---|
| 6 | *  Purpose: | 
|---|
| 7 | *     Convert from galactic to supergalactic coordinates | 
|---|
| 8 |  | 
|---|
| 9 | *  Language: | 
|---|
| 10 | *     Starlink ANSI C | 
|---|
| 11 |  | 
|---|
| 12 | *  Type of Module: | 
|---|
| 13 | *     Library routine | 
|---|
| 14 |  | 
|---|
| 15 | *  Invocation: | 
|---|
| 16 | *     void palGalsup ( double dl, double db, double *dsl, double *dsb ); | 
|---|
| 17 |  | 
|---|
| 18 | *  Arguments: | 
|---|
| 19 | *     dl = double (Given) | 
|---|
| 20 | *       Galactic longitude. | 
|---|
| 21 | *     db = double (Given) | 
|---|
| 22 | *       Galactic latitude. | 
|---|
| 23 | *     dsl = double * (Returned) | 
|---|
| 24 | *       Supergalactic longitude. | 
|---|
| 25 | *     dsb = double * (Returned) | 
|---|
| 26 | *       Supergalactic latitude. | 
|---|
| 27 |  | 
|---|
| 28 | *  Description: | 
|---|
| 29 | *     Transformation from IAU 1958 galactic coordinates to | 
|---|
| 30 | *     de Vaucouleurs supergalactic coordinates. | 
|---|
| 31 |  | 
|---|
| 32 | *  Authors: | 
|---|
| 33 | *     PTW: Pat Wallace (STFC) | 
|---|
| 34 | *     TIMJ: Tim Jenness (JAC, Hawaii) | 
|---|
| 35 | *     {enter_new_authors_here} | 
|---|
| 36 |  | 
|---|
| 37 | *  See Also: | 
|---|
| 38 | *     - de Vaucouleurs, de Vaucouleurs, & Corwin, Second Reference | 
|---|
| 39 | *       Catalogue of Bright Galaxies, U. Texas, page 8. | 
|---|
| 40 | *     - Systems & Applied Sciences Corp., Documentation for the | 
|---|
| 41 | *       machine-readable version of the above catalogue, | 
|---|
| 42 | *       Contract NAS 5-26490. | 
|---|
| 43 | * | 
|---|
| 44 | *     (These two references give different values for the galactic | 
|---|
| 45 | *     longitude of the supergalactic origin.  Both are wrong;  the | 
|---|
| 46 | *     correct value is L2=137.37.) | 
|---|
| 47 |  | 
|---|
| 48 | *  History: | 
|---|
| 49 | *     2012-02-12(TIMJ): | 
|---|
| 50 | *        Initial version with documentation taken from Fortran SLA | 
|---|
| 51 | *        Adapted with permission from the Fortran SLALIB library. | 
|---|
| 52 | *     {enter_further_changes_here} | 
|---|
| 53 |  | 
|---|
| 54 | *  Copyright: | 
|---|
| 55 | *     Copyright (C) 1999 Rutherford Appleton Laboratory | 
|---|
| 56 | *     Copyright (C) 2012 Science and Technology Facilities Council. | 
|---|
| 57 | *     All Rights Reserved. | 
|---|
| 58 |  | 
|---|
| 59 | *  Licence: | 
|---|
| 60 | *     This program is free software: you can redistribute it and/or | 
|---|
| 61 | *     modify it under the terms of the GNU Lesser General Public | 
|---|
| 62 | *     License as published by the Free Software Foundation, either | 
|---|
| 63 | *     version 3 of the License, or (at your option) any later | 
|---|
| 64 | *     version. | 
|---|
| 65 | * | 
|---|
| 66 | *     This program is distributed in the hope that it will be useful, | 
|---|
| 67 | *     but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 68 | *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 69 | *     GNU Lesser General Public License for more details. | 
|---|
| 70 | * | 
|---|
| 71 | *     You should have received a copy of the GNU Lesser General | 
|---|
| 72 | *     License along with this program.  If not, see | 
|---|
| 73 | *     <http://www.gnu.org/licenses/>. | 
|---|
| 74 |  | 
|---|
| 75 | *  Bugs: | 
|---|
| 76 | *     {note_any_bugs_here} | 
|---|
| 77 | *- | 
|---|
| 78 | */ | 
|---|
| 79 |  | 
|---|
| 80 | #include "pal.h" | 
|---|
| 81 | #include "pal1sofa.h" | 
|---|
| 82 |  | 
|---|
| 83 | void palGalsup ( double dl, double db, double *dsl, double *dsb ) { | 
|---|
| 84 |  | 
|---|
| 85 | double v1[3]; | 
|---|
| 86 | double v2[3]; | 
|---|
| 87 |  | 
|---|
| 88 | /* | 
|---|
| 89 | *  System of supergalactic coordinates: | 
|---|
| 90 | * | 
|---|
| 91 | *    SGL   SGB        L2     B2      (deg) | 
|---|
| 92 | *     -    +90      47.37  +6.32 | 
|---|
| 93 | *     0     0         -      0 | 
|---|
| 94 | * | 
|---|
| 95 | *  Galactic to supergalactic rotation matrix: | 
|---|
| 96 | */ | 
|---|
| 97 | double rmat[3][3] = { | 
|---|
| 98 | { -0.735742574804,+0.677261296414,+0.000000000000 }, | 
|---|
| 99 | { -0.074553778365,-0.080991471307,+0.993922590400 }, | 
|---|
| 100 | { +0.673145302109,+0.731271165817,+0.110081262225 } | 
|---|
| 101 | }; | 
|---|
| 102 |  | 
|---|
| 103 | /* Spherical to Cartesian */ | 
|---|
| 104 | eraS2c( dl, db, v1 ); | 
|---|
| 105 |  | 
|---|
| 106 | /* Galactic to Supergalactic */ | 
|---|
| 107 | eraRxp( rmat, v1, v2 ); | 
|---|
| 108 |  | 
|---|
| 109 | /* Cartesian to spherical */ | 
|---|
| 110 | eraC2s( v2, dsl, dsb ); | 
|---|
| 111 |  | 
|---|
| 112 | /* Express in conventional ranges */ | 
|---|
| 113 | *dsl = eraAnp( *dsl ); | 
|---|
| 114 | *dsb = eraAnpm( *dsb ); | 
|---|
| 115 |  | 
|---|
| 116 | } | 
|---|