Ephemeris: Exposure of the moon's absolute attributes in the property tree.
This includes the moon's absolute position, age and phase. For this, the new simgear MoonPos::get*() functions are tied to the property tree at "/ephemeris/moon/" using a new tieMoonPos() function. In addition the moon illumination factor is exposed by tying the simgear MoonPos::getIlluminanceFactor() function to the /environment/moonlight property. This is a number ranging between 0 and 1 based on the log of the illuminance of the moon outside the atmosphere. It is calculated as factor = (log(I) - max_loglux) / (max_loglux - min_loglux) + 1.0, The illuminance of the moon outside the atmosphere, I, is from equation 20 from: Krisciunas K. and Schaefer B.E. (1991). A model of the brightness of moonlight, Publ. Astron. Soc. Pacif. 103(667), 1033-1039 (DOI: http://dx.doi.org/10.1086/132921). For more background, see http://forum.flightgear.org/viewtopic.php?f=47&t=28201&start=60#p270516 .
This commit is contained in:
parent
6e62228c1d
commit
b574728411
1 changed files with 14 additions and 0 deletions
|
@ -33,6 +33,11 @@ static void tieStar(const char* prop, Star* s, double (Star::*getter)() const)
|
|||
fgGetNode(prop, true)->tie(SGRawValueMethods<Star, double>(*s, getter, NULL));
|
||||
}
|
||||
|
||||
static void tieMoonPos(const char* prop, MoonPos* s, double (MoonPos::*getter)() const)
|
||||
{
|
||||
fgGetNode(prop, true)->tie(SGRawValueMethods<MoonPos, double>(*s, getter, NULL));
|
||||
}
|
||||
|
||||
Ephemeris::Ephemeris() :
|
||||
_impl(NULL),
|
||||
_latProp(NULL)
|
||||
|
@ -60,6 +65,15 @@ void Ephemeris::init()
|
|||
tieStar("/ephemeris/sun/ye", _impl->get_sun(), &Star::getye);
|
||||
tieStar("/ephemeris/sun/lat-deg", _impl->get_sun(), &Star::getLat);
|
||||
|
||||
tieMoonPos("/ephemeris/moon/xg", _impl->get_moon(), &MoonPos::getxg);
|
||||
tieMoonPos("/ephemeris/moon/yg", _impl->get_moon(), &MoonPos::getyg);
|
||||
tieMoonPos("/ephemeris/moon/ze", _impl->get_moon(), &MoonPos::getze);
|
||||
tieMoonPos("/ephemeris/moon/ye", _impl->get_moon(), &MoonPos::getye);
|
||||
tieMoonPos("/ephemeris/moon/lat-deg", _impl->get_moon(), &MoonPos::getLat);
|
||||
tieMoonPos("/ephemeris/moon/age", _impl->get_moon(), &MoonPos::getAge);
|
||||
tieMoonPos("/ephemeris/moon/phase", _impl->get_moon(), &MoonPos::getPhase);
|
||||
tieMoonPos("/environment/moonlight", _impl->get_moon(), &MoonPos::getIlluminanceFactor);
|
||||
|
||||
_latProp = fgGetNode("/position/latitude-deg", true);
|
||||
|
||||
update(0.0);
|
||||
|
|
Loading…
Add table
Reference in a new issue