From e34a5fb88f4add1cefbedee59ca15a35bb056a3c Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 10 Oct 2026 21:15:32 +0200 Subject: [PATCH] rugnux far-end check: PI from JFJochMath.h, as M_PI is not defined on MSVC; ResultReport test follows the supercell warning's wording RugnuxFarEnd.cpp used M_PI, which MSVC does not define without _USE_MATH_DEFINES, and broke the Windows viewer build (C2065). The ResultReport_SupercellCheck test still looked for the supercell warning's wording from before the doubled-cell change. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01EizBKhTqrAYago9KJG3dA3 --- rugnux/RugnuxFarEnd.cpp | 7 ++++--- tests/ResultReportTest.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rugnux/RugnuxFarEnd.cpp b/rugnux/RugnuxFarEnd.cpp index 4d5dac496..b31c5b8c8 100644 --- a/rugnux/RugnuxFarEnd.cpp +++ b/rugnux/RugnuxFarEnd.cpp @@ -9,6 +9,7 @@ #include "Rugnux.h" #include "RugnuxPipeline.h" +#include "../common/JFJochMath.h" // PI - M_PI is not portable to MSVC #include "../image_analysis/indexing/AnalyzeIndexing.h" // SPOT_BUDGET_SIGNIFICANCE_Z // The far-end check. LOG ONLY: it decides nothing and changes nothing the run writes. @@ -50,7 +51,7 @@ namespace { for (int j = 1; 2 * j + 1 <= dof - 2; j++) sum += term *= c2 * (2.0 * j) / (2.0 * j + 1.0); const double a = dof == 1 ? theta : theta + std::sin(theta) * std::cos(theta) * sum; - return std::max(0.0, 1.0 - 2.0 * a / M_PI); + return std::max(0.0, 1.0 - 2.0 * a / PI); } for (int j = 1; 2 * j <= dof - 2; j++) sum += term *= c2 * (2.0 * j - 1.0) / (2.0 * j); @@ -149,8 +150,8 @@ void Rugnux::FarEndCheck(PipelineLocals &p, const RotationIndexerResult &rot) { static_cast(0.5 * (R[0][2] - R[2][0])), static_cast(0.5 * (R[1][0] - R[0][1]))); const double about = w * spindle; - frame[ABOUT_SPINDLE][o] = about * 180.0 / M_PI; - frame[OFF_SPINDLE][o] = (w - spindle * static_cast(about)).Length() * 180.0 / M_PI; + frame[ABOUT_SPINDLE][o] = about * 180.0 / PI; + frame[OFF_SPINDLE][o] = (w - spindle * static_cast(about)).Length() * 180.0 / PI; } // The cell the strong reflections ask for: d at the observed centroid against d predicted. diff --git a/tests/ResultReportTest.cpp b/tests/ResultReportTest.cpp index 5d60a7a0d..fd742ba43 100644 --- a/tests/ResultReportTest.cpp +++ b/tests/ResultReportTest.cpp @@ -1013,7 +1013,7 @@ TEST_CASE("ResultReport_SupercellCheck", "[Diagnostics]") { result.leftover_lattices = census; text = RenderResultReport("p", "in.h5", x, result); CHECK(text.find("the further lattice domains found may put spots there") != std::string::npos); - CHECK(text.find("spots of the further lattice domains found landing on those positions") != std::string::npos); + CHECK(text.find("spots of the further lattice domains found land on those positions") != std::string::npos); // Not measured to rock: no indication. result.supercell->rock_pct = 1.0;