~ubuntu-branches/ubuntu/raring/starlink-pal/raring-proposed

« back to all changes in this revision

Viewing changes to palGe50.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2012-03-28 11:00:00 UTC
  • Revision ID: package-import@ubuntu.com-20120328110000-9iw40yuy69wuk7po
Tags: upstream-0.1.0
ImportĀ upstreamĀ versionĀ 0.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
*+
 
3
*  Name:
 
4
*     palGe50
 
5
 
 
6
*  Purpose:
 
7
*     Transform Galactic Coordinate to B1950 FK4
 
8
 
 
9
*  Language:
 
10
*     Starlink ANSI C
 
11
 
 
12
*  Type of Module:
 
13
*     Library routine
 
14
 
 
15
*  Invocation:
 
16
*     palGe50( double dl, double db, double *dr, double *dd );
 
17
 
 
18
*  Arguments:
 
19
*     dl = double (Given)
 
20
*        Galactic longitude (radians)
 
21
*     db = double (Given)
 
22
*        Galactic latitude (radians)
 
23
*     dr = double * (Returned)
 
24
*        B9150.0 FK4 RA.
 
25
*     dd = double * (Returned)
 
26
*        B1950.0 FK4 Dec.
 
27
 
 
28
*  Description:
 
29
*     Transformation from IAU 1958 galactic coordinates to
 
30
*     B1950.0 'FK4' equatorial coordinates.
 
31
 
 
32
*  Authors:
 
33
*     TIMJ: Tim Jenness (JAC, Hawaii)
 
34
*     {enter_new_authors_here}
 
35
 
 
36
*  Notes:
 
37
*     - The equatorial coordinates are B1950.0 'FK4'. Use the routine
 
38
*     palGaleq if conversion to J2000.0 coordinates is required.
 
39
 
 
40
*  See Also:
 
41
*     - Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960)
 
42
 
 
43
*  History:
 
44
*     2012-03-23 (TIMJ):
 
45
*        Initial version
 
46
*     {enter_further_changes_here}
 
47
 
 
48
*  Copyright:
 
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 General Public License as
 
55
*     published by the Free Software Foundation; either version 3 of
 
56
*     the License, or (at your option) any later version.
 
57
*
 
58
*     This program is distributed in the hope that it will be
 
59
*     useful, but WITHOUT ANY WARRANTY; without even the implied
 
60
*     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 
61
*     PURPOSE. See the GNU General Public License for more details.
 
62
*
 
63
*     You should have received a copy of the GNU General Public License
 
64
*     along with this program; if not, write to the Free Software
 
65
*     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
66
*     MA 02110-1301, USA.
 
67
 
 
68
*  Bugs:
 
69
*     {note_any_bugs_here}
 
70
*-
 
71
*/
 
72
 
 
73
#include "pal.h"
 
74
#include "sofa.h"
 
75
 
 
76
void palGe50 ( double dl, double db, double * dr, double * dd ) {
 
77
 
 
78
/*
 
79
 *  L2,B2 system of galactic coordinates
 
80
 *
 
81
 *  P = 192.25       RA of galactic north pole (mean B1950.0)
 
82
 *  Q =  62.6        inclination of galactic to mean B1950.0 equator
 
83
 *  R =  33          longitude of ascending node
 
84
 *
 
85
 *  P,Q,R are degrees
 
86
 *
 
87
 *
 
88
 *  Equatorial to galactic rotation matrix
 
89
 *
 
90
 *  The Euler angles are P, Q, 90-R, about the z then y then
 
91
 *  z axes.
 
92
 *
 
93
 *         +CP.CQ.SR-SP.CR     +SP.CQ.SR+CP.CR     -SQ.SR
 
94
 *
 
95
 *         -CP.CQ.CR-SP.SR     -SP.CQ.CR+CP.SR     +SQ.CR
 
96
 *
 
97
 *         +CP.SQ              +SP.SQ              +CQ
 
98
 *
 
99
 */
 
100
 
 
101
  double rmat[3][3] = {
 
102
    { -0.066988739415,-0.872755765852,-0.483538914632 },
 
103
    { +0.492728466075,-0.450346958020,+0.744584633283 },
 
104
    { -0.867600811151,-0.188374601723,+0.460199784784 }
 
105
  };
 
106
 
 
107
  double v1[3], v2[3], r, d, re, de;
 
108
 
 
109
  /* Spherical to cartesian */
 
110
  iauS2c( dl, db, v1 );
 
111
 
 
112
  /* Rotate to mean B1950.0 */
 
113
  iauTrxp( rmat, v1, v2 );
 
114
 
 
115
  /* Cartesian to spherical */
 
116
  iauC2s( v2, &r, &d );
 
117
 
 
118
  /* Introduce E-terms */
 
119
  palAddet( r, d, 1950.0, &re, &de );
 
120
 
 
121
  /* Express in conventional ranges */
 
122
  *dr = iauAnp( re );
 
123
  *dd = iauAnpm( de );
 
124
 
 
125
}