1 /*
2 *+
3 *  Name:
4 *     palEcleq
5 
6 *  Purpose:
7 *     Transform from ecliptic coordinates to J2000.0 equatorial coordinates
8 
9 *  Language:
10 *     Starlink ANSI C
11 
12 *  Type of Module:
13 *     Library routine
14 
15 *  Invocation:
16 *     void palEcleq ( double dl, double db, double date,
17 *                     double *dr, double *dd );
18 
19 *  Arguments:
20 *     dl = double (Given)
21 *        Ecliptic longitude (mean of date, IAU 1980 theory, radians)
22 *     db = double (Given)
23 *        Ecliptic latitude (mean of date, IAU 1980 theory, radians)
24 *     date = double (Given)
25 *        TT as Modified Julian Date (JD-2400000.5). The difference
26 *        between TT and TDB is of the order of a millisecond or two
27 *        (i.e. about 0.02 arc-seconds).
28 *     dr = double * (Returned)
29 *        J2000.0 mean RA (radians)
30 *     dd = double * (Returned)
31 *        J2000.0 mean Dec (Radians)
32 
33 *  Description:
34 *     Transform from ecliptic coordinate to J2000.0 equatorial coordinates.
35 
36 *  Authors:
37 *     PTW: Patrick T. Wallace
38 *     TIMJ: Tim Jenness (Cornell University)
39 *     {enter_new_authors_here}
40 
41 *  History:
42 *     2014-11-18 (TIMJ):
43 *        Initial version
44 *        Adapted with permission from the Fortran SLALIB library.
45 *     {enter_further_changes_here}
46 
47 *  Copyright:
48 *     Copyright (C) 1995 Rutherford Appleton Laboratory
49 *     Copyright (C) 2014 Cornell University
50 *     All Rights Reserved.
51 
52 *  Licence:
53 *     This program is free software; you can redistribute it and/or
54 *     modify it under the terms of the GNU General Public License as
55 *     published by the Free Software Foundation; either version 3 of
56 *     the License, or (at your option) any later version.
57 *
58 *     This program is distributed in the hope that it will be
59 *     useful, but WITHOUT ANY WARRANTY; without even the implied
60 *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
61 *     PURPOSE. See the GNU General Public License for more details.
62 *
63 *     You should have received a copy of the GNU General Public License
64 *     along with this program; if not, write to the Free Software
65 *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
66 *     MA 02110-1301, USA.
67 
68 *  Bugs:
69 *     {note_any_bugs_here}
70 *-
71 */
72 
73 #include "pal.h"
74 #include "pal1sofa.h"
75 
palEcleq(double dl,double db,double date,double * dr,double * dd)76 void palEcleq ( double dl, double db, double date, double *dr, double *dd ) {
77   double v1[3], v2[3];
78   double rmat[3][3];
79 
80   /* Spherical to Cartesian */
81   eraS2c( dl, db, v1 );
82 
83   /* Ecliptic to equatorial */
84   palEcmat( date, rmat );
85   eraTrxp( rmat, v1, v2 );
86 
87   /* Mean of date to J2000 */
88   palPrec( 2000.0, palEpj(date), rmat );
89   eraTrxp( rmat, v2, v1 );
90 
91   /* Cartesian to spherical */
92   eraC2s( v1, dr, dd );
93 
94   /* Express in conventional range */
95   *dr = eraAnp( *dr );
96   *dd = palDrange( *dd );
97 }
98