Version: 1.2.5 (using KDE KDE 3.5.5) Installed from: Fedora RPMs Compiler: Fedora core release 6 i386, kernel 2.6.18-1.2869.fc6 OS: Linux Select any location or city on earth, and search for planetary object Mars or Sun and right click that and select for information, a information window comes up and shows correctly that object I selected, but magnitude data is error, it can't be 17.0 for planet Mars and not 0.0 for the Sun either.
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@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; /* Computation of the visual magnitude (V band) of the planet. * Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) @@ -216,17 +217,18 @@ float magnitude = 30; double param = 5 * log10(rsun() * rearth() ); + double f1 = phase/100.; if ( name() == "Mercury" ) { - if ( f1 > 1.5 ) f1 = 1.5; //JH: but this will never be true + if ( phase > 150. ) f1 = 1.5; magnitude = -0.36 + param + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1; } if ( name() =="Venus") magnitude = -4.29 + param + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1; if( name() == "Mars") - magnitude = -1.52 + param + 16.*f1; //JH: was + 0.016*phase; + magnitude = -1.52 + param + 0.016*phase; if( name() == "Jupiter") - magnitude = -9.25 + param + 0.5*f1; //JH: was + 0.005*phase; + magnitude = -9.25 + param + 0.005*phase; if( name() == "Saturn") { double T = num->julianCenturies(); @@ -235,15 +237,15 @@ double sinx = -cos(d0)*cosDec*cos(a0 - ra()->radians()); sinx = fabs(sinx-sin(d0)*sinDec); double rings = -2.6*sinx + 1.25*sinx*sinx; - magnitude = -8.88 + param + 4.4*f1 + rings; //JH: was + 0.044*phase + rings + magnitude = -8.88 + param + 0.044*phase + rings; } if( name() == "Uranus") - magnitude = -7.19 + param + 0.28*f1; //JH: was 0.0028*phase; + magnitude = -7.19 + param + 0.0028*phase; if( name() == "Neptune") magnitude = -6.87 + param; if( name() == "Pluto" ) - magnitude = -1.01 + param + 4.1*f1; //JH: was 0.041*phase; + magnitude = -1.01 + param + 0.041*phase; setMag(magnitude); } --- branches/KDE/3.5/kdeedu/kstars/kstars/kssun.cpp #645105:645106 @@ -30,6 +30,7 @@ plong0 = 282.768422; //longitude of sun at perigee for JD0 e0 = 0.016713; //eccentricity of Earth's orbit at JD0 */ + setMag( -26.73 ); } bool KSSun::loadData() {
SVN commit 645113 by harris: Forward port of fix for bug #139676. The sun is now assigned its correct magnitude value (-26.7) and the calculation of planet magnitudes is now correct. CCBUG: 139676 M +13 -11 ksplanetbase.cpp M +3 -1 kssun.cpp --- trunk/KDE/kdeedu/kstars/kstars/ksplanetbase.cpp #645112:645113 @@ -224,10 +224,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; /* Computation of the visual magnitude (V band) of the planet. * Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) @@ -238,17 +239,18 @@ float magnitude = 30; double param = 5 * log10(rsun() * rearth() ); + double f1 = phase/100.; if ( name() == "Mercury" ) { - if ( f1 > 1.5 ) f1 = 1.5; //JH: but this will never be true + if ( phase > 150. ) f1 = 1.5; magnitude = -0.36 + param + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1; } if ( name() =="Venus") magnitude = -4.29 + param + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1; if( name() == "Mars") - magnitude = -1.52 + param + 16.*f1; //JH: was + 0.016*phase; - if( name() == "Jupiter") - magnitude = -9.25 + param + 0.5*f1; //JH: was + 0.005*phase; + magnitude = -1.52 + param + 0.016*phase; + if( name() == "Jupiter") + magnitude = -9.25 + param + 0.005*phase; if( name() == "Saturn") { double T = num->julianCenturies(); @@ -257,15 +259,15 @@ double sinx = -cos(d0)*cosDec*cos(a0 - ra()->radians()); sinx = fabs(sinx-sin(d0)*sinDec); double rings = -2.6*sinx + 1.25*sinx*sinx; - magnitude = -8.88 + param + 4.4*f1 + rings; //JH: was + 0.044*phase + rings + magnitude = -8.88 + param + 0.044*phase + rings; } if( name() == "Uranus") - magnitude = -7.19 + param + 0.28*f1; //JH: was 0.0028*phase; + magnitude = -7.19 + param + 0.0028*phase; if( name() == "Neptune") magnitude = -6.87 + param; if( name() == "Pluto" ) - magnitude = -1.01 + param + 4.1*f1; //JH: was 0.041*phase; + magnitude = -1.01 + param + 0.041*phase; setMag(magnitude); } --- trunk/KDE/kdeedu/kstars/kstars/kssun.cpp #645112:645113 @@ -25,7 +25,9 @@ KSSun::KSSun( KStarsData *kd ) : KSPlanet( kd, I18N_NOOP( "Sun" ), "sun.png", Qt::yellow, 1392000. /*diameter in km*/ ) -{} +{ + setMag( -26.73 ); +} bool KSSun::loadData() { OrbitDataColl odc;