1 #include "erfa.h"
2 
eraLteqec(double epj,double dr,double dd,double * dl,double * db)3 void eraLteqec(double epj, double dr, double dd, double *dl, double *db)
4 /*
5 **  - - - - - - - - - -
6 **   e r a L t e q e c
7 **  - - - - - - - - - -
8 **
9 **  Transformation from ICRS equatorial coordinates to ecliptic
10 **  coordinates (mean equinox and ecliptic of date) using a long-term
11 **  precession model.
12 **
13 **  Given:
14 **     epj     double     Julian epoch (TT)
15 **     dr,dd   double     ICRS right ascension and declination (radians)
16 **
17 **  Returned:
18 **     dl,db   double     ecliptic longitude and latitude (radians)
19 **
20 **  1) No assumptions are made about whether the coordinates represent
21 **     starlight and embody astrometric effects such as parallax or
22 **     aberration.
23 **
24 **  2) The transformation is approximately that from mean J2000.0 right
25 **     ascension and declination to ecliptic longitude and latitude
26 **     (mean equinox and ecliptic of date), with only frame bias (always
27 **     less than 25 mas) to disturb this classical picture.
28 **
29 **  3) The Vondrak et al. (2011, 2012) 400 millennia precession model
30 **     agrees with the IAU 2006 precession at J2000.0 and stays within
31 **     100 microarcseconds during the 20th and 21st centuries.  It is
32 **     accurate to a few arcseconds throughout the historical period,
33 **     worsening to a few tenths of a degree at the end of the
34 **     +/- 200,000 year time span.
35 **
36 **  Called:
37 **     eraS2c       spherical coordinates to unit vector
38 **     eraLtecm     J2000.0 to ecliptic rotation matrix, long term
39 **     eraRxp       product of r-matrix and p-vector
40 **     eraC2s       unit vector to spherical coordinates
41 **     eraAnp       normalize angle into range 0 to 2pi
42 **     eraAnpm      normalize angle into range +/- pi
43 **
44 **  References:
45 **
46 **    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
47 **    expressions, valid for long time intervals, Astron.Astrophys. 534,
48 **    A22
49 **
50 **    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
51 **    expressions, valid for long time intervals (Corrigendum),
52 **    Astron.Astrophys. 541, C1
53 **
54 **  This revision:  2021 May 11
55 **
56 **  Copyright (C) 2013-2021, NumFOCUS Foundation.
57 **  Derived, with permission, from the SOFA library.  See notes at end of file.
58 */
59 {
60    double rm[3][3], v1[3], v2[3], a, b;
61 
62 
63 /* Spherical to Cartesian. */
64    eraS2c(dr, dd, v1);
65 
66 /* Rotation matrix, ICRS equatorial to ecliptic. */
67    eraLtecm(epj, rm);
68 
69 /* The transformation from ICRS to ecliptic. */
70    eraRxp(rm, v1, v2);
71 
72 /* Cartesian to spherical. */
73    eraC2s(v2, &a, &b);
74 
75 /* Express in conventional ranges. */
76    *dl = eraAnp(a);
77    *db = eraAnpm(b);
78 
79 /* Finished. */
80 
81 }
82 /*----------------------------------------------------------------------
83 **
84 **
85 **  Copyright (C) 2013-2021, NumFOCUS Foundation.
86 **  All rights reserved.
87 **
88 **  This library is derived, with permission, from the International
89 **  Astronomical Union's "Standards of Fundamental Astronomy" library,
90 **  available from http://www.iausofa.org.
91 **
92 **  The ERFA version is intended to retain identical functionality to
93 **  the SOFA library, but made distinct through different function and
94 **  file names, as set out in the SOFA license conditions.  The SOFA
95 **  original has a role as a reference standard for the IAU and IERS,
96 **  and consequently redistribution is permitted only in its unaltered
97 **  state.  The ERFA version is not subject to this restriction and
98 **  therefore can be included in distributions which do not support the
99 **  concept of "read only" software.
100 **
101 **  Although the intent is to replicate the SOFA API (other than
102 **  replacement of prefix names) and results (with the exception of
103 **  bugs;  any that are discovered will be fixed), SOFA is not
104 **  responsible for any errors found in this version of the library.
105 **
106 **  If you wish to acknowledge the SOFA heritage, please acknowledge
107 **  that you are using a library derived from SOFA, rather than SOFA
108 **  itself.
109 **
110 **
111 **  TERMS AND CONDITIONS
112 **
113 **  Redistribution and use in source and binary forms, with or without
114 **  modification, are permitted provided that the following conditions
115 **  are met:
116 **
117 **  1 Redistributions of source code must retain the above copyright
118 **    notice, this list of conditions and the following disclaimer.
119 **
120 **  2 Redistributions in binary form must reproduce the above copyright
121 **    notice, this list of conditions and the following disclaimer in
122 **    the documentation and/or other materials provided with the
123 **    distribution.
124 **
125 **  3 Neither the name of the Standards Of Fundamental Astronomy Board,
126 **    the International Astronomical Union nor the names of its
127 **    contributors may be used to endorse or promote products derived
128 **    from this software without specific prior written permission.
129 **
130 **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
131 **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
132 **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
133 **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
134 **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
135 **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
136 **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
137 **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
138 **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
139 **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
140 **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
141 **  POSSIBILITY OF SUCH DAMAGE.
142 **
143 */
144