From 7f23bcaf1d0f8cf3b0b4215c009cd91febfd5166 Mon Sep 17 00:00:00 2001 From: Andy Kirkham Date: Tue, 9 Nov 2021 16:27:52 +0000 Subject: [PATCH] Use actual radius as returned and not assumed diameter. Also a bool logic correction for +/- direction --- plugins/NavStars/src/NavStars.cpp | 10 +++++----- scripts/tests/navstars-sun-issue-2019-N.ssc | 13 +++++++++++++ scripts/tests/navstars-sun-issue-2019-S.ssc | 13 +++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 scripts/tests/navstars-sun-issue-2019-N.ssc create mode 100644 scripts/tests/navstars-sun-issue-2019-S.ssc diff --git a/plugins/NavStars/src/NavStars.cpp b/plugins/NavStars/src/NavStars.cpp index 5d319719e58b4..cf12a5b4a8f79 100644 --- a/plugins/NavStars/src/NavStars.cpp +++ b/plugins/NavStars/src/NavStars.cpp @@ -590,11 +590,11 @@ void NavStars::extraInfo(StelCore* core, const StelObjectP& selectedObject) if ("Sun" == englishName || "Moon" == englishName) { - // Adjust Ho if target is Sun or Moon by adding/subtracting half the angular diameter. - double d = selectedObject->getAngularSize(core); - if (upperLimb) - d *= -1; - calc.addAltAppRad(((d / 2) * M_PI) / 180.); + // Adjust Ho if target is Sun or Moon by adding/subtracting the angular radius. + double obj_radius_in_degrees = selectedObject->getAngularSize(core); + if (!upperLimb) + obj_radius_in_degrees *= -1; + calc.addAltAppRad((obj_radius_in_degrees * M_PI) / 180.); extraText = upperLimb ? " (" + QString(qc_("upper limb", "the highest part of the Sun or Moon")) + ")" : " (" + QString(qc_("lower limb", "the lowest part of the Sun or Moon")) + ")"; diff --git a/scripts/tests/navstars-sun-issue-2019-N.ssc b/scripts/tests/navstars-sun-issue-2019-N.ssc new file mode 100644 index 0000000000000..39eb4b266db02 --- /dev/null +++ b/scripts/tests/navstars-sun-issue-2019-N.ssc @@ -0,0 +1,13 @@ + +core.setObserverLocation(-29.75888, 19.945, 0); +LandscapeMgr.setCurrentLandscapeName("Ocean"); +LandscapeMgr.setFlagLandscape(true); +LandscapeMgr.setFlagAtmosphere(true); +GridLinesMgr.setFlagHorizonLine(true); +LandscapeMgr.setFlagCardinalsPoints(true); +core.setDate("2021-11-08T19:31:41"); +core.setTimeRate(0); + +core.selectObjectByName("Sun", false); +StelMovementMgr.setFlagTracking(true); + diff --git a/scripts/tests/navstars-sun-issue-2019-S.ssc b/scripts/tests/navstars-sun-issue-2019-S.ssc new file mode 100644 index 0000000000000..e7e30d108ea8a --- /dev/null +++ b/scripts/tests/navstars-sun-issue-2019-S.ssc @@ -0,0 +1,13 @@ + +core.setObserverLocation(-29.75888, -19.945, 0); +LandscapeMgr.setCurrentLandscapeName("Ocean"); +LandscapeMgr.setFlagLandscape(true); +LandscapeMgr.setFlagAtmosphere(true); +GridLinesMgr.setFlagHorizonLine(true); +LandscapeMgr.setFlagCardinalsPoints(true); +core.setDate("2021-11-08T19:31:41"); +core.setTimeRate(0); + +core.selectObjectByName("Sun", false); +StelMovementMgr.setFlagTracking(true); +