source: trunk/Mars/mcore/nova.h@ 15245

Last change on this file since 15245 was 15207, checked in by tbretz, 11 years ago
Fixed a compilation issue and the coordinate system problem.
File size: 2.5 KB
Line 
1#ifndef MARS_Nova
2#define MARS_Nova
3
4#include <libnova/solar.h>
5#include <libnova/lunar.h>
6#include <libnova/rise_set.h>
7#include <libnova/transform.h>
8
9namespace Nova
10{
11 typedef ln_lnlat_posn LnLatPosn;
12 //typedef ln_hrz_posn HrzPosn;
13 typedef ln_equ_posn EquPosn;
14 typedef ln_rst_time RstTime;
15
16 struct ZdAzPosn;
17
18 // Warning: 0deg=South, 90deg=W
19 struct HrzPosn : public ln_hrz_posn
20 {
21 HrzPosn() { }
22 HrzPosn(const ZdAzPosn &);
23 };
24
25 struct ZdAzPosn
26 {
27 double zd;
28 double az;
29
30 ZdAzPosn() : zd(0), az(0) { }
31 ZdAzPosn(const HrzPosn &hrz) : zd(90-hrz.alt), az(hrz.az-180) { }
32
33 // This crahsed cint, but it could save up the dedicate structure HrzPosn :(
34 //operator HrzPosn() const { const HrzPosn p = { az-180, 90-zd}; return p; }
35 };
36
37 HrzPosn::HrzPosn(const ZdAzPosn &za) { alt = 90-za.zd; az = za.az-180; }
38
39
40
41 const LnLatPosn &ORM()
42 {
43 const static LnLatPosn obs = { -(17.+53./60+26.525/3600), 28.+45./60+42.462/3600 };
44 return obs;
45 }
46
47 HrzPosn GetHrzFromEqu(const EquPosn &equ, const LnLatPosn &obs, double jd)
48 {
49 HrzPosn hrz;
50 ln_get_hrz_from_equ(const_cast<EquPosn*>(&equ), const_cast<LnLatPosn*>(&obs), jd, &hrz);
51 return hrz;
52 }
53 HrzPosn GetHrzFromEqu(const EquPosn &equ, double jd)
54 {
55 return GetHrzFromEqu(equ, ORM(), jd);
56 }
57
58 EquPosn GetEquFromHrz(const HrzPosn &hrz, const LnLatPosn &obs, double jd)
59 {
60 EquPosn equ;
61 ln_get_equ_from_hrz(const_cast<HrzPosn*>(&hrz), const_cast<LnLatPosn*>(&obs), jd, &equ);
62 return equ;
63 }
64 EquPosn GetEquFromHrz(const HrzPosn &hrz, double jd)
65 {
66 return GetEquFromHrz(hrz, ORM(), jd);
67 }
68
69 RstTime GetSolarRst(double jd, const LnLatPosn &obs, double hrz=LN_SOLAR_STANDART_HORIZON)
70 {
71 RstTime rst;
72 ln_get_solar_rst_horizon(jd, const_cast<LnLatPosn*>(&obs), hrz, &rst);
73 return rst;
74 }
75 RstTime GetSolarRst(double jd, double hrz=LN_SOLAR_STANDART_HORIZON)
76 {
77 return GetSolarRst(jd, ORM(), hrz);
78 }
79
80 RstTime GetLunarRst(double jd, const LnLatPosn &obs=ORM())
81 {
82 RstTime rst;
83 ln_get_lunar_rst(jd, const_cast<LnLatPosn*>(&obs), &rst);
84 return rst;
85 }
86
87 double GetLunarDisk(double jd)
88 {
89 return ln_get_lunar_disk(jd);
90 }
91
92 EquPosn GetLunarEquCoords(double jd, double precision=0)
93 {
94 EquPosn equ;
95 ln_get_lunar_equ_coords_prec(jd, &equ, precision);
96 return equ;
97 }
98}
99
100#endif
Note: See TracBrowser for help on using the repository browser.