[Kstars-devel] [kstars] kstars/skyobjects: Short circuit a whole lot of proper motion, precession, nutation,

Akarsh Simha akarshsimha at gmail.com
Sun Jul 17 11:26:34 CEST 2011


Git commit 832469e64f222e6d1cc9da77a7b4587db20c05ba by Akarsh Simha.
Committed on 17/07/2011 at 11:16.
Pushed by asimha into branch 'master'.

Short circuit a whole lot of proper motion, precession, nutation,
aberration calculations if the time change is insignificantly small
compared to the time-scales of these effects.

Potentially dangerous. I've already found one bug in my code which I'm
going to fix right away.

The two primary factors leading to slow drawing are the drawing itself
and the JIT Update on DeepStarComponent. While using OpenGL rendering,
the former bottleneck is not as dominant as the latter one. This is
expected to make significant differences to FPS in OpenGL mode. In
QPainter mode, there were noticable differences seen using a profiler,
but very little visible difference (although there was visual evidence
of some improvement).

CCMAIL: kstars-devel at kde.org

M  +8    -1    kstars/skyobjects/starobject.cpp
M  +1    -1    kstars/skyobjects/skypoint.h

http://commits.kde.org/kstars/832469e64f222e6d1cc9da77a7b4587db20c05ba

diff --git a/kstars/skyobjects/skypoint.h b/kstars/skyobjects/skypoint.h
index 494dd0f..4ca7d75 100644
--- a/kstars/skyobjects/skypoint.h
+++ b/kstars/skyobjects/skypoint.h
@@ -502,12 +502,12 @@ protected:
     	*/
     void precess(const KSNumbers *num);
 
+    long double   lastPrecessJD; // JD at which the last coordinate update (see updateCoords) for this SkyPoint was done
 
 private:
     dms RA0, Dec0; //catalog coordinates
     dms RA, Dec; //current true sky coordinates
     dms Alt, Az;
-    long double   lastPrecessJD; // JD at which the last coordinate update (see updateCoords) for this SkyPoint was done
     static KSSun *m_Sun;
 };
 
diff --git a/kstars/skyobjects/starobject.cpp b/kstars/skyobjects/starobject.cpp
index 61c881a..6e489f1 100644
--- a/kstars/skyobjects/starobject.cpp
+++ b/kstars/skyobjects/starobject.cpp
@@ -326,7 +326,14 @@ void StarObject::JITupdate( KStarsData* data )
 {
     updateID = data->updateID();
     if ( updateNumID != data->updateNumID() ) {
-        updateCoords( data->updateNum() );
+        // TODO: This can be optimized and reorganized further in a better manner.
+        // Maybe we should do this only for stars, since this is really a slow step only for stars
+
+        if( ( lastPrecessJD - data->updateNum()->getJD() ) >= 0.0005 || ( Options::useRelativistic() && checkBendLight() ) ) {
+            // Short circuit right here, if recomputing coordinates is not required. NOTE: POTENTIALLY DANGEROUS
+            updateCoords( data->updateNum() );
+        }
+
         updateNumID = data->updateNumID();
     }
     EquatorialToHorizontal( data->lst(), data->geo()->lat() );



More information about the Kstars-devel mailing list