1
/* @(#)ast_ecl.c 19.1 (ES0-DMD) 02/25/03 13:53:53 */
2
/*===========================================================================
3
Copyright (C) 1995 European Southern Observatory (ESO)
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License as
7
published by the Free Software Foundation; either version 2 of
8
the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public
16
License along with this program; if not, write to the Free
17
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
20
Corresponding concerning ESO-MIDAS should be addressed as follows:
21
Internet e-mail: midas@eso.org
22
Postal address: European Southern Observatory
23
Data Management Division
24
Karl-Schwarzschild-Strasse 2
25
D 85748 Garching bei Muenchen
27
===========================================================================*/
32
.VERSION 1.0 05-Mar-1987: Creation .
33
.VERSION 1.1 24-Oct-1988: Application on Unit Vectors
35
.AUTHOR Francois Ochsenbein [ESO-IPG]
36
.KEYWORDS Ecliptic / Equatorial Coordinate conversions
39
All spherical coordinates are assumed to be expressed in DEGREES.
43
The parameter mnemonics are:
46
\item {\bf e} = array $[ x , y , z ]$ of Ecliptic coordinates,
47
in B1950 or J2000 frame
48
\item {\bf f5} = array $[\alpha_{2000},\delta_{2000}]$ of Fundamental coordinates
50
\item {\bf f} = array $[\alpha_{1950},\delta_{1950}]$ of eQuatorial coordinates
55
The routines provided here only allows to compute ecliptic coordinates
56
from/to B1950 or J2000 epochs. If other epochs are required, the following
57
procedure can be used:
59
\item Determine the rotation matrix $R$ from equatorial to ecliptic
60
at epoch $t$ (in Julian Years) with {\tt ecl\_R}($t$, $R$).
61
\item Rotate to ecliptic frame, using
62
{\tt tr\_oo}($q$, $e$, $R$).
65
If a transformation from Ecliptic to Equatorial is wished, the only
66
modification is to replace the {\tt tr\_oo} function of step 2 by
67
the {\tt tr\_oo1} function (inverse rotation).
69
Reference: Murray, Vectorial Analysis, section 4.3; P.T. Wallace, Starlink.
72
-----------------------------------------------------------------------*/
79
static double RJ[3][3] = { {1.e0, 0.e0, 0.e0}, /* Rotation in J2000 */
82
static double yj = -99999999.e0;
84
RGLOBAL double ecl_2000[3][3] = { /* From J2000 => Ecl */
85
{1.0000000000000000, 0.0000000000000000, 0.0000000000000000},
86
{0.0000000000000000, 0.9174820620691818, 0.3977771559319137},
87
{0.0000000000000000,-0.3977771559319137, 0.9174820620691818}
90
#define DEBUG 0 /* Debugging option */
92
/*============================================================================*/
95
.PURPOSE Computation of Equatorial to Ecliptic rotation matrix
96
at an epoch specified in Julian Years.
97
The resulting matrix is such that
99
\quad $\vec{u}_{ecl} = R \cdot \vec{u}_{eq}$ \quad (equatorial to ecliptic).
103
double y; /* IN: Epoch, in Julian Years */
104
double R[3][3]; /* OUT: rotation matrix */
108
dt = (y-2000.e0)/100.e0; /* In centuries */
110
eps = (84381.448e0 + (-46.8150e0 + (-0.00059e0+0.001813e0*dt)*dt)*dt)
111
/3600.e0; /* Mean obliquity */
113
/* Compute Matrix (rotation around x-axis */
128
/*============================================================================
129
* Transformations on Unit Vector
130
*============================================================================*/
132
/*============================================================================*/
133
int tr_ef (e , f , y)
135
.PURPOSE Transformation from Ecliptic to eQuatorial.
137
.REMARKS Same equinox for input and output coordinates.
139
double e[2]; /* IN: Ecliptic angles at epoch y (degrees) */
140
double f[3]; /* OUT: Position in Frame at equinox y */
141
double y; /* IN: Date for Ecliptic (Julian Years) */
143
if (y != yj) /* Compute Rotation Matrix */
144
yj = y, ecl_R( RJ, yj);
146
return (tr_uu1 ( e, f, RJ));
149
/*============================================================================*/
150
int tr_fe (f , e , y)
152
.PURPOSE Transformation from eQuatorial (B1950) to B1950 Ecliptic.
154
.REMARKS Same equinox for input and output coordinates.
156
double f[3]; /* IN: Vector in Equatorial frame */
157
double e[3]; /* OUT: Position in Ecliptic Frame, epoch y */
158
double y; /* IN: Date for Ecliptic (Julain Years) */
160
if (y != yj) /* Compute Rotation Matrix */
161
yj = y, ecl_R( RJ, yj);
163
return (tr_uu ( f, e, RJ));