summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-09-25 08:52:01 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-09-28 22:16:22 (GMT)
commit284282fc64a0a5bf4f2b0e52a466a968c19ec113 (patch)
tree84a8f3a31f7fae2d375a4c03b7a3f221f82f99b8
parent13ac9e9eaadf61845fe54c13ba72fa23c01ddb56 (diff)
Make KSNumbers::obliquity() return CachingDms
Profiling did not reveal a significant advantage here mostly because of the updateCoords() short-circuit in StarObject::JITUpdate(). However, I presume that the impact will be significant when slewing / zooming -- operations that are very hard to profile, and time steps of > 1 minute, which we will have to unfortunately address only later.
-rw-r--r--kstars/ksnumbers.h7
-rw-r--r--kstars/skyobjects/ksplanetbase.cpp4
-rw-r--r--kstars/skyobjects/ksplanetbase.h4
-rw-r--r--kstars/skyobjects/skypoint.cpp4
-rw-r--r--kstars/skyobjects/skypoint.h4
5 files changed, 12 insertions, 11 deletions
diff --git a/kstars/ksnumbers.h b/kstars/ksnumbers.h
index b988d89..f917d3f 100644
--- a/kstars/ksnumbers.h
+++ b/kstars/ksnumbers.h
@@ -22,7 +22,7 @@
#define NUTTERMS 63
-#include "dms.h"
+#include "cachingdms.h"
/** @class KSNumbers
*
@@ -55,7 +55,7 @@ public:
/** @return the current Obliquity (the angle of inclination between
*the celestial equator and the ecliptic)
*/
- const dms* obliquity() const { return &Obliquity; }
+ const CachingDms* obliquity() const { return &Obliquity; }
/** @return the constant of aberration (20.49 arcsec). */
dms constAberr() const { return K; }
@@ -125,7 +125,8 @@ public:
double vEarth(int i) const {return vearth[i];}
private:
- dms Obliquity, K, L, L0, LM, M, M0, O, P, D, MM, F;
+ CachingDms Obliquity;
+ dms K, L, L0, LM, M, M0, O, P, D, MM, F;
dms XP, YP, ZP, XB, YB, ZB;
double CX, SX, CY, SY, CZ, SZ;
double CXB, SXB, CYB, SYB, CZB, SZB;
diff --git a/kstars/skyobjects/ksplanetbase.cpp b/kstars/skyobjects/ksplanetbase.cpp
index d9376a2..c623398 100644
--- a/kstars/skyobjects/ksplanetbase.cpp
+++ b/kstars/skyobjects/ksplanetbase.cpp
@@ -95,11 +95,11 @@ KSPlanetBase* KSPlanetBase::createPlanet( int n ) {
return 0;
}
-void KSPlanetBase::EquatorialToEcliptic( const dms *Obliquity ) {
+void KSPlanetBase::EquatorialToEcliptic( const CachingDms *Obliquity ) {
findEcliptic( Obliquity, ep.longitude, ep.latitude );
}
-void KSPlanetBase::EclipticToEquatorial( const dms *Obliquity ) {
+void KSPlanetBase::EclipticToEquatorial( const CachingDms *Obliquity ) {
setFromEcliptic( Obliquity, ep.longitude, ep.latitude );
}
diff --git a/kstars/skyobjects/ksplanetbase.h b/kstars/skyobjects/ksplanetbase.h
index 929993f..e405c50 100644
--- a/kstars/skyobjects/ksplanetbase.h
+++ b/kstars/skyobjects/ksplanetbase.h
@@ -111,12 +111,12 @@ public:
/** @short Convert Ecliptic logitude/latitude to Right Ascension/Declination.
* @param Obliquity current Obliquity of the Ecliptic (angle from Equator)
*/
- void EclipticToEquatorial( const dms *Obliquity );
+ void EclipticToEquatorial( const CachingDms *Obliquity );
/** @short Convert Right Ascension/Declination to Ecliptic logitude/latitude.
* @param Obliquity current Obliquity of the Ecliptic (angle from Equator)
*/
- void EquatorialToEcliptic( const dms *Obliquity );
+ void EquatorialToEcliptic( const CachingDms *Obliquity );
/** @return pointer to this planet's texture */
const QImage& image() const { return m_image; }
diff --git a/kstars/skyobjects/skypoint.cpp b/kstars/skyobjects/skypoint.cpp
index eede76f..b0d894a 100644
--- a/kstars/skyobjects/skypoint.cpp
+++ b/kstars/skyobjects/skypoint.cpp
@@ -155,7 +155,7 @@ void SkyPoint::HorizontalToEquatorial( const dms *LST, const dms *lat ) {
RA.setD( RA.reduce().Degrees() ); // 0 <= RA < 24
}
-void SkyPoint::findEcliptic( const dms *Obliquity, dms &EcLong, dms &EcLat ) {
+void SkyPoint::findEcliptic( const CachingDms *Obliquity, dms &EcLong, dms &EcLat ) {
double sinRA, cosRA, sinOb, cosOb, sinDec, cosDec, tanDec;
ra().SinCos( sinRA, cosRA );
dec().SinCos( sinDec, cosDec );
@@ -169,7 +169,7 @@ void SkyPoint::findEcliptic( const dms *Obliquity, dms &EcLong, dms &EcLat ) {
EcLat.setRadians( asin( sinDec*cosOb - cosDec*sinOb*sinRA ) );
}
-void SkyPoint::setFromEcliptic( const dms *Obliquity, const dms& EcLong, const dms& EcLat ) {
+void SkyPoint::setFromEcliptic( const CachingDms *Obliquity, const dms& EcLong, const dms& EcLat ) {
double sinLong, cosLong, sinLat, cosLat, sinObliq, cosObliq;
EcLong.SinCos( sinLong, cosLong );
EcLat.SinCos( sinLat, cosLat );
diff --git a/kstars/skyobjects/skypoint.h b/kstars/skyobjects/skypoint.h
index bdb5343..af937d4 100644
--- a/kstars/skyobjects/skypoint.h
+++ b/kstars/skyobjects/skypoint.h
@@ -232,13 +232,13 @@ public:
*The ecliptic coordinates are returned as reference arguments (since
*they are not stored internally)
*/
- void findEcliptic( const dms *Obliquity, dms &EcLong, dms &EcLat );
+ void findEcliptic( const CachingDms *Obliquity, dms &EcLong, dms &EcLat );
/** Set the current (RA, Dec) coordinates of the
*SkyPoint, given pointers to its Ecliptic (Long, Lat) coordinates, and
*to the current obliquity angle (the angle between the equator and ecliptic).
*/
- void setFromEcliptic( const dms *Obliquity, const dms& EcLong, const dms& EcLat );
+ void setFromEcliptic( const CachingDms *Obliquity, const dms& EcLong, const dms& EcLat );
/** Computes galactic coordinates from equatorial coordinates referred to
* epoch 1950. RA and Dec are, therefore assumed to be B1950