summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-10-01 10:04:30 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-10-01 10:04:30 (GMT)
commit94dc45f9511279d66f1923a2dc334b228803eeb7 (patch)
tree4e3388a1ad7153f9be7f3f6f074cecf84c7923cc
parent922657abf4471555088d953578356d800f98d1df (diff)
Add methods: SkyPoint::maxAlt() and SkyPoint::minAlt()
Add two convenience methods to SkyPoint that return the maximum and minimum altitude of an object for a given location (latitude).
-rw-r--r--kstars/skyobjects/skypoint.cpp15
-rw-r--r--kstars/skyobjects/skypoint.h14
2 files changed, 29 insertions, 0 deletions
diff --git a/kstars/skyobjects/skypoint.cpp b/kstars/skyobjects/skypoint.cpp
index 6f9ae9a..0b21b22 100644
--- a/kstars/skyobjects/skypoint.cpp
+++ b/kstars/skyobjects/skypoint.cpp
@@ -871,3 +871,18 @@ SkyPoint SkyPoint::timeTransformed( const SkyPoint *p, const KStarsDateTime &dt,
return sp;
}
+
+
+double SkyPoint::maxAlt(const dms& lat) const {
+ double retval = ( lat.Degrees() + 90. - dec().Degrees() );
+ if ( retval > 90. )
+ retval = 180. - retval;
+ return retval;
+}
+
+double SkyPoint::minAlt(const dms& lat) const {
+ double retval = ( lat.Degrees() - 90. + dec().Degrees() );
+ if ( retval < -90. )
+ retval = 180. + retval;
+ return retval;
+}
diff --git a/kstars/skyobjects/skypoint.h b/kstars/skyobjects/skypoint.h
index e9e4b63..acd9d8b 100644
--- a/kstars/skyobjects/skypoint.h
+++ b/kstars/skyobjects/skypoint.h
@@ -555,6 +555,20 @@ public:
*/
static const double altCrit;
+ /**
+ * @short Return the object's altitude at the upper culmination for the given latitude
+ * @return the maximum altitude in degrees
+ */
+ double maxAlt( const dms &lat ) const;
+
+ /**
+ * @short Return the object's altitude at the lower culmination for the given latitude
+ * @return the minimum altitude in degrees
+ */
+ double minAlt( const dms &lat ) const;
+
+
+
#ifdef PROFILE_COORDINATE_CONVERSION
static double cpuTime_EqToHz;
static long unsigned eqToHzCalls;