FACT++  1.0
palPa.c
Go to the documentation of this file.
1 /*
2 *+
3 * Name:
4 * palPa
5 
6 * Purpose:
7 * HA, Dec to Parallactic Angle
8 
9 * Language:
10 * Starlink ANSI C
11 
12 * Type of Module:
13 * Library routine
14 
15 * Invocation:
16 * double palPa( double ha, double dec, double phi );
17 
18 * Arguments:
19 * ha = double (Given)
20 * Hour angle in radians (Geocentric apparent)
21 * dec = double (Given)
22 * Declination in radians (Geocentric apparent)
23 * phi = double (Given)
24 * Observatory latitude in radians (geodetic)
25 
26 * Returned Value:
27 * palPa = double
28 * Parallactic angle in the range -pi to +pi.
29 
30 * Description:
31 * Converts HA, Dec to Parallactic Angle.
32 
33 * Authors:
34 * PTW: Patrick T. Wallace
35 * TIMJ: Tim Jenness (JAC, Hawaii)
36 * {enter_new_authors_here}
37 
38 * Notes:
39 * - The parallactic angle at a point in the sky is the position
40 * angle of the vertical, i.e. the angle between the direction to
41 * the pole and to the zenith. In precise applications care must
42 * be taken only to use geocentric apparent HA,Dec and to consider
43 * separately the effects of atmospheric refraction and telescope
44 * mount errors.
45 * - At the pole a zero result is returned.
46 
47 * History:
48 * 2012-03-02 (TIMJ):
49 * Initial version
50 * Adapted with permission from the Fortran SLALIB library.
51 * {enter_further_changes_here}
52 
53 * Copyright:
54 * Copyright (C) 1995 Rutherford Appleton Laboratory
55 * Copyright (C) 2012 Science and Technology Facilities Council.
56 * All Rights Reserved.
57 
58 * Licence:
59 * This program is free software; you can redistribute it and/or
60 * modify it under the terms of the GNU General Public License as
61 * published by the Free Software Foundation; either version 3 of
62 * the License, or (at your option) any later version.
63 *
64 * This program is distributed in the hope that it will be
65 * useful, but WITHOUT ANY WARRANTY; without even the implied
66 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
67 * PURPOSE. See the GNU General Public License for more details.
68 *
69 * You should have received a copy of the GNU General Public License
70 * along with this program; if not, write to the Free Software
71 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
72 * MA 02110-1301, USA.
73 
74 * Bugs:
75 * {note_any_bugs_here}
76 *-
77 */
78 
79 #include "pal.h"
80 
81 #include <math.h>
82 
83 double palPa( double ha, double dec, double phi ) {
84  double cp, sqsz, cqsz;
85 
86  cp = cos(phi);
87  sqsz = cp * sin(ha);
88  cqsz = sin(phi) * cos(dec) - cp * sin(dec) * cos(ha);
89  if (sqsz == 0.0 && cqsz == 0.0) cqsz = 1.0;
90  return atan2( sqsz, cqsz );
91 }
double palPa(double ha, double dec, double phi)
Definition: palPa.c:83