[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kstars/hdevalence-gsoc2013] kstars/engine: The problem was caused by not converting to radians befo
From:       Henry de Valence <hdevalence () hdevalence ! ca>
Date:       2013-07-02 4:25:05
Message-ID: E1Uts9J-00010A-Qs () scm ! kde ! org
[Download RAW message or body]

Git commit 8477d9753236f66e57e02e6ba48e84ea1b5667fb by Henry de Valence.
Committed on 02/07/2013 at 04:23.
Pushed by hdevalence into branch 'hdevalence-gsoc2013'.

The problem was caused by not converting to radians before doing trig.

M  +3    -2    kstars/engine/astrovars.cpp

http://commits.kde.org/kstars/8477d9753236f66e57e02e6ba48e84ea1b5667fb

diff --git a/kstars/engine/astrovars.cpp b/kstars/engine/astrovars.cpp
index 0da68ba..359ed25 100644
--- a/kstars/engine/astrovars.cpp
+++ b/kstars/engine/astrovars.cpp
@@ -215,6 +215,7 @@ double lonMoonAscendingNode(const JulianDate jd)
 
 void nutationVars(const JulianDate jd, double *deltaEcLong, double *deltaObliquity)
 {
+    typedef Array<double, NUTTERMS, 1> nutArr;
     Matrix<double, 5, 1> params;
     params << meanElongationOfMoon(jd),
               sunMeanAnomaly(jd),
@@ -223,8 +224,8 @@ void nutationVars(const JulianDate jd, double *deltaEcLong, double *deltaObliqui
               lonMoonAscendingNode(jd);
     // This vector has all of the dot products of the
     // params vector with the coefficients in the argument matrix.
-    typedef Array<double, NUTTERMS, 1> nutArr;
-    nutArr sums = (arguments*params).array();
+    // We need to convert to radians before calling sin() or cos()!
+    nutArr sums = (DEG2RAD*arguments*params).array();
     double T = centuriesSinceJ2000(jd);
     nutArr ecLongColumn = 1e-4*(amp.col(0) + (T/10.)*amp.col(1)).array();
     nutArr obliqColumn  = 1e-4*(amp.col(2) + (T/10.)*amp.col(3)).array();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic