source: trunk/FACT++/pal/palDtp2s.c@ 19907

Last change on this file since 19907 was 18347, checked in by tbretz, 9 years ago
File size: 2.5 KB
Line 
1/*
2*+
3* Name:
4* palDtp2s
5
6* Purpose:
7* Tangent plane to spherical coordinates
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* palDtp2s( double xi, double eta, double raz, double decz,
17* double *ra, double *dec);
18
19* Arguments:
20* xi = double (Given)
21* First rectangular coordinate on tangent plane (radians)
22* eta = double (Given)
23* Second rectangular coordinate on tangent plane (radians)
24* raz = double (Given)
25* RA spherical coordinate of tangent point (radians)
26* decz = double (Given)
27* Dec spherical coordinate of tangent point (radians)
28* ra = double * (Returned)
29* RA spherical coordinate of point to be projected (radians)
30* dec = double * (Returned)
31* Dec spherical coordinate of point to be projected (radians)
32
33* Description:
34* Transform tangent plane coordinates into spherical.
35
36* Authors:
37* PTW: Pat Wallace (STFC)
38* TIMJ: Tim Jenness (JAC, Hawaii)
39* {enter_new_authors_here}
40
41* History:
42* 2012-02-08 (TIMJ):
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) 1995 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
76#include <math.h>
77
78void
79palDtp2s ( double xi, double eta, double raz, double decz,
80 double *ra, double *dec ) {
81
82 double cdecz;
83 double denom;
84 double sdecz;
85 double d;
86
87 sdecz = sin(decz);
88 cdecz = cos(decz);
89 denom = cdecz - eta * sdecz;
90 d = atan2(xi, denom) + raz;
91 *ra = eraAnp(d);
92 *dec = atan2(sdecz + eta * cdecz, sqrt(xi * xi + denom * denom));
93
94 return;
95}
Note: See TracBrowser for help on using the repository browser.