From fe92f74b2146d04f6433719c11245839cbe58306 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de>
Date: Wed, 16 Sep 2020 22:20:13 +0200
Subject: [PATCH] Core: no need to subtract r_perp from pixel coordinate

---
 Core/Detector/RectangularDetector.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Core/Detector/RectangularDetector.cpp b/Core/Detector/RectangularDetector.cpp
index 31281e2ae4d..06baf2a9b7a 100644
--- a/Core/Detector/RectangularDetector.cpp
+++ b/Core/Detector/RectangularDetector.cpp
@@ -220,9 +220,9 @@ size_t RectangularDetector::indexOfSpecular(const Beam& beam) const
     const double kd = k_spec.dot(normal_unit);
     if (kd <= 0.0)
         return totalSize();
-    const kvector_t k_orth = (k_spec / kd - normal_unit) * m_distance;
-    const double u = k_orth.dot(m_u_unit) + m_u0;
-    const double v = k_orth.dot(m_v_unit) + m_v0;
+    const kvector_t rpix = k_spec * (m_distance / kd);
+    const double u = rpix.dot(m_u_unit) + m_u0;
+    const double v = rpix.dot(m_v_unit) + m_v0;
     const IAxis& u_axis = getAxis(0);
     const IAxis& v_axis = getAxis(1);
     if (u_axis.contains(u) && v_axis.contains(v))
-- 
GitLab