diff --git a/image_analysis/indexing/SpindleBlindFraction.cpp b/image_analysis/indexing/SpindleBlindFraction.cpp index d7e9bd623..3cee55c6e 100644 --- a/image_analysis/indexing/SpindleBlindFraction.cpp +++ b/image_analysis/indexing/SpindleBlindFraction.cpp @@ -6,6 +6,8 @@ #include "SpindleBlindFraction.h" +#include "../../common/JFJochMath.h" // PI - M_PI is not standard, and MSVC does not define it + namespace { // Only rows short enough to be a plausible symmetry axis count. The cut is relative to the // crystal's own shortest row, not an absolute length, so it works the same for a 40 A cell and @@ -32,7 +34,7 @@ float SpindleThetaMax_deg(float wavelength_A, float d_min_A) { if (wavelength_A <= 0 || d_min_A <= 0) return 0; const float sin_theta = std::min(1.0f, wavelength_A / (2.0f * d_min_A)); - return static_cast(std::asin(sin_theta) * 180.0 / M_PI); + return static_cast(std::asin(sin_theta) * 180.0 / PI); } float BlindConeSelfOverlap(float x) { @@ -40,7 +42,7 @@ float BlindConeSelfOverlap(float x) { return 0.0f; if (x <= 0.0f) return 1.0f; - return static_cast(2.0 / M_PI) * + return static_cast(2.0 / PI) * (std::acos(x) - x * std::sqrt(1.0f - x * x)); } @@ -91,7 +93,7 @@ std::optional SpindleBlindFraction(const std::vector &ro const auto consider = [&](const Coord &direction, float row_length_A) { const float len = direction.Length(); const float cos_beta = std::min(1.0f, std::fabs(direction * axis) / len); - const float beta_deg = static_cast(std::acos(cos_beta) * 180.0 / M_PI); + const float beta_deg = static_cast(std::acos(cos_beta) * 180.0 / PI); // A direction PERPENDICULAR to the spindle is as damaging as one along it, and far more // common: a lone 2-fold about it carries the blind cone onto the cone's opposite lobe, which // the same sweep leaves equally unmeasured. That is Friedel's rescue, which is no rescue - @@ -159,7 +161,7 @@ std::optional SpindleBlindFractionFromLattice(const CrystalLatt [](const Coord &a, const Coord &b) { return a.Length() < b.Length(); }); constexpr size_t MAX_LATTICE_ROWS = 6; - const float cos_5_deg = std::cos(5.0f * static_cast(M_PI) / 180.0f); + const float cos_5_deg = std::cos(5.0f * static_cast(PI) / 180.0f); std::vector rows; for (const auto &r : all) { if (rows.size() >= MAX_LATTICE_ROWS diff --git a/tests/ResultReportTest.cpp b/tests/ResultReportTest.cpp index 4f4462fe0..d63348ec1 100644 --- a/tests/ResultReportTest.cpp +++ b/tests/ResultReportTest.cpp @@ -68,8 +68,9 @@ TEST_CASE("ResultReport_Render", "[Diagnostics]") { const auto text = RenderResultReport("prefix", "in.h5", x, result); - // The stable keys a consumer greps for. - CHECK(text.find("\nREPORT_VERSION= 6\n") != std::string::npos); + // The stable keys a consumer greps for. The version is pinned on purpose: a key added to the + // report is a contract change, and this line is where it has to be acknowledged. + CHECK(text.find("\nREPORT_VERSION= 7\n") != std::string::npos); CHECK(text.find("\nOUTPUT_PREFIX= prefix\n") != std::string::npos); CHECK(text.find("\nINDEXING_RATE= 0.8700\n") != std::string::npos); CHECK(text.find("\nSPACE_GROUP_NUMBER= 96\n") != std::string::npos);