Commit 94dc45f9 authored by Akarsh Simha's avatar Akarsh Simha
Browse files

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).
parent 922657ab
......@@ -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;
}
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment