Skybright.cpp   Skybright.cpp 
skipping to change at line 30 skipping to change at line 30
#include <QDebug> #include <QDebug>
#include "Skybright.hpp" #include "Skybright.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
Skybright::Skybright() : SN(1.f) Skybright::Skybright() : SN(1.f)
{ {
setDate(2003, 8, 0); setDate(2003, 8, 0.f, 0.f);
setLocation(M_PI_4, 1000., 25.f, 40.f); setLocation(M_PI_4, 1000., 25.f, 40.f);
setSunMoon(0.5, 0.5); setSunMoon(0.5, 0.5);
} }
// month : 1=Jan, 12=Dec // month : 1=Jan, 12=Dec
// moonPhase in radian 0=Full Moon, PI/2=First Quadrant/Last Quadran, PI=No Moon // moonPhase in radian 0=Full Moon, PI/2=First Quadrant/Last Quadran, PI=No Moon
void Skybright::setDate(const int year, const int month, const float moonPh ase) void Skybright::setDate(const int year, const int month, const float moonPh ase, const float moonMag)
{ {
magMoon = -12.73f + 1.4896903f * fabsf(moonPhase) + 0.04310727f * po // GZ The original formula set by Schaefer computes lunar magnitude
wf(moonPhase, 4.f); here. But it does not take eclipse into account.
// For 0.16 we changed that. (Bug LP:#1471546)
// Maybe we can use the moon mag formula elsewhere, don't delete yet
!
Q_UNUSED(moonPhase);
//magMoon = -12.73f + 1.4896903f * fabsf(moonPhase) + 0.04310727f *
powf(moonPhase, 4.f);
magMoon=moonMag;
// GZ: Bah, a very crude estimate for the solar position... // GZ: Bah, a very crude estimate for the solar position...
RA = (month - 3.f) * 0.52359878f; RA = (month - 3) * 0.52359878f;
// Term for dark sky brightness computation. // Term for dark sky brightness computation.
// GZ: This works for a few 11-year solar cycles around 1992... ... cos((y-1992)/11 * 2pi) // GZ: This works for a few 11-year solar cycles around 1992... ... cos((y-1992)/11 * 2pi)
bNightTerm = 1.0e-13 + 0.3e-13 * cosf(0.57118f * (year-1992.f)); bNightTerm = 1.0e-13 + 0.3e-13 * cosf(0.57118f * (year-1992));
} }
void Skybright::setLocation(const float latitude, const float altitude, con st float temperature, const float relativeHumidity) void Skybright::setLocation(const float latitude, const float altitude, con st float temperature, const float relativeHumidity)
{ {
float sign_latitude = (latitude>=0.f) * 2.f - 1.f; float sign_latitude = (latitude>=0.f) * 2.f - 1.f;
// extinction Coefficient for V band // extinction Coefficient for V band
// GZ TODO: re-create UBVRI for colored extinction, and get RGB exti nction factors from SkyBright! // GZ TODO: re-create UBVRI for colored extinction, and get RGB exti nction factors from SkyBright!
float KR = 0.1066f * expf(-altitude/8200.f); // Rayleigh float KR = 0.1066f * expf(-altitude/8200.f); // Rayleigh
float KA = 0.1f * expf(-altitude/1500.f) * powf(1.f - 0.32f/logf(rel ativeHumidity/100.f) ,1.33f) * float KA = 0.1f * expf(-altitude/1500.f) * powf(1.f - 0.32f/logf(rel ativeHumidity/100.f) ,1.33f) *
 End of changes. 5 change blocks. 
6 lines changed or deleted 13 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/