Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions src/tests/testPrecession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/

#include <QObject>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These includes were probably used by code now only commented away, and will be needed when taking up development in case any doubts in the precession model appear.

#include <QtDebug>
#include <QVariantList>

#include "tests/testPrecession.hpp"
#include "StelUtils.hpp"
#include "VecMath.hpp"
Expand Down Expand Up @@ -116,5 +112,33 @@ void TestPrecession::testPrecessionAnglesVondrak()
// according to Fig12 in the paper, a few arcseconds of difference between PQXY and Capitaine parametrisation are allowed.
QVERIFY2((angleCap-angleRef)*3600.0<6.0, QString("Angle between rotation matrices too different!").toUtf8());

//TODO: Add more dates and verify this angle difference is limited to what we can see in Fig.12
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the same dates plus one second IMO does not qualify to remove the intent of the TODO message. Adding a few centuries might do it, but we have no "official" reference values.

// Same construction one second later: no tabulated paper vectors here, only matrix/angle agreement.
const double JulianDay2 = JulianDay + 1.0 / 86400.0;
getPrecessionAnglesVondrak(JulianDay2, &epsilon_A, &chi_A, &omega_A, &psi_A);
getPrecessionAnglesVondrakPQXYe(-1234.567, &P_A, &Q_A, &X_A, &Y_A, &epsilon_A);
getPrecessionAnglesVondrakPQXYe(JulianDay2, &P_A, &Q_A, &X_A, &Y_A, &epsilon_A);
Z = sqrt(qMax(1.0 - P_A * P_A - Q_A * Q_A, 0.0));
W = X_A * X_A + Y_A * Y_A;
VEC2 = -Q_A * C - Z * S;
VEC3 = -Q_A * S + Z * C;
VEQ3 = (W < 1.0 ? sqrt(1.0 - W) : 0.0);
PECL = Vec3d(P_A, VEC2, VEC3);
PEQR = Vec3d(X_A, Y_A, VEQ3);
EQX = PEQR ^ PECL;
EQX.normalize();
V = PEQR ^ EQX;
RP = Mat3d(EQX[0], EQX[1], EQX[2], V[0], V[1], V[2], PEQR[0], PEQR[1], PEQR[2]);
RRot = Mat4d::xrotation(eps0) * Mat4d::zrotation(-psi_A) * Mat4d::xrotation(-omega_A) * Mat4d::zrotation(chi_A);
RP4 = Mat4d(EQX[0], EQX[1], EQX[2], 0, V[0], V[1], V[2], 0, PEQR[0], PEQR[1], PEQR[2], 0, 0, 0, 0, 1);
matDiff3x3 = (RRot - RP4).upper3x3();
max = 0.0;
for (int i = 0; i < 9; ++i)
{
if (fabs(matDiff3x3[i]) > max)
max = fabs(matDiff3x3[i]);
}
QVERIFY2(max < 2e-5, QString("JD %1: precession matrices differ by too much.").arg(JulianDay2).toUtf8());
angleRef = RP.angle() * 180.0 / M_PI;
angleCap = RRot.upper3x3().angle() * 180.0 / M_PI;
QVERIFY2((angleCap - angleRef) * 3600.0 < 6.0, QString("JD %1: angle between rotation matrices too different!").arg(JulianDay2).toUtf8());
}
Loading