RotationIndexer: Works on test lyso with consistent result to XDS!!!

This commit is contained in:
2025-11-29 18:10:09 +01:00
parent 549bb9fb5d
commit c67b4d0bb7
2 changed files with 20 additions and 16 deletions
@@ -416,7 +416,23 @@ bool XtalOptimizerInternal(XtalOptimizerData &data,
// Add residuals for each point
for (const auto &pt: spots) {
Eigen::Matrix3d gonio_back_rot = Eigen::Matrix3d::Identity();
Coord recip = data.geom.DetectorToRecip(pt.x, pt.y);
if (data.axis) {
auto rot = data.axis->GetTransformation(pt.image);
recip = rot * recip;
Eigen::Matrix3d Rg;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
Rg(i, j) = static_cast<double>(rot.arr()[i + j * 3]);
}
}
gonio_back_rot = Rg.transpose();
}
double h_fp = recip * vec0;
double k_fp = recip * vec1;
double l_fp = recip * vec2;
@@ -430,18 +446,9 @@ bool XtalOptimizerInternal(XtalOptimizerData &data,
if (norm_sq > tolerance * tolerance)
continue;
Eigen::Matrix3d gonio_back_rot = Eigen::Matrix3d::Identity();
if (data.axis) {
auto rot = data.axis->GetTransformation(pt.image);
Eigen::Matrix3d Rg;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
Rg(i, j) = static_cast<double>(rot.arr()[3 * i + j]);
}
}
gonio_back_rot = Rg;
}
problem.AddResidualBlock(
new ceres::AutoDiffCostFunction<XtalResidual, 3, 1, 1, 1, 3, 3, 3>(