Line | |
---|
1 | #include "Slalib.h"
|
---|
2 |
|
---|
3 | #include <time.h>
|
---|
4 | #include <iostream> // cout
|
---|
5 |
|
---|
6 | #include "MPointing.h"
|
---|
7 |
|
---|
8 | #include "slalib.h"
|
---|
9 |
|
---|
10 | ClassImp(Slalib);
|
---|
11 |
|
---|
12 | using namespace std;
|
---|
13 |
|
---|
14 | Slalib::Slalib(MObservatory::LocationName_t key) : MObservatory(key)
|
---|
15 | {
|
---|
16 | }
|
---|
17 |
|
---|
18 | Double_t Slalib::Trunc(Double_t val)
|
---|
19 | {
|
---|
20 | // dint(A) - truncate to nearest whole number towards zero (double)
|
---|
21 | return val<0 ? TMath::Ceil(val) : TMath::Floor(val);
|
---|
22 | }
|
---|
23 |
|
---|
24 | void Slalib::SetMjd(double mjd)
|
---|
25 | {
|
---|
26 | fTime.SetMjd(mjd);
|
---|
27 |
|
---|
28 | fAlpha = slaGmst(GetMjd()) + GetElong();
|
---|
29 | }
|
---|
30 |
|
---|
31 | void Slalib::Now(double offset)
|
---|
32 | {
|
---|
33 | fTime.Now();
|
---|
34 | SetMjd(fTime.GetMjd()+offset/(24*60*60));
|
---|
35 | }
|
---|
36 |
|
---|
37 | ZdAz Slalib::XYZ2ZdAz(double coord[3]) const
|
---|
38 | {
|
---|
39 | //
|
---|
40 | // -- xyz to spherical coordinates --
|
---|
41 | //
|
---|
42 | double ra, dec;
|
---|
43 | slaDcc2s(coord, &ra, &dec);
|
---|
44 |
|
---|
45 | //
|
---|
46 | // radec[rad] -> hadec[rad]
|
---|
47 | //
|
---|
48 | const double ha = fAlpha-ra;
|
---|
49 |
|
---|
50 | //
|
---|
51 | // hadec[rad] -> altaz[rad]
|
---|
52 | //
|
---|
53 | double alt, az;
|
---|
54 | slaDe2h(ha, dec, GetPhi(), &az, &alt);
|
---|
55 |
|
---|
56 | return ZdAz(TMath::Pi()/2-alt, az);
|
---|
57 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.