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

Last change on this file since 1415 was 1109, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 1.4 KB
Line 
1#include "SlaPlanets.h"
2
3#include <iostream.h>
4
5#include "slalib.h"
6
7ClassImp(SlaPlanets);
8
9SlaPlanets::SlaPlanets() : Slalib(), fDt(slaDt(2000.0)/60./60./24.)
10{
11}
12
13SlaPlanets::~SlaPlanets()
14{
15}
16
17void SlaPlanets::SetMjd(const double mjd)
18{
19 Slalib::SetMjd(mjd);
20
21 //
22 // coordinates of earth: heliocentric, equatoril, J2000
23 //
24 double veb[3]; // barycentric velocity
25 double ceb[3]; // barycentric coordinates
26 double veh[3]; // heliocentric velocity
27
28 slaEvp(mjd + fDt, 2000.0, veb, ceb, veh, fEarth);
29}
30
31void SlaPlanets::UpdatePlanetPos(ePlanets_t planet)
32{
33 double cp[6] = { 0, 0, 0, 0, 0, 0 };
34
35 double coord[6];
36
37 switch (planet)
38 {
39 case kEMoon:
40 //
41 // -- approximate geocentric pos and vel --
42 //
43 slaDmoon(GetMjd() + fDt, coord);
44 break;
45
46 case kEMercury:
47 case kEVenus:
48 case kEMars:
49 case kEJupiter:
50 case kESaturn:
51 case kEUranus:
52 case kENeptune:
53 case kEPluto:
54 {
55 //
56 // coordinates of planet: heliocentric, equatoril, J2000
57 //
58
59 int rc;
60 slaPlanet(GetMjd(), planet, cp, &rc);
61
62 if (rc)
63 return;
64 }
65 // !! Fall through!
66
67 case kESun:
68 coord[0] = cp[0] - fEarth[0];
69 coord[1] = cp[1] - fEarth[1];
70 coord[2] = cp[2] - fEarth[2];
71 break;
72 }
73
74 fZdAz[planet] = XYZ2ZdAz(coord);
75}
Note: See TracBrowser for help on using the repository browser.