From kde-commits Sun Jun 30 23:43:36 2013 From: Henry de Valence Date: Sun, 30 Jun 2013 23:43:36 +0000 To: kde-commits Subject: [kstars/hdevalence-gsoc2013] kstars/engine: Add an implementation of nutation. Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=137263583201001 Git commit cbb573a7226eef7e49e2c446aec5e7106ce73390 by Henry de Valence. Committed on 30/06/2013 at 23:40. Pushed by hdevalence into branch 'hdevalence-gsoc2013'. Add an implementation of nutation. Note that we use the exact method always, unlike in the old implementation, where we use an approximation. However, even the exact method here should be much faster than the trig in the old method. Note also that this implementation doesn't have a test yet, since it's getting its numbers from a function which is known to give incorrect results. When the AstroVars tests pass, then we should add a nutation test. CCMAIL: akarshsimha@gmail.com M +15 -0 kstars/engine/convertcoord.cpp M +18 -0 kstars/engine/convertcoord.h http://commits.kde.org/kstars/cbb573a7226eef7e49e2c446aec5e7106ce73390 diff --git a/kstars/engine/convertcoord.cpp b/kstars/engine/convertcoord.cpp index 7e4692e..6ffe413 100644 --- a/kstars/engine/convertcoord.cpp +++ b/kstars/engine/convertcoord.cpp @@ -16,6 +16,7 @@ *************************************************************************= **/ = #include "convertcoord.h" +#include "engine/astrovars.h" = #include "dms.h" = @@ -99,6 +100,20 @@ CoordConversion PrecessFrom(const JulianDate jd) return PrecessTo(jd).conjugate(); } = +CoordConversion Nutate(const JulianDate jd) +{ + double dEcLong, dObliq; + AstroVars::nutationVars(jd, &dEcLong, &dObliq); + //Add dEcLong to the Ecliptic Longitude + Quaterniond rot(AngleAxisd(dEcLong*DEG2RAD,Vector3d::UnitY())); + return EclToEq(jd) * rot * EqToEcl(jd); +} + +CoordConversion DeNutate(const JulianDate jd) +{ + return Nutate(jd).conjugate(); +} + = } } diff --git a/kstars/engine/convertcoord.h b/kstars/engine/convertcoord.h index e64f0c9..b64d232 100644 --- a/kstars/engine/convertcoord.h +++ b/kstars/engine/convertcoord.h @@ -125,6 +125,24 @@ namespace Convert { */ CoordConversion PrecessFrom( const JulianDate jd ); = + /** @return a rotation representing the nutation for this date. + * @param jd the date in question. + * + * FIXME: this implementation is probably incorrect. + * It should be checked once all of the KSNumbers code + * is moved and rewritten. + */ + CoordConversion Nutate( const JulianDate jd ); + + /** @return a rotation which removes nutation. + * @param jd the date + * + * FIXME: this implementation is probably incorrect. + * It should be checked once all of the KSNumbers code + * is moved and rewritten. + */ + CoordConversion DeNutate( const JulianDate jd ); + /** @return rotation from J2000 coordinates to B1950 coordinates. */ CoordConversion J2000ToB1950();