branches/KDE/3.5/kdeedu/kstars/kstars
Jason Harris <kstars <at> 30doradus.org>
2007-03-21 17:31:45 GMT
SVN commit 645106 by harris:
Fixing bug #139676. There was a bug in the calculation of a planet's
phase angle, which resulted in nonsense magnitudes (most obviously in
Mars). For the Sun, the apparent magnitude was never set, so it
displayed 0.0 instead of the true value of -26.73.
I will forward-port to trunk as well.
BUG: 139676
CCMAIL: kstars-devel <at> kde.org
M +12 -10 ksplanetbase.cpp
M +1 -0 kssun.cpp
--- branches/KDE/3.5/kdeedu/kstars/kstars/ksplanetbase.cpp #645105:645106
@@ -202,10 +202,11 @@
double cosDec, sinDec;
dec()->SinCos(cosDec, sinDec);
- //JH: Fixing calculation of phase. Using formula from
- //"Practical Astronomy With Your Calculator":
- double d = ecLong()->radians() - helEcLong()->radians();
- double f1 = 0.5*( 1 + cos( d ) );
+ /* Phase of the planet in degrees */
+ double earthSun = 1.;
+ double cosPhase = (rsun()*rsun() + rearth()*rearth() - earthSun*earthSun)
+ / (2 * rsun() * rearth() );
+ double phase = acos ( cosPhase ) * 180.0 / dms::PI;
(Continue reading)