[Kstars-devel] branches/work/kdeedu_kstars_htm/kstars/kstars

James Bowlin bowlin at mindspring.com
Tue Aug 7 23:08:53 CEST 2007


SVN commit 697464 by jbowlin:

One of the atan2 calls (the 2nd of 3 in ksplanetbase.cpp) did not work
in the htm branch even though the exact same code does work in the
trunk.  It caused some of the planets to wander away from the ecliptic
and also caused these same ones to appear to be stuck to one position on
the screen which was easy to see by setting the update interval to one
minute instead of the default one second.  Everything else slowly spun
while those planets hung in place.

I have no idea why atan2 wouldn't work in this situation and I am
baffled that it works in the trunk and not in the branch.  I won't
blame anyone if they don't believe me.  I find it very hard to believe
myself.

FWIW I'm using GCC version 4.1.2 on a Gentoo dual core AMD64 system.
I'd be curious to see if anyone else can reproduce the problem by
updating their copy of kdeedu_kstars_htm to revision 697184.

CCMAIL: kstars-devel at kde.org


 M  +5 -1      ksplanetbase.cpp  


--- branches/work/kdeedu_kstars_htm/kstars/kstars/ksplanetbase.cpp #697463:697464
@@ -119,7 +119,11 @@
 
 	HA2.setD( LST->Degrees() - ra()->Degrees() );
 	cosHA2 = cos( HA2.radians() );
-	temp.setRadians( atan2( cosHA2*( r*sinDec/6378.14 - rsinp ), r*cosDec*cosHA/6378.14 - rcosp ) );
+
+	//temp.setRadians( atan2( cosHA2*( r*sinDec/6378.14 - rsinp ), r*cosDec*cosHA/6378.14 - rcosp ) );
+	// The atan2() version above makes the planets move crazy in the htm branch -jbb
+	temp.setRadians( atan( cosHA2*( r*sinDec/6378.14 - rsinp )/( r*cosDec*cosHA/6378.14 - rcosp ) ) );
+
 	setDec( temp );
 
 	EquatorialToEcliptic( num->obliquity() );


More information about the Kstars-devel mailing list