[Kstars-devel] KDE/kdeedu/kstars/kstars/skyobjects
Victor Carbune
victor.carbune at gmail.com
Sun Nov 28 13:46:54 CET 2010
SVN commit 1201712 by vcarbune:
Google Code-in task for refraction: commiting just a small refactoring of
the code to get the global static method inside the SkyPoint class.
Ana also implemented a different refraction algorithm, which remains
available as a patch. Her analysis will be included in the documentation
for further references.
CCMAIL: kstars-devel at kde.org, costansin5 at gmail.com
M +6 -7 skypoint.cpp
M +6 -0 skypoint.h
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/skypoint.cpp #1201711:1201712
@@ -727,21 +727,20 @@
return Alt;
}
-// Calculate refraction correction. Parameter and return value are in degrees
-static double refractionCorr(double alt) {
+double SkyPoint::refractionCorr(double alt) {
return 1.02 / tan(dms::DegToRad * ( alt + 10.3/(alt + 5.11) )) / 60;
}
// Critical height. Below this height formula produce meaningless
// results and correction value is just interpolated
-static const double altCrit = -1;
-static const double corrCrit = refractionCorr( altCrit );
dms SkyPoint::refract(dms h) {
const double alt = h.Degrees();
- if( alt > altCrit )
- return dms( alt + refractionCorr(alt) );
+ const double corrCrit = SkyPoint::refractionCorr( SkyPoint::altCrit );
+
+ if( alt > SkyPoint::altCrit )
+ return dms( alt + SkyPoint::refractionCorr(alt) );
else
- return dms( alt + corrCrit * (alt + 90) / (altCrit + 90) );
+ return dms( alt + corrCrit * (alt + 90) / (SkyPoint::altCrit + 90) );
}
// Found uncorrected value by solving equation. This is OK since
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/skypoint.h #1201711:1201712
@@ -473,11 +473,17 @@
*/
bool checkCircumpolar( const dms *gLat );
+ /** Calculate refraction correction. Parameter and return value are in degrees */
+ static double refractionCorr( double alt );
+
/** Apply refraction correction to altitude. */
static dms refract(dms h);
/** Remove refraction correction. */
static dms unrefract(dms h);
+
+ static const double altCrit = -1;
+
protected:
/**Precess this SkyPoint's catalog coordinates to the epoch described by the
*given KSNumbers object.
More information about the Kstars-devel
mailing list