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

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