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

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