| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include "erfa.h" |
|
2
|
|
|
|
|
|
|
|
|
3
|
0
|
|
|
|
|
|
void eraTpstv(double xi, double eta, double v0[3], double v[3]) |
|
4
|
|
|
|
|
|
|
/* |
|
5
|
|
|
|
|
|
|
** - - - - - - - - - |
|
6
|
|
|
|
|
|
|
** e r a T p s t v |
|
7
|
|
|
|
|
|
|
** - - - - - - - - - |
|
8
|
|
|
|
|
|
|
** |
|
9
|
|
|
|
|
|
|
** In the tangent plane projection, given the star's rectangular |
|
10
|
|
|
|
|
|
|
** coordinates and the direction cosines of the tangent point, solve |
|
11
|
|
|
|
|
|
|
** for the direction cosines of the star. |
|
12
|
|
|
|
|
|
|
** |
|
13
|
|
|
|
|
|
|
** Given: |
|
14
|
|
|
|
|
|
|
** xi,eta double rectangular coordinates of star image (Note 2) |
|
15
|
|
|
|
|
|
|
** v0 double[3] tangent point's direction cosines |
|
16
|
|
|
|
|
|
|
** |
|
17
|
|
|
|
|
|
|
** Returned: |
|
18
|
|
|
|
|
|
|
** v double[3] star's direction cosines |
|
19
|
|
|
|
|
|
|
** |
|
20
|
|
|
|
|
|
|
** 1) The tangent plane projection is also called the "gnomonic |
|
21
|
|
|
|
|
|
|
** projection" and the "central projection". |
|
22
|
|
|
|
|
|
|
** |
|
23
|
|
|
|
|
|
|
** 2) The eta axis points due north in the adopted coordinate system. |
|
24
|
|
|
|
|
|
|
** If the direction cosines represent observed (RA,Dec), the tangent |
|
25
|
|
|
|
|
|
|
** plane coordinates (xi,eta) are conventionally called the |
|
26
|
|
|
|
|
|
|
** "standard coordinates". If the direction cosines are with |
|
27
|
|
|
|
|
|
|
** respect to a right-handed triad, (xi,eta) are also right-handed. |
|
28
|
|
|
|
|
|
|
** The units of (xi,eta) are, effectively, radians at the tangent |
|
29
|
|
|
|
|
|
|
** point. |
|
30
|
|
|
|
|
|
|
** |
|
31
|
|
|
|
|
|
|
** 3) The method used is to complete the star vector in the (xi,eta) |
|
32
|
|
|
|
|
|
|
** based triad and normalize it, then rotate the triad to put the |
|
33
|
|
|
|
|
|
|
** tangent point at the pole with the x-axis aligned to zero |
|
34
|
|
|
|
|
|
|
** longitude. Writing (a0,b0) for the celestial spherical |
|
35
|
|
|
|
|
|
|
** coordinates of the tangent point, the sequence of rotations is |
|
36
|
|
|
|
|
|
|
** (b-pi/2) around the x-axis followed by (-a-pi/2) around the |
|
37
|
|
|
|
|
|
|
** z-axis. |
|
38
|
|
|
|
|
|
|
** |
|
39
|
|
|
|
|
|
|
** 4) If vector v0 is not of unit length, the returned vector v will |
|
40
|
|
|
|
|
|
|
** be wrong. |
|
41
|
|
|
|
|
|
|
** |
|
42
|
|
|
|
|
|
|
** 5) If vector v0 points at a pole, the returned vector v will be |
|
43
|
|
|
|
|
|
|
** based on the arbitrary assumption that the longitude coordinate |
|
44
|
|
|
|
|
|
|
** of the tangent point is zero. |
|
45
|
|
|
|
|
|
|
** |
|
46
|
|
|
|
|
|
|
** 6) This function is a member of the following set: |
|
47
|
|
|
|
|
|
|
** |
|
48
|
|
|
|
|
|
|
** spherical vector solve for |
|
49
|
|
|
|
|
|
|
** |
|
50
|
|
|
|
|
|
|
** eraTpxes eraTpxev xi,eta |
|
51
|
|
|
|
|
|
|
** eraTpsts > eraTpstv < star |
|
52
|
|
|
|
|
|
|
** eraTpors eraTporv origin |
|
53
|
|
|
|
|
|
|
** |
|
54
|
|
|
|
|
|
|
** References: |
|
55
|
|
|
|
|
|
|
** |
|
56
|
|
|
|
|
|
|
** Calabretta M.R. & Greisen, E.W., 2002, "Representations of |
|
57
|
|
|
|
|
|
|
** celestial coordinates in FITS", Astron.Astrophys. 395, 1077 |
|
58
|
|
|
|
|
|
|
** |
|
59
|
|
|
|
|
|
|
** Green, R.M., "Spherical Astronomy", Cambridge University Press, |
|
60
|
|
|
|
|
|
|
** 1987, Chapter 13. |
|
61
|
|
|
|
|
|
|
** |
|
62
|
|
|
|
|
|
|
** Copyright (C) 2013-2019, NumFOCUS Foundation. |
|
63
|
|
|
|
|
|
|
** Derived, with permission, from the SOFA library. See notes at end of file. |
|
64
|
|
|
|
|
|
|
*/ |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
|
|
|
|
|
|
double x, y, z, f, r; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
/* Tangent point. */ |
|
70
|
0
|
|
|
|
|
|
x = v0[0]; |
|
71
|
0
|
|
|
|
|
|
y = v0[1]; |
|
72
|
0
|
|
|
|
|
|
z = v0[2]; |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
/* Deal with polar case. */ |
|
75
|
0
|
|
|
|
|
|
r = sqrt(x*x + y*y); |
|
76
|
0
|
0
|
|
|
|
|
if ( r == 0.0 ) { |
|
77
|
|
|
|
|
|
|
r = 1e-20; |
|
78
|
|
|
|
|
|
|
x = r; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
/* Star vector length to tangent plane. */ |
|
82
|
0
|
|
|
|
|
|
f = sqrt(1.0 + xi*xi + eta*eta); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
/* Apply the transformation and normalize. */ |
|
85
|
0
|
|
|
|
|
|
v[0] = (x - (xi*y + eta*x*z) / r) / f; |
|
86
|
0
|
|
|
|
|
|
v[1] = (y + (xi*x - eta*y*z) / r) / f; |
|
87
|
0
|
|
|
|
|
|
v[2] = (z + eta*r) / f; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
/* Finished. */ |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- |
|
93
|
|
|
|
|
|
|
** |
|
94
|
|
|
|
|
|
|
** |
|
95
|
|
|
|
|
|
|
** Copyright (C) 2013-2019, NumFOCUS Foundation. |
|
96
|
|
|
|
|
|
|
** All rights reserved. |
|
97
|
|
|
|
|
|
|
** |
|
98
|
|
|
|
|
|
|
** This library is derived, with permission, from the International |
|
99
|
|
|
|
|
|
|
** Astronomical Union's "Standards of Fundamental Astronomy" library, |
|
100
|
|
|
|
|
|
|
** available from http://www.iausofa.org. |
|
101
|
|
|
|
|
|
|
** |
|
102
|
|
|
|
|
|
|
** The ERFA version is intended to retain identical functionality to |
|
103
|
|
|
|
|
|
|
** the SOFA library, but made distinct through different function and |
|
104
|
|
|
|
|
|
|
** file names, as set out in the SOFA license conditions. The SOFA |
|
105
|
|
|
|
|
|
|
** original has a role as a reference standard for the IAU and IERS, |
|
106
|
|
|
|
|
|
|
** and consequently redistribution is permitted only in its unaltered |
|
107
|
|
|
|
|
|
|
** state. The ERFA version is not subject to this restriction and |
|
108
|
|
|
|
|
|
|
** therefore can be included in distributions which do not support the |
|
109
|
|
|
|
|
|
|
** concept of "read only" software. |
|
110
|
|
|
|
|
|
|
** |
|
111
|
|
|
|
|
|
|
** Although the intent is to replicate the SOFA API (other than |
|
112
|
|
|
|
|
|
|
** replacement of prefix names) and results (with the exception of |
|
113
|
|
|
|
|
|
|
** bugs; any that are discovered will be fixed), SOFA is not |
|
114
|
|
|
|
|
|
|
** responsible for any errors found in this version of the library. |
|
115
|
|
|
|
|
|
|
** |
|
116
|
|
|
|
|
|
|
** If you wish to acknowledge the SOFA heritage, please acknowledge |
|
117
|
|
|
|
|
|
|
** that you are using a library derived from SOFA, rather than SOFA |
|
118
|
|
|
|
|
|
|
** itself. |
|
119
|
|
|
|
|
|
|
** |
|
120
|
|
|
|
|
|
|
** |
|
121
|
|
|
|
|
|
|
** TERMS AND CONDITIONS |
|
122
|
|
|
|
|
|
|
** |
|
123
|
|
|
|
|
|
|
** Redistribution and use in source and binary forms, with or without |
|
124
|
|
|
|
|
|
|
** modification, are permitted provided that the following conditions |
|
125
|
|
|
|
|
|
|
** are met: |
|
126
|
|
|
|
|
|
|
** |
|
127
|
|
|
|
|
|
|
** 1 Redistributions of source code must retain the above copyright |
|
128
|
|
|
|
|
|
|
** notice, this list of conditions and the following disclaimer. |
|
129
|
|
|
|
|
|
|
** |
|
130
|
|
|
|
|
|
|
** 2 Redistributions in binary form must reproduce the above copyright |
|
131
|
|
|
|
|
|
|
** notice, this list of conditions and the following disclaimer in |
|
132
|
|
|
|
|
|
|
** the documentation and/or other materials provided with the |
|
133
|
|
|
|
|
|
|
** distribution. |
|
134
|
|
|
|
|
|
|
** |
|
135
|
|
|
|
|
|
|
** 3 Neither the name of the Standards Of Fundamental Astronomy Board, |
|
136
|
|
|
|
|
|
|
** the International Astronomical Union nor the names of its |
|
137
|
|
|
|
|
|
|
** contributors may be used to endorse or promote products derived |
|
138
|
|
|
|
|
|
|
** from this software without specific prior written permission. |
|
139
|
|
|
|
|
|
|
** |
|
140
|
|
|
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
141
|
|
|
|
|
|
|
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
142
|
|
|
|
|
|
|
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
143
|
|
|
|
|
|
|
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
144
|
|
|
|
|
|
|
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
145
|
|
|
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
146
|
|
|
|
|
|
|
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
147
|
|
|
|
|
|
|
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
148
|
|
|
|
|
|
|
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
149
|
|
|
|
|
|
|
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
150
|
|
|
|
|
|
|
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
151
|
|
|
|
|
|
|
** POSSIBILITY OF SUCH DAMAGE. |
|
152
|
|
|
|
|
|
|
** |
|
153
|
|
|
|
|
|
|
*/ |