[Kstars-devel] [kstars] kstars/tools: Fixing the conjunction predictions for long time durations. The step

Akarsh Simha akarshsimha at gmail.com
Mon Oct 10 05:22:37 UTC 2011


Git commit 04fc147a454ea43de5f5ba5644b27ab6dbb9109e by Akarsh Simha.
Committed on 10/10/2011 at 07:18.
Pushed by asimha into branch 'master'.

Fixing the conjunction predictions for long time durations. The step
size would be way too large if one was looking for conjunctions, of
say, Jupiter, over several 1000 years (which is what I was doing when
I ran into this).

This is still suboptimal code. I'd appreciate some analysis on this
and some ways to improve this code as well as the initial guess for
the step. It should not be overtly hard, since they are mostly
quasi-periodic stuff.

I want everyone to look at my ugly code (and fix it), so I'm CCing the
ML.
CCMAIL: kstars-devel at kde.org

M  +13   -1    kstars/tools/ksconjunct.cpp

http://commits.kde.org/kstars/04fc147a454ea43de5f5ba5644b27ab6dbb9109e

diff --git a/kstars/tools/ksconjunct.cpp b/kstars/tools/ksconjunct.cpp
index a483125..63d23df 100644
--- a/kstars/tools/ksconjunct.cpp
+++ b/kstars/tools/ksconjunct.cpp
@@ -52,7 +52,19 @@ QMap<long double, dms> KSConjunct::findClosestApproach(SkyObject& Object1, KSPla
   //  kDebug() << Object2.name() << ": RA = " << Object2.ra() -> toHMSString() << "; Dec = " << Object2.dec() -> toDMSString() << "\n";
   prevSign = 0;
   
-  step0 = (stopJD - startJD) / 4.0;
+  step0 = (stopJD - startJD) / 4.0;  // I'm an idiot for having done this without having the lines that follow -- asimha
+
+  // TODO: Work out a solid footing on which one can decide step0. -- asimha
+  if( step0 > 24.8 * 365.25 ) // Sample pluto's orbit (248.09 years) at least 10 times.
+      step0 = 24.8 * 365.25;
+
+  // FIXME: This can be done better, but for now, I'm doing it the dumb way -- asimha
+  if( Object1.name() == i18n( "Neptune" ) || Object2.name() == i18n( "Neptune" ) || Object1.name() == i18n( "Uranus" ) || Object2.name() == i18n( "Uranus" ) )
+      if( step0 > 3652.5 )
+          step0 = 3652.5;
+  if( Object1.name() == i18n( "Jupiter" ) || Object2.name() == i18n( "Jupiter" ) || Object1.name() == i18n( "Saturn" ) || Object2.name() == i18n( "Saturn" ) )
+      if( step0 > 365.25 )
+          step0 = 365;
   if(Object1.name() == i18n( "Mars" ) || Object2.name() == i18n( "Mars" ))
     if (step0 > 10.0)
       step0 = 10.0;


More information about the Kstars-devel mailing list