line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
*+ |
3
|
|
|
|
|
|
|
* Name: |
4
|
|
|
|
|
|
|
* palPreces |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
* Purpose: |
7
|
|
|
|
|
|
|
* Precession - either FK4 or FK5 as required. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
* Language: |
10
|
|
|
|
|
|
|
* Starlink ANSI C |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
* Type of Module: |
13
|
|
|
|
|
|
|
* Library routine |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
* Invocation: |
16
|
|
|
|
|
|
|
* void palPreces ( const char sys[3], double ep0, double ep1, |
17
|
|
|
|
|
|
|
* double *ra, double *dc ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
* Arguments: |
20
|
|
|
|
|
|
|
* sys = const char [3] (Given) |
21
|
|
|
|
|
|
|
* Precession to be applied: FK4 or FK5. Case insensitive. |
22
|
|
|
|
|
|
|
* ep0 = double (Given) |
23
|
|
|
|
|
|
|
* Starting epoch. |
24
|
|
|
|
|
|
|
* ep1 = double (Given) |
25
|
|
|
|
|
|
|
* Ending epoch |
26
|
|
|
|
|
|
|
* ra = double * (Given & Returned) |
27
|
|
|
|
|
|
|
* On input the RA mean equator & equinox at epoch ep0. On exit |
28
|
|
|
|
|
|
|
* the RA mean equator & equinox of epoch ep1. |
29
|
|
|
|
|
|
|
* dec = double * (Given & Returned) |
30
|
|
|
|
|
|
|
* On input the dec mean equator & equinox at epoch ep0. On exit |
31
|
|
|
|
|
|
|
* the dec mean equator & equinox of epoch ep1. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
* Description: |
34
|
|
|
|
|
|
|
* Precess coordinates using the appropriate system and epochs. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
* Authors: |
37
|
|
|
|
|
|
|
* PTW: Patrick T. Wallace |
38
|
|
|
|
|
|
|
* TIMJ: Tim Jenness (JAC, Hawaii) |
39
|
|
|
|
|
|
|
* {enter_new_authors_here} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
* Notes: |
42
|
|
|
|
|
|
|
* - Uses palPrec for FK5 data and palPrebn for FK4 data. |
43
|
|
|
|
|
|
|
* - The epochs are Besselian if SYSTEM='FK4' and Julian if 'FK5'. |
44
|
|
|
|
|
|
|
* For example, to precess coordinates in the old system from |
45
|
|
|
|
|
|
|
* equinox 1900.0 to 1950.0 the call would be: |
46
|
|
|
|
|
|
|
* palPreces( "FK4", 1900.0, 1950.0, &ra, &dc ); |
47
|
|
|
|
|
|
|
* - This routine will NOT correctly convert between the old and |
48
|
|
|
|
|
|
|
* the new systems - for example conversion from B1950 to J2000. |
49
|
|
|
|
|
|
|
* For these purposes see palFk425, palFk524, palFk45z and |
50
|
|
|
|
|
|
|
* palFk54z. |
51
|
|
|
|
|
|
|
* - If an invalid SYSTEM is supplied, values of -99D0,-99D0 will |
52
|
|
|
|
|
|
|
* be returned for both RA and DC. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
* History: |
55
|
|
|
|
|
|
|
* 2012-03-02 (TIMJ): |
56
|
|
|
|
|
|
|
* Initial version |
57
|
|
|
|
|
|
|
* Adapted with permission from the Fortran SLALIB library. |
58
|
|
|
|
|
|
|
* {enter_further_changes_here} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
* Copyright: |
61
|
|
|
|
|
|
|
* Copyright (C) 1995 Rutherford Appleton Laboratory |
62
|
|
|
|
|
|
|
* Copyright (C) 2012 Science and Technology Facilities Council. |
63
|
|
|
|
|
|
|
* All Rights Reserved. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
* Licence: |
66
|
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or |
67
|
|
|
|
|
|
|
* modify it under the terms of the GNU General Public License as |
68
|
|
|
|
|
|
|
* published by the Free Software Foundation; either version 3 of |
69
|
|
|
|
|
|
|
* the License, or (at your option) any later version. |
70
|
|
|
|
|
|
|
* |
71
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be |
72
|
|
|
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied |
73
|
|
|
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
74
|
|
|
|
|
|
|
* PURPOSE. See the GNU General Public License for more details. |
75
|
|
|
|
|
|
|
* |
76
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License |
77
|
|
|
|
|
|
|
* along with this program; if not, write to the Free Software |
78
|
|
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
79
|
|
|
|
|
|
|
* MA 02110-1301, USA. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
* Bugs: |
82
|
|
|
|
|
|
|
* {note_any_bugs_here} |
83
|
|
|
|
|
|
|
*- |
84
|
|
|
|
|
|
|
*/ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#if HAVE_CONFIG_H |
87
|
|
|
|
|
|
|
# include |
88
|
|
|
|
|
|
|
#endif |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#include "pal.h" |
91
|
|
|
|
|
|
|
#include "pal1sofa.h" |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#include |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#if HAVE__STRNICMP || defined(_WIN32) || defined(_WIN64) |
96
|
|
|
|
|
|
|
# define strncasecmp _strnicmp |
97
|
|
|
|
|
|
|
#endif |
98
|
|
|
|
|
|
|
|
99
|
2
|
|
|
|
|
|
void palPreces ( const char sys[3], double ep0, double ep1, |
100
|
|
|
|
|
|
|
double *ra, double *dc ) { |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
double pm[3][3]; |
103
|
|
|
|
|
|
|
double v1[3]; |
104
|
|
|
|
|
|
|
double v2[3]; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
/* Generate appropriate precession matrix */ |
107
|
2
|
50
|
|
|
|
|
if ( strncasecmp( "FK4", sys, 3 ) == 0 ) { |
108
|
2
|
|
|
|
|
|
palPrebn( ep0, ep1, pm ); |
109
|
0
|
0
|
|
|
|
|
} else if (strncasecmp( "FK5", sys, 3 ) == 0 ) { |
110
|
0
|
|
|
|
|
|
palPrec( ep0, ep1, pm ); |
111
|
|
|
|
|
|
|
} else { |
112
|
0
|
|
|
|
|
|
*ra = -99.0; |
113
|
0
|
|
|
|
|
|
*dc = -99.0; |
114
|
0
|
|
|
|
|
|
return; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
/* Convert RA,Dec to x,y,z */ |
118
|
2
|
|
|
|
|
|
eraS2c( *ra, *dc, v1 ); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
/* Precess */ |
121
|
2
|
|
|
|
|
|
eraRxp( pm, v1, v2 ); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
/* Back to RA,Dec */ |
124
|
2
|
|
|
|
|
|
eraC2s( v2, ra, dc ); |
125
|
2
|
|
|
|
|
|
*ra = eraAnp( *ra ); |
126
|
|
|
|
|
|
|
} |