[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Tue Jan 15 16:14:45 CET 2008


SVN commit 761886 by harris:

Fix embarrasing moon phase bug (the bright side of the moon pointed
away from the Sun).  The problem was not with the calculation of the
phase angle itself, it was that all the planets' position angles on
the sky were wrong by 180 dgrees.  This was caused by the move from
atan() to atan2() in calculating the position angle.  atan() masked
the sign error which got exposed when atan2() was used.

Thanks for letting me know about this James.

CCMAIL: kstars-devel at kde.org




 M  +7 -3      ksplanetbase.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/ksplanetbase.cpp #761885:761886
@@ -184,16 +184,20 @@
     SkyPoint test;
     dms newELat( ecLat()->Degrees() + 1.0 );
     test.setFromEcliptic( num->obliquity(), ecLong(), &newELat );
-    double dx = test.ra()->Degrees() - ra()->Degrees();
-    double dy = dec()->Degrees() - test.dec()->Degrees();
+    double dx = ra()->Degrees() - test.ra()->Degrees(); 
+    double dy = test.dec()->Degrees() - dec()->Degrees();
     double pa;
     if ( dy ) {
-        pa = atan2( dx, dy )*180.0/dms::PI;
+      pa = atan2( dx, dy )*180.0/dms::PI;
     } else {
         pa = 90.0;
         if ( dx > 0 ) pa = -90.0;
     }
     setPA( pa );
+
+    //DEBUG
+    kDebug() << QString("%1: %2 %3 %4").arg(name()).arg(pa).arg(dx).arg(dy) << endl;
+
 }
 
 double KSPlanetBase::labelOffset() const {


More information about the Kstars-devel mailing list