summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-09-25 12:00:13 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-09-28 22:16:22 (GMT)
commite01f22a4d3f5ea611dff9ae2f3bd37c31ccc64d5 (patch)
treeac5e5f75081550adc7bf21d6b38e890fbe617610
parent786e4fcc5397fa8a9dcbb54c670410b687f000db (diff)
Some minor optimizations.
-rw-r--r--kstars/skyobjects/skypoint.cpp10
-rw-r--r--kstars/skyobjects/starobject.cpp4
2 files changed, 9 insertions, 5 deletions
diff --git a/kstars/skyobjects/skypoint.cpp b/kstars/skyobjects/skypoint.cpp
index 73fc33a..c66244e 100644
--- a/kstars/skyobjects/skypoint.cpp
+++ b/kstars/skyobjects/skypoint.cpp
@@ -219,9 +219,9 @@ void SkyPoint::precess( const KSNumbers *num ) {
}
//Extract RA, Dec from the vector:
- RA.setRadians( atan2( v[1], v[0] ) );
+ RA.setUsing_atan2( v[1], v[0] );
RA.reduce();
- Dec.setRadians( asin( v[2] ) );
+ Dec.setUsing_asin( v[2] );
}
SkyPoint SkyPoint::deprecess( const KSNumbers *num, long double epoch ) {
@@ -411,12 +411,12 @@ void SkyPoint::precessFromAnyEpoch(long double jd0, long double jdf){
RA.setD( RA0.Degrees() );
Dec.setD( Dec0.Degrees() );
- RA.SinCos( sinRA, cosRA );
- Dec.SinCos( sinDec, cosDec );
-
if (jd0 == jdf)
return;
+ RA.SinCos( sinRA, cosRA );
+ Dec.SinCos( sinDec, cosDec );
+
if ( jd0 == B1950) {
B1950ToJ2000();
jd0 = J2000;
diff --git a/kstars/skyobjects/starobject.cpp b/kstars/skyobjects/starobject.cpp
index 71fa2b8..3efa37d 100644
--- a/kstars/skyobjects/starobject.cpp
+++ b/kstars/skyobjects/starobject.cpp
@@ -272,6 +272,10 @@ void StarObject::updateCoords( const KSNumbers *num, bool , const CachingDms*, c
// FIXME: Find a better way to do this without conditionals etc.
// Having the conditional is good so we can use CachingDms on RA0 and Dec0
+
+ // FIXME: This code is very inefficient as it destroys the
+ // sine/cosine cache and repeatedly recreates it!
+
if ( properMotionCorrections ) {
newRA /= 15.0; // getIndexCoords returns in Degrees, while we want the RA in Hours
setRA0( newRA );