/
PlanetData.h
74 lines (57 loc) · 2.03 KB
/
PlanetData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*****************************************************************************\
* PlanetData.h
*
* Handles planetary motion calculations and conversions
*
* author: mark huss (mark@mhuss.com)
* Based on Bill Gray's open-source code at projectpluto.com
*
\*****************************************************************************/
#if !defined( PLANET_DATA__H )
#define PLANET_DATA__H
#include "AstroOps.h"
class ObsInfo;
// bodies of interest
//
enum Planet { NAP=-1, // NotAPlanet
SUN=0, MERCURY=1, VENUS=2, EARTH=3, MARS=4, JUPITER=5,
SATURN=6, URANUS=7, NEPTUNE=8, PLUTO=9, LUNA=10 };
class PlanetData {
public:
PlanetData() : m_planet( NAP ) {}
PlanetData( Planet planet, double jd, ObsInfo& oi ) {
calc( planet, jd, oi );
}
// Calculate the data for a given planet, jd, and location
// This function must be called (directly or via c'tor) before calling
// any of the other fns!
//
void calc( Planet planet, double jd, ObsInfo& oi );
Planet planet() const { return m_planet; }
double jd() const { return ( NAP == m_planet ) ? -1. : m_jd; }
double hourAngle() const { return ( NAP == m_planet ) ? -1. : m_hourAngle; }
double eclipticLon() const { return ( NAP == m_planet ) ? -1. : m_eclipticLon; }
double eclipticLat() const { return ( NAP == m_planet ) ? -1. : m_eclipticLat; }
double radius() const { return ( NAP == m_planet ) ? -1. : m_r; }
// The &3's will limit index GPFs with low perf. penalty
const double eclipticLoc(int i) const {
return ( NAP == m_planet ) ? -1. : m_eclipticLoc[i & 3];
}
const double equatorialLoc(int i) const {
return ( NAP == m_planet ) ? -1. : m_equatorialLoc[i & 3];
}
const double altazLoc(int i) const {
return ( NAP == m_planet ) ? -1. : m_altazLoc[i & 3];
}
private:
Planet m_planet;
double m_jd;
double m_r;
double m_eclipticLon;
double m_eclipticLat;
double m_hourAngle;
AstroVector m_eclipticLoc;
AstroVector m_equatorialLoc;
AstroVector m_altazLoc;
};
#endif /* #if !defined( PLANET_DATA__H ) */