source: trunk/MagicSoft/Cosy/catalog/SlaStars.cc@ 1018

Last change on this file since 1018 was 920, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.8 KB
Line 
1#include "SlaStars.h"
2
3#include "slalib.h"
4
5SlaStars::SlaStars() : Slalib()
6{
7}
8
9SlaStars::~SlaStars()
10{
11}
12
13void SlaStars::Set(const AltAz &altaz)
14{
15 fAltAz = altaz * D2PI/360.0;
16 fRaDec = CalcRaDec(fAltAz);
17}
18
19void SlaStars::Set(const ZdAz &zdaz)
20{
21 fAltAz = AltAz(DPI/2-zdaz.Zd(), zdaz.Az()) * D2PI/360.0;
22 fRaDec = CalcRaDec(fAltAz);
23}
24
25void SlaStars::Set(const RaDec &radec)
26{
27 fRaDec = radec * D2PI/360.0;
28 fAltAz = CalcAltAz(fRaDec);
29}
30
31void SlaStars::SetMjd(const double mjd)
32{
33 Slalib::SetMjd(mjd);
34
35 //
36 // ----- calculate star independent parameters ----------
37 //
38 slaMappa(2000.0, mjd, fAmprms);
39 slaAoppa(mjd, 0, // mjd, UT1-UTC
40 GetElong(), GetPhi(), 148, // g”ttingen long, lat, height
41 0, 0, // polar motion x, y-coordinate (radians)
42 273.155, 1013.25, 0.5, // temp, pressure, humidity
43 0.2, 0.0065, // wavelength, tropo lapse rate
44 fAoprms);
45}
46
47RaDec SlaStars::CalcRaDec(const AltAz &altaz) const
48{
49 return CalcRaDec(ZdAz(DPI/2-altaz.Alt(), altaz.Az()));
50}
51
52RaDec SlaStars::CalcRaDec(const ZdAz &zdaz) const
53{
54 //
55 // -- observed to apparent --
56 // Workaraound for slalib: discard const
57 //
58 double r=0, d=0;
59 slaOapqk((char*)"A", zdaz.Az(), zdaz.Zd(), (double*)fAoprms, &r, &d);
60
61 //
62 // -- apparent to mean --
63 // Workaraound for slalib: discard const
64 //
65 double ra, dec;
66 slaAmpqk(r, d, (double*)fAmprms, &ra, &dec);
67
68 return RaDec(ra, dec);
69}
70
71ZdAz SlaStars::CalcZdAz(const RaDec &radec) const
72{
73 //
74 // ---- Mean to apparent ----
75 //
76
77 double r=0, d=0;
78 slaMapqkz(radec.Ra(), radec.Dec(), (double*)fAmprms, &r, &d);
79 //
80 // Doesn't work - don't know why
81 //
82 // slaMapqk (radec.Ra(), radec.Dec(), rdpm.Ra(), rdpm.Dec(),
83 // 0, 0, (double*)fAmprms, &r, &d);
84 //
85
86 //
87 // -- apparent to observed --
88 //
89 double r1=0; // ra
90 double d1=0; // dec
91 double h0=0; // ha
92
93 double zd;
94 double az;
95 slaAopqk (r, d, (double*)fAoprms,
96 &az, // observed azimuth (radians: N=0,E=90)
97 &zd, // observed zenith distance (radians) [-pi/2, pi/2]
98 &h0, // observed hour angle (radians)
99 &d1, // observed declination (radians)
100 &r1); // observed right ascension (radians)
101
102 return ZdAz(zd, az);
103}
104AltAz SlaStars::CalcAltAz(const RaDec &radec) const
105{
106 ZdAz zdaz = CalcZdAz(radec);
107 return AltAz(DPI/2-zdaz.Zd(), zdaz.Az());
108}
109
110ZdAz SlaStars::GetApproxVel(const RaDec &radec) const // [rad/rad]
111{
112 double az, vaz, aaz;
113 double el, vel, ael;
114 double pa, vpa, apa;
115 slaAltaz(GetAlpha()-radec.Ra(), radec.Dec(), GetPhi(),
116 &az, &vaz, &aaz,
117 &el, &vel, &ael,
118 &pa, &vpa, &apa);
119
120 return ZdAz(-vel, vaz);
121}
Note: See TracBrowser for help on using the repository browser.