CellEsd: PI from JFJochMath.h instead of M_PI, and the Herbstein (2000) credit at the block e.s.d.s

M_PI is not defined by MSVC without _USE_MATH_DEFINES, and CellEsd.cpp is reachable from the
viewer build. The citation, so far only in CellEsd.h, now also sits at the algorithm it credits.
The other files new in rc180 under common/, image_analysis/, reader/, writer/, rugnux/ and
viewer/ use no M_* constants or POSIX-only calls (grep of the rc180 diff).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit a019bc5fd2084907af9379068af3265ffe6c9ef5)
This commit is contained in:
leonarski_f committed 2026-10-26 15:38:58 +01:00
1 parent 1b48f3873f
commit 48bf9ebe3a
1 file changed
+3 -1
+3 -1
View File
@@ -6,6 +6,7 @@
#include <algorithm>
#include <cmath>
#include "../../common/JFJochMath.h"
#include "../../common/ParallelFor.h"
namespace {
@@ -37,7 +38,7 @@ namespace {
return v;
}
double ToDeg(double rad) { return rad * 180.0 / M_PI; }
double ToDeg(double rad) { return rad * 180.0 / PI; }
}
std::vector<Eigen::Matrix3d> MetricBasis(const gemmi::SpaceGroup &sg) {
@@ -206,6 +207,7 @@ std::optional<CellEsd> EstimateCellEsd(std::span<const CellObservation> obs, con
out.theta_max_deg = ToDeg(std::asin(std::min(1.0, wavelength_A * q_max / 2.0)));
// The same fit on blocks of consecutive frames: the scatter of their cells, over sqrt(blocks).
// Least-squares cell e.s.d.s alone are too small: following Herbstein (2000) Acta Cryst. B56, 547-557
std::vector<std::array<double, 6>> block_cells;
const int64_t span = static_cast<int64_t>(frame_max) - frame_min + 1;
std::vector<std::vector<CellObservation>> block_obs(nblocks);