source: branches/FACT++_part_filenames/pal/palPrec.c@ 19671

Last change on this file since 19671 was 18347, checked in by tbretz, 9 years ago
File size: 3.0 KB
Line 
1/*
2*+
3* Name:
4* palPrec
5
6* Purpose:
7* Form the matrix of precession between two epochs (IAU 2006)
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* palPrec( double ep0, double ep1, double rmatp[3][3] )
17
18* Arguments:
19* ep0 = double (Given)
20* Beginning epoch
21* ep1 = double (Given)
22* Ending epoch
23* rmatp = double[3][3] (Returned)
24* Precession matrix
25
26* Description:
27* The IAU 2006 precession matrix from ep0 to ep1 is found and
28* returned. The matrix is in the sense V(EP1) = RMATP * V(EP0).
29* The epochs are TDB (loosely TT) Julian epochs.
30*
31* Though the matrix method itself is rigorous, the precession
32* angles are expressed through canonical polynomials which are
33* valid only for a limited time span of a few hundred years around
34* the current epoch.
35
36* Authors:
37* PTW: Pat Wallace (STFC)
38* DSB: David Berry (JAC, Hawaii)
39* {enter_new_authors_here}
40
41* History:
42* 2012-02-10 (DSB):
43* Initial version with documentation taken from Fortran SLA
44* Adapted with permission from the Fortran SLALIB library.
45* {enter_further_changes_here}
46
47* Copyright:
48* Copyright (C) 1996 Rutherford Appleton Laboratory
49* Copyright (C) 2012 Science and Technology Facilities Council.
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 Lesser General Public
55* License as published by the Free Software Foundation, either
56* version 3 of the License, or (at your option) any later
57* version.
58*
59* This program is distributed in the hope that it will be useful,
60* but WITHOUT ANY WARRANTY; without even the implied warranty of
61* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62* GNU Lesser General Public License for more details.
63*
64* You should have received a copy of the GNU Lesser General
65* License along with this program. If not, see
66* <http://www.gnu.org/licenses/>.
67
68* Bugs:
69* {note_any_bugs_here}
70*-
71*/
72
73#include "pal.h"
74#include "pal1sofa.h"
75
76void palPrec( double ep0, double ep1, double rmatp[3][3] ){
77
78/* Local Variables: */
79 double rmatq[3][3];
80 double ep0_days;
81 double ep1_days;
82
83/* Convert supplied dates to days since J2000 */
84 ep0_days = ( ep0 - 2000.0 )*ERFA_DJY;
85 ep1_days = ( ep1 - 2000.0 )*ERFA_DJY;
86
87/* If beginning epoch is J2000, just return the rotation matrix from
88 J2000 to EP1. */
89 if( ep0 == 2000.0 ) {
90 eraPmat06( ERFA_DJ00, ep1_days, rmatp );
91
92/* If end epoch is J2000, get the rotation matrix from J2000 to EP0 and
93 then transpose it to get the rotation matrix from EP0 to J2000. */
94 } else if( ep1 == 2000.0 ) {
95 eraPmat06( ERFA_DJ00, ep0_days, rmatp );
96 eraTr( rmatp, rmatp );
97
98/* Otherwise. get the two matrices used above and multiply them
99 together. */
100 } else {
101 eraPmat06( ERFA_DJ00, ep0_days, rmatp );
102 eraTr( rmatp, rmatp );
103 eraPmat06( ERFA_DJ00, ep1_days, rmatq );
104 eraRxr( rmatp, rmatq, rmatp );
105 }
106
107}
Note: See TracBrowser for help on using the repository browser.