source: trunk/MagicSoft/Cosy/catalog/Slalib.cc@ 921

Last change on this file since 921 was 921, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 1.2 KB
Line 
1#include "Slalib.h"
2
3#include <time.h>
4#include <iostream.h> // cout
5
6#include "slalib.h"
7
8Slalib::Slalib() : Timer()
9{
10 // p = pointer to MainFrame (not owner)
11
12 //
13 // calculate observers location (goe)
14 //
15 int status;
16 slaDaf2r(51, 38, 48.0, &fPhi, &status);
17 slaDaf2r( 9, 56, 36.0, &fElong, &status);
18
19 cout << "Latitude: 51\x9c 38'48.0\" = " << 360.0/D2PI*fPhi << " ";
20 cout << "Longitude: 9\x9c 56'36.0\" = " << 360.0/D2PI*fElong << endl;
21}
22
23Slalib::~Slalib()
24{
25}
26
27void Slalib::SetMjd(const double mjd)
28{
29 fMjd = mjd;
30 fAlpha = slaGmst(fMjd) + fElong;
31}
32
33void Slalib::SetMjd2Now()
34{
35 Now();
36 SetMjd(CalcMjd());
37// cout << "GetMjd: "<< (*this)() << " " << GetMjd() << endl;
38}
39
40void Slalib::SetMjd(const struct timeval *tm)
41{
42 SetTimer(tm);
43 SetMjd(CalcMjd());
44}
45
46
47ZdAz Slalib::XYZ2ZdAz(double coord[3]) const
48{
49 //
50 // -- xyz to spherical coordinates --
51 //
52 double ra, dec;
53 slaDcc2s(coord, &ra, &dec);
54
55 //
56 // radec[rad] -> hadec[rad]
57 //
58 const double ha = fAlpha-ra;
59
60 //
61 // hadec[rad] -> altaz[rad]
62 //
63 double alt, az;
64 slaDe2h(ha, dec, fPhi, &az, &alt);
65
66 return ZdAz(DPI/2-alt, az);
67}
Note: See TracBrowser for help on using the repository browser.