Changeset 16969 for trunk/FACT++/src
- Timestamp:
- 07/21/13 17:04:15 (11 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/makedata.cc
r16379 r16969 7 7 8 8 using namespace std; 9 10 // ------------------------------------------------------------------------ 11 12 double Angle(double ra, double dec, double r, double d) 13 { 14 const double theta0 = M_PI/2-d*M_PI/180; 15 const double phi0 = r*M_PI/12; 16 17 const double theta1 = M_PI/2-dec*M_PI/180; 18 const double phi1 = ra*M_PI/12; 19 20 const double x0 = sin(theta0) * cos(phi0); 21 const double y0 = sin(theta0) * sin(phi0); 22 const double z0 = cos(theta0); 23 24 const double x1 = sin(theta1) * cos(phi1); 25 const double y1 = sin(theta1) * sin(phi1); 26 const double z1 = cos(theta1); 27 28 double arg = x0*x1 + y0*y1 + z0*z1; 29 if(arg > 1.0) arg = 1.0; 30 if(arg < -1.0) arg = -1.0; 31 32 return acos(arg) * 180/M_PI; 33 } 9 using namespace Nova; 34 10 35 11 // ======================================================================== … … 92 68 // ------------------ Eval config --------------------- 93 69 94 const double lon = -(17.+53./60+26.525/3600);95 const double lat = 28.+45./60+42.462/3600;96 97 ln_lnlat_posn observer;98 observer.lng = lon;99 observer.lat = lat;100 101 70 Time time; 102 71 if (conf.Has("date-time")) … … 108 77 109 78 // -12: nautical 110 ln_rst_time sun_set; // Sun set with the same date than th provided date 111 ln_rst_time sun_rise; // Sun rise on the following day 112 ln_get_solar_rst_horizon(time.JD()-0.5, &observer, -12, &sun_set); 113 ln_get_solar_rst_horizon(time.JD()+0.5, &observer, -12, &sun_rise); 79 const RstTime sun_set = GetSolarRst(time.JD()-0.5, -12); // Sun set with the same date than th provided date 80 const RstTime sun_rise = GetSolarRst(time.JD()+0.5, -12); // Sun rise on the following day 114 81 115 82 const double jd = floor(time.Mjd())+2400001; … … 132 99 // ------------------ Precalc moon coord --------------------- 133 100 134 vector<pair< ln_equ_posn, double>> fMoonCoords;101 vector<pair<EquPosn, double>> fMoonCoords; 135 102 136 103 for (double h=0; h<1; h+=1./(24*12)) 137 104 { 138 ln_equ_posn moon; 139 ln_get_lunar_equ_coords_prec(jd+h, &moon, 0.01); 140 141 const double disk = ln_get_lunar_disk(jd+h); 105 const EquPosn moon = GetLunarEquCoords(jd+h); 106 const double disk = GetLunarDisk(jd+h); 142 107 143 108 fMoonCoords.emplace_back(moon, disk); … … 155 120 return 1; 156 121 157 Nova::EquPosn pos;122 EquPosn pos; 158 123 pos.ra = double((*row)[0])*15; 159 124 pos.dec = double((*row)[1]); … … 169 134 170 135 // get local position of source 171 const Nova::HrzPosn hrz = Nova::GetHrzFromEqu(pos, jd+h);136 const HrzPosn hrz = GetHrzFromEqu(pos, jd+h); 172 137 173 138 // Get moon properties and 174 const Nova::EquPosn moon = fMoonCoords[i].first; 175 const double disk = fMoonCoords[i].second; 176 177 const Nova::HrzPosn hrzm = Nova::GetHrzFromEqu(moon, jd+h); 139 const EquPosn moon = fMoonCoords[i].first; 140 const double disk = fMoonCoords[i].second; 141 const HrzPosn hrzm = GetHrzFromEqu(moon, jd+h); 178 142 179 143 // Distance between source and moon 180 const double angle = Angle(moon.ra, moon.dec, pos.ra, pos.dec);144 const double angle = GetAngularSeparation(moon, pos); 181 145 182 146 // Current prediction -
trunk/FACT++/src/makeplots.cc
r16379 r16969 13 13 14 14 using namespace std; 15 using namespace Nova; 15 16 16 17 // ------------------------------------------------------------------------ 17 18 double Angle(double ra, double dec, double r, double d)19 {20 const double theta0 = M_PI/2-d*M_PI/180;21 const double phi0 = r*M_PI/12;22 23 const double theta1 = M_PI/2-dec*M_PI/180;24 const double phi1 = ra*M_PI/12;25 26 const double x0 = sin(theta0) * cos(phi0);27 const double y0 = sin(theta0) * sin(phi0);28 const double z0 = cos(theta0);29 30 const double x1 = sin(theta1) * cos(phi1);31 const double y1 = sin(theta1) * sin(phi1);32 const double z1 = cos(theta1);33 34 double arg = x0*x1 + y0*y1 + z0*z1;35 if(arg > 1.0) arg = 1.0;36 if(arg < -1.0) arg = -1.0;37 38 return acos(arg) * 180/M_PI;39 }40 18 41 19 void CheckForGap(TCanvas &c, TGraph &g, double axis) … … 131 109 // Sun set with the same date than th provided date 132 110 // Sun rise on the following day 133 const Nova::RstTime sun_set = Nova::GetSolarRst(time.JD()-0.5, -12);134 const Nova::RstTime sun_rise = Nova::GetSolarRst(time.JD()+0.5, -12);111 const RstTime sun_set = GetSolarRst(time.JD()-0.5, -12); 112 const RstTime sun_rise = GetSolarRst(time.JD()+0.5, -12); 135 113 136 114 const double jd = floor(time.Mjd())+2400001; … … 149 127 // ------------------ Precalc moon coord --------------------- 150 128 151 vector<pair< Nova::EquPosn, double>> fMoonCoords;129 vector<pair<EquPosn, double>> fMoonCoords; 152 130 153 131 for (double h=0; h<1; h+=1./(24*12)) 154 132 { 155 const Nova::EquPosn moon = Nova::GetLunarEquCoords(jd+h, 0.01); 156 157 const double disk = Nova::GetLunarDisk(jd+h); 133 const EquPosn moon = GetLunarEquCoords(jd+h, 0.01); 134 const double disk = GetLunarDisk(jd+h); 158 135 159 136 fMoonCoords.emplace_back(moon, disk); … … 249 226 const string name = (*v)[0].c_str(); 250 227 251 Nova::EquPosn pos;228 EquPosn pos; 252 229 pos.ra = double((*v)[1])*15; 253 230 pos.dec = double((*v)[2]); … … 287 264 288 265 // get local position of source 289 const Nova::HrzPosn hrz = Nova::GetHrzFromEqu(pos, jd+h);266 const HrzPosn hrz = GetHrzFromEqu(pos, jd+h); 290 267 291 268 // Get moon properties and 292 const Nova::EquPosn moon = fMoonCoords[i].first; 293 const double disk = fMoonCoords[i].second; 294 295 const Nova::HrzPosn hrzm = Nova::GetHrzFromEqu(moon, jd+h); 269 const EquPosn moon = fMoonCoords[i].first; 270 const double disk = fMoonCoords[i].second; 271 const HrzPosn hrzm = GetHrzFromEqu(moon, jd+h); 296 272 297 273 if (v==res.begin()) … … 299 275 300 276 // Distance between source and moon 301 const double angle = Angle(moon.ra, moon.dec, pos.ra, pos.dec);277 const double angle = GetAngularSeparation(moon, pos); 302 278 303 279 // Current prediction
Note:
See TracChangeset
for help on using the changeset viewer.