From 43411f1fea26fe299d45e4f0292fe8b42742676c Mon Sep 17 00:00:00 2001 From: Xiaocong Ai Date: Fri, 13 Oct 2023 11:20:51 +0200 Subject: [PATCH] fix: DiscTrapezoidBounds vertices (#2541) This PR fixes the vertices calculation of a trapezoid in the local frame (before the transformation). --- Core/src/Surfaces/DiscTrapezoidBounds.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index d293b5a9921..d774cbd9313 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -64,10 +64,13 @@ std::vector Acts::DiscTrapezoidBounds::vertices( unsigned int /*lseg*/) const { Vector2 cAxis(std::cos(get(eAveragePhi)), std::sin(get(eAveragePhi))); Vector2 nAxis(cAxis.y(), -cAxis.x()); - return {get(eMinR) * cAxis - get(eHalfLengthXminR) * nAxis, - get(eMinR) * cAxis + get(eHalfLengthXminR) * nAxis, - m_ymax * cAxis + get(eHalfLengthXmaxR) * nAxis, - m_ymax * cAxis - get(eHalfLengthXmaxR) * nAxis}; + auto ymin = std::sqrt(get(eMinR) * get(eMinR) - + get(eHalfLengthXminR) * get(eHalfLengthXminR)); + auto halfY = (m_ymax - ymin) / 2; + return {-halfY * cAxis - get(eHalfLengthXminR) * nAxis, + -halfY * cAxis + get(eHalfLengthXminR) * nAxis, + halfY * cAxis + get(eHalfLengthXmaxR) * nAxis, + halfY * cAxis - get(eHalfLengthXmaxR) * nAxis}; } // ostream operator overload