From 87106e9b1673321d861d0eeb54f04ca9e6a0e937 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 12 Dec 2024 17:13:05 +0100 Subject: [PATCH 01/33] tmp --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 14 +- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 5 + .../include/Acts/Surfaces/RectangleBounds.hpp | 3 + Core/include/Acts/Surfaces/SurfaceBounds.hpp | 3 + Core/src/Surfaces/AnnulusBounds.cpp | 223 +++++++++--------- Core/src/Surfaces/DiscSurface.cpp | 1 - Core/src/Surfaces/RectangleBounds.cpp | 5 + 7 files changed, 135 insertions(+), 119 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 942c20dc764..4bbc2958392 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -18,7 +17,6 @@ #include #include -#include #include #include #include @@ -74,13 +72,16 @@ class AnnulusBounds : public DiscBounds { AnnulusBounds(const AnnulusBounds& source) = default; - SurfaceBounds::BoundsType type() const final; + BoundsType type() const final; /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + double distance(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside /// the bounds Inside can be called without/with tolerances. @@ -202,13 +203,6 @@ class AnnulusBounds : public DiscBounds { /// @param vStripXY the position in the cartesian strip system /// @return the position in the module polar coordinate system Vector2 stripXYToModulePC(const Vector2& vStripXY) const; - - /// Private helper method - Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p, - const SquareMatrix2& weight) const; - - /// Private helper method - double squaredNorm(const Vector2& v, const SquareMatrix2& weight) const; }; inline SurfaceBounds::BoundsType AnnulusBounds::type() const { diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 261f40e4729..88f9aa2057e 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -30,6 +30,11 @@ class InfiniteBounds : public SurfaceBounds { std::vector values() const final { return {}; } + double distance(const Vector2& /*lposition*/, + const SquareMatrix2& /*metric*/) const final { + return 0; + } + /// Method inside() returns true for any case /// /// ignores input parameters diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index aba1743fa74..36ebde516b0 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -74,6 +74,9 @@ class RectangleBounds : public PlanarBounds { std::vector values() const final; + double distance(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside /// the bounds Inside can be called without/with tolerances. diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 62216f75c29..334cc15231f 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -58,6 +58,9 @@ class SurfaceBounds { /// @return of the stored values for this SurfaceBounds object virtual std::vector values() const = 0; + virtual double distance(const Vector2& lposition, + const SquareMatrix2& metric) const = 0; + /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside /// the bounds Inside can be called without/with tolerances. diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 593184816ac..13e2b6a2af9 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -8,11 +8,11 @@ #include "Acts/Surfaces/AnnulusBounds.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" -#include "Acts/Utilities/detail/periodic.hpp" #include #include @@ -21,8 +21,30 @@ #include #include -Acts::AnnulusBounds::AnnulusBounds( - const std::array& values) noexcept(false) +namespace Acts { + +namespace { + +double squaredNorm(const Vector2& v, const SquareMatrix2& metric) { + return (v.transpose() * metric * v).value(); +} + +Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p, + const SquareMatrix2& metric) { + // connecting vector + auto n = b - a; + // squared norm of line + auto f = (n.transpose() * metric * n).value(); + // weighted scalar product of line to point and segment line + auto u = ((p - a).transpose() * metric * n).value() / f; + // clamp to [0, 1], convert to point + return std::min(std::max(u, 0.), 1.) * n + a; +} + +} // namespace + +AnnulusBounds::AnnulusBounds(const std::array& values) noexcept( + false) : m_values(values), m_moduleOrigin({values[eOriginX], values[eOriginY]}) { checkConsistency(); m_rotationStripPC = Translation2(Vector2(0, -get(eAveragePhi))); @@ -95,14 +117,14 @@ Acts::AnnulusBounds::AnnulusBounds( m_inRightModulePC = stripXYToModulePC(m_inRightStripXY); } -std::vector Acts::AnnulusBounds::corners() const { +std::vector AnnulusBounds::corners() const { auto rot = m_rotationStripPC.inverse(); return {rot * m_outRightStripPC, rot * m_outLeftStripPC, rot * m_inLeftStripPC, rot * m_inRightStripPC}; } -std::vector Acts::AnnulusBounds::vertices( +std::vector AnnulusBounds::vertices( unsigned int quarterSegments) const { if (quarterSegments > 0u) { using VectorHelpers::phi; @@ -114,7 +136,7 @@ std::vector Acts::AnnulusBounds::vertices( double phiMaxOuter = phi(m_outLeftStripXY - m_moduleOrigin); // Inner bow from phi_min -> phi_max (needs to be reversed) - std::vector rvertices = + std::vector rvertices = detail::VerticesHelper::segmentVertices( {get(eMinR), get(eMinR)}, phiMinInner, phiMaxInner, {}, quarterSegments); @@ -128,77 +150,15 @@ std::vector Acts::AnnulusBounds::vertices( rvertices.insert(rvertices.end(), overtices.begin(), overtices.end()); std::for_each(rvertices.begin(), rvertices.end(), - [&](Acts::Vector2& rv) { rv += m_moduleOrigin; }); + [&](Vector2& rv) { rv += m_moduleOrigin; }); return rvertices; } return {m_inLeftStripXY, m_inRightStripXY, m_outRightStripXY, m_outLeftStripXY}; } -bool Acts::AnnulusBounds::inside(const Vector2& lposition, double tolR, - double tolPhi) const { - // locpo is PC in STRIP SYSTEM - // need to perform internal rotation induced by average phi - Vector2 locpo_rotated = m_rotationStripPC * lposition; - double phiLoc = locpo_rotated[eBoundLoc1]; - double rLoc = locpo_rotated[eBoundLoc0]; - - if (phiLoc < (get(eMinPhiRel) - tolPhi) || - phiLoc > (get(eMaxPhiRel) + tolPhi)) { - return false; - } - - // calculate R in MODULE SYSTEM to evaluate R-bounds - if (tolR == 0.) { - // don't need R, can use R^2 - double r_mod2 = - m_shiftPC[eBoundLoc0] * m_shiftPC[eBoundLoc0] + rLoc * rLoc + - 2 * m_shiftPC[eBoundLoc0] * rLoc * cos(phiLoc - m_shiftPC[eBoundLoc1]); - - if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) { - return false; - } - } else { - // use R - double r_mod = sqrt( - m_shiftPC[eBoundLoc0] * m_shiftPC[eBoundLoc0] + rLoc * rLoc + - 2 * m_shiftPC[eBoundLoc0] * rLoc * cos(phiLoc - m_shiftPC[eBoundLoc1])); - - if (r_mod < (get(eMinR) - tolR) || r_mod > (get(eMaxR) + tolR)) { - return false; - } - } - return true; -} - -bool Acts::AnnulusBounds::inside( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - if (boundaryTolerance.isInfinite()) { - return true; - } - - if (boundaryTolerance.isNone()) { - return inside(lposition, 0., 0.); - } - - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(); - absoluteBound.has_value()) { - return inside(lposition, absoluteBound->tolerance0, - absoluteBound->tolerance1); - } - - // first check if inside. We don't need to look into the covariance if inside - if (inside(lposition, 0., 0.)) { - return true; - } - - if (!boundaryTolerance.hasChi2Bound()) { - throw std::logic_error("not implemented"); - } - - const auto& boundaryToleranceChi2 = boundaryTolerance.asChi2Bound(); - +double AnnulusBounds::distance(const Vector2& lposition, + const SquareMatrix2& metric) const { // locpo is PC in STRIP SYSTEM // we need to rotate the locpo Vector2 locpo_rotated = m_rotationStripPC * lposition; @@ -285,9 +245,9 @@ bool Acts::AnnulusBounds::inside( jacobianStripPCToModulePC(1, 0) = -(B * O_y - C * O_x) / A; jacobianStripPCToModulePC(1, 1) = r_strip * (B * O_x + C * O_y + r_strip) / A; - // Mahalanobis distance uses inverse covariance as weights - const auto& weightStripPC = boundaryToleranceChi2.weight; - auto weightModulePC = jacobianStripPCToModulePC.transpose() * weightStripPC * + // Mahalanobis distance uses the coordinate weights (usually inverse + // covariance) as a metric + auto metricModulePC = jacobianStripPCToModulePC.transpose() * metric * jacobianStripPCToModulePC; double minDist = std::numeric_limits::max(); @@ -299,13 +259,13 @@ bool Acts::AnnulusBounds::inside( // first: STRIP system. locpo is in STRIP PC already currentClosest = closestOnSegment(m_inLeftStripPC, m_outLeftStripPC, - locpo_rotated, weightStripPC); - currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); + locpo_rotated, metricModulePC); + currentDist = squaredNorm(locpo_rotated - currentClosest, metricModulePC); minDist = currentDist; currentClosest = closestOnSegment(m_inRightStripPC, m_outRightStripPC, - locpo_rotated, weightStripPC); - currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); + locpo_rotated, metricModulePC); + currentDist = squaredNorm(locpo_rotated - currentClosest, metricModulePC); if (currentDist < minDist) { minDist = currentDist; } @@ -320,58 +280,103 @@ bool Acts::AnnulusBounds::inside( // now check edges in MODULE PC (inner and outer circle) assuming Mahalanobis // distances are of same unit if covariance is correctly transformed currentClosest = closestOnSegment(m_inLeftModulePC, m_inRightModulePC, - locpoModulePC, weightModulePC); - currentDist = squaredNorm(locpoModulePC - currentClosest, weightModulePC); + locpoModulePC, metricModulePC); + currentDist = squaredNorm(locpoModulePC - currentClosest, metricModulePC); if (currentDist < minDist) { minDist = currentDist; } currentClosest = closestOnSegment(m_outLeftModulePC, m_outRightModulePC, - locpoModulePC, weightModulePC); - currentDist = squaredNorm(locpoModulePC - currentClosest, weightModulePC); + locpoModulePC, metricModulePC); + currentDist = squaredNorm(locpoModulePC - currentClosest, metricModulePC); if (currentDist < minDist) { minDist = currentDist; } - // compare resulting Mahalanobis distance to configured "number of sigmas" we - // square it b/c we never took the square root of the distance - return minDist < - boundaryToleranceChi2.maxChi2 * boundaryToleranceChi2.maxChi2; + return std::sqrt(minDist); } -Acts::Vector2 Acts::AnnulusBounds::stripXYToModulePC( - const Vector2& vStripXY) const { - Vector2 vecModuleXY = vStripXY + m_shiftXY; - return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)}; +bool AnnulusBounds::inside(const Vector2& lposition, double tolR, + double tolPhi) const { + // locpo is PC in STRIP SYSTEM + // need to perform internal rotation induced by average phi + Vector2 locpo_rotated = m_rotationStripPC * lposition; + double phiLoc = locpo_rotated[eBoundLoc1]; + double rLoc = locpo_rotated[eBoundLoc0]; + + if (phiLoc < (get(eMinPhiRel) - tolPhi) || + phiLoc > (get(eMaxPhiRel) + tolPhi)) { + return false; + } + + // calculate R in MODULE SYSTEM to evaluate R-bounds + if (tolR == 0.) { + // don't need R, can use R^2 + double r_mod2 = + m_shiftPC[eBoundLoc0] * m_shiftPC[eBoundLoc0] + rLoc * rLoc + + 2 * m_shiftPC[eBoundLoc0] * rLoc * cos(phiLoc - m_shiftPC[eBoundLoc1]); + + if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) { + return false; + } + } else { + // use R + double r_mod = sqrt( + m_shiftPC[eBoundLoc0] * m_shiftPC[eBoundLoc0] + rLoc * rLoc + + 2 * m_shiftPC[eBoundLoc0] * rLoc * cos(phiLoc - m_shiftPC[eBoundLoc1])); + + if (r_mod < (get(eMinR) - tolR) || r_mod > (get(eMaxR) + tolR)) { + return false; + } + } + return true; } -Acts::Vector2 Acts::AnnulusBounds::closestOnSegment( - const Vector2& a, const Vector2& b, const Vector2& p, - const SquareMatrix2& weight) const { - // connecting vector - auto n = b - a; - // squared norm of line - auto f = (n.transpose() * weight * n).value(); - // weighted scalar product of line to point and segment line - auto u = ((p - a).transpose() * weight * n).value() / f; - // clamp to [0, 1], convert to point - return std::min(std::max(u, 0.), 1.) * n + a; +bool AnnulusBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { + if (boundaryTolerance.isInfinite()) { + return true; + } + + if (boundaryTolerance.isNone()) { + return inside(lposition, 0., 0.); + } + + if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(); + absoluteBound.has_value()) { + return inside(lposition, absoluteBound->tolerance0, + absoluteBound->tolerance1); + } + + // first check if inside. We don't need to look into the covariance if inside + if (inside(lposition, 0., 0.)) { + return true; + } + + if (boundaryTolerance.hasChi2Bound()) { + const auto& boundaryToleranceChi2 = boundaryTolerance.asChi2Bound(); + + // compare resulting Mahalanobis distance to configured "number of sigmas" + return distance(lposition, boundaryToleranceChi2.weight) < + boundaryToleranceChi2.maxChi2; + } + + throw std::logic_error("AnnulusBounds: unknown boundary tolerance type"); } -double Acts::AnnulusBounds::squaredNorm(const Vector2& v, - const SquareMatrix2& weight) const { - return (v.transpose() * weight * v).value(); +Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { + Vector2 vecModuleXY = vStripXY + m_shiftXY; + return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)}; } -Acts::Vector2 Acts::AnnulusBounds::moduleOrigin() const { +Vector2 AnnulusBounds::moduleOrigin() const { return Eigen::Rotation2D(get(eAveragePhi)) * m_moduleOrigin; } -// Ostream operator overload -std::ostream& Acts::AnnulusBounds::toStream(std::ostream& sl) const { +std::ostream& AnnulusBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::AnnulusBounds: (innerRadius, outerRadius, minPhi, maxPhi) = "; + sl << "AnnulusBounds: (innerRadius, outerRadius, minPhi, maxPhi) = "; sl << "(" << get(eMinR) << ", " << get(eMaxR) << ", " << phiMin() << ", " << phiMax() << ")" << '\n'; sl << " - shift xy = " << m_shiftXY.x() << ", " << m_shiftXY.y() << '\n'; @@ -379,3 +384,5 @@ std::ostream& Acts::AnnulusBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index ac3c188fd7d..076ffc66dbc 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -14,7 +14,6 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/DiscTrapezoidBounds.hpp" -#include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/RadialBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Surfaces/SurfaceError.hpp" diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index 21c8daec4e9..f4760b1932b 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -13,6 +13,11 @@ #include #include +double Acts::RectangleBounds::distance(const Acts::Vector2& lposition, + const SquareMatrix2& metric) const { + return 0; // TODO: Implement this function +} + bool Acts::RectangleBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { From 4d5d10d69fab93cd90ab811dbb637eb67f572018 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Fri, 13 Dec 2024 09:17:21 +0100 Subject: [PATCH 02/33] tmp --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 4 +- Core/include/Acts/Surfaces/CylinderBounds.hpp | 6 +-- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 6 +-- Core/include/Acts/Surfaces/RadialBounds.hpp | 5 +- .../include/Acts/Surfaces/RectangleBounds.hpp | 4 +- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 9 +++- .../Surfaces/detail/BoundaryCheckHelper.hpp | 51 ++++++++++++------- .../detail/CylindricalDetectorHelper.cpp | 3 -- Core/src/Surfaces/AnnulusBounds.cpp | 30 ++++------- Core/src/Surfaces/RadialBounds.cpp | 8 +++ Core/src/Surfaces/RectangleBounds.cpp | 10 ++-- 11 files changed, 77 insertions(+), 59 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 4bbc2958392..c6e999b21b0 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -79,8 +79,8 @@ class AnnulusBounds : public DiscBounds { /// @return this returns a copy of the internal values std::vector values() const final; - double distance(const Vector2& lposition, - const SquareMatrix2& metric) const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index d144c8b995b..f178f960fb8 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -12,14 +12,11 @@ #include "Acts/Definitions/Tolerance.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Utilities/detail/periodic.hpp" #include #include -#include #include #include -#include #include namespace Acts { @@ -97,6 +94,9 @@ class CylinderBounds : public SurfaceBounds { /// @return this returns a copy of the internal values std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside /// the bounds Inside can be called without/with tolerances. diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 88f9aa2057e..60cd24a1d67 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -30,9 +30,9 @@ class InfiniteBounds : public SurfaceBounds { std::vector values() const final { return {}; } - double distance(const Vector2& /*lposition*/, - const SquareMatrix2& /*metric*/) const final { - return 0; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& /*metric*/) const final { + return lposition; } /// Method inside() returns true for any case diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index ef3e8996572..65abdae499e 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -9,14 +9,12 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Utilities/detail/periodic.hpp" #include -#include #include #include #include @@ -71,6 +69,9 @@ class RadialBounds : public DiscBounds { /// @return this returns a copy of the internal values std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// For disc surfaces the local position in (r,phi) is checked /// /// @param lposition local position to be checked diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index 36ebde516b0..9d9e0d72771 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -74,8 +74,8 @@ class RectangleBounds : public PlanarBounds { std::vector values() const final; - double distance(const Vector2& lposition, - const SquareMatrix2& metric) const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 334cc15231f..7c3ec5e31c3 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -7,9 +7,11 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" +#include #include namespace Acts { @@ -58,8 +60,13 @@ class SurfaceBounds { /// @return of the stored values for this SurfaceBounds object virtual std::vector values() const = 0; + virtual Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const = 0; + virtual double distance(const Vector2& lposition, - const SquareMatrix2& metric) const = 0; + const SquareMatrix2& metric) const { + return std::sqrt(lposition.transpose() * metric * lposition); + } /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside diff --git a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp b/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp index 898fe5541ae..10bff2b129e 100644 --- a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp @@ -8,12 +8,38 @@ #pragma once +#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include namespace Acts::detail { +inline Vector2 computeClosestPointOnAlignedBox( + const Vector2& lowerLeft, const Vector2& upperRight, const Vector2& point, + const std::optional& metricOpt) { + Vector2 closestPoint; + + if (!metricOpt.has_value()) { + closestPoint = + detail::VerticesHelper::computeEuclideanClosestPointOnRectangle( + point, lowerLeft, upperRight); + } else { + // TODO there might be a more optimal way to compute the closest point to a + // box with metric + + std::array vertices = {{lowerLeft, + {upperRight[0], lowerLeft[1]}, + upperRight, + {lowerLeft[0], upperRight[1]}}}; + + closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( + point, vertices, *metricOpt); + } + + return closestPoint; +} + /// Check if a point is inside a box. /// /// @param lowerLeft The lower left corner of the box. @@ -40,26 +66,13 @@ inline bool insideAlignedBox(const Vector2& lowerLeft, return false; } - Vector2 closestPoint; - - if (!tolerance.hasMetric(jacobianOpt.has_value())) { - closestPoint = - detail::VerticesHelper::computeEuclideanClosestPointOnRectangle( - point, lowerLeft, upperRight); - } else { - // TODO there might be a more optimal way to compute the closest point to a - // box with metric + std::optional metricOpt = + tolerance.hasMetric(jacobianOpt.has_value()) + ? std::optional(tolerance.getMetric(jacobianOpt)) + : std::nullopt; - std::array vertices = {{lowerLeft, - {upperRight[0], lowerLeft[1]}, - upperRight, - {lowerLeft[0], upperRight[1]}}}; - - SquareMatrix2 metric = tolerance.getMetric(jacobianOpt); - - closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( - point, vertices, metric); - } + Vector2 closestPoint = + computeClosestPointOnAlignedBox(lowerLeft, upperRight, point, metricOpt); Vector2 distance = closestPoint - point; diff --git a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp index 545e0947797..b5779f4e18f 100644 --- a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp @@ -24,17 +24,14 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Utilities/Axis.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Enumerate.hpp" -#include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/StringHelpers.hpp" #include #include #include -#include #include #include #include diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 13e2b6a2af9..0c29fc2bfd1 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace Acts { @@ -157,8 +157,8 @@ std::vector AnnulusBounds::vertices( m_outLeftStripXY}; } -double AnnulusBounds::distance(const Vector2& lposition, - const SquareMatrix2& metric) const { +Vector2 AnnulusBounds::closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const { // locpo is PC in STRIP SYSTEM // we need to rotate the locpo Vector2 locpo_rotated = m_rotationStripPC * lposition; @@ -293,7 +293,7 @@ double AnnulusBounds::distance(const Vector2& lposition, minDist = currentDist; } - return std::sqrt(minDist); + return currentClosest; } bool AnnulusBounds::inside(const Vector2& lposition, double tolR, @@ -329,6 +329,7 @@ bool AnnulusBounds::inside(const Vector2& lposition, double tolR, return false; } } + return true; } @@ -338,30 +339,17 @@ bool AnnulusBounds::inside(const Vector2& lposition, return true; } - if (boundaryTolerance.isNone()) { - return inside(lposition, 0., 0.); - } - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(); absoluteBound.has_value()) { return inside(lposition, absoluteBound->tolerance0, absoluteBound->tolerance1); } - // first check if inside. We don't need to look into the covariance if inside - if (inside(lposition, 0., 0.)) { - return true; - } - - if (boundaryTolerance.hasChi2Bound()) { - const auto& boundaryToleranceChi2 = boundaryTolerance.asChi2Bound(); - - // compare resulting Mahalanobis distance to configured "number of sigmas" - return distance(lposition, boundaryToleranceChi2.weight) < - boundaryToleranceChi2.maxChi2; - } + // TODO jacobian + Vector2 closestPoint = + this->closestPoint(lposition, boundaryTolerance.getMetric(std::nullopt)); - throw std::logic_error("AnnulusBounds: unknown boundary tolerance type"); + return boundaryTolerance.isTolerated(lposition - closestPoint, std::nullopt); } Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 03a32ef2a34..9fa2cc82e27 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -30,6 +30,14 @@ Acts::Vector2 Acts::RadialBounds::shifted( return tmp; } +Acts::Vector2 Acts::RadialBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + return detail::computeClosestPointOnAlignedBox( + Vector2(get(eMinR), -get(eHalfPhiSector)), + Vector2(get(eMaxR), get(eHalfPhiSector)), shifted(lposition), + std::nullopt); +} + bool Acts::RadialBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index f4760b1932b..cb2991d26c7 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -13,9 +13,13 @@ #include #include -double Acts::RectangleBounds::distance(const Acts::Vector2& lposition, - const SquareMatrix2& metric) const { - return 0; // TODO: Implement this function +Acts::Vector2 Acts::RectangleBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + std::array vertices = { + {m_min, {m_max[0], m_min[1]}, m_max, {m_min[0], m_max[1]}}}; + + return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, + vertices, metric); } bool Acts::RectangleBounds::inside( From 9bcc7f6f41f16bde0ca7c546c5647e215c032ad4 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Tue, 17 Dec 2024 13:13:07 +0100 Subject: [PATCH 03/33] tmp --- Core/include/Acts/Surfaces/ConeBounds.hpp | 5 +++-- .../Acts/Surfaces/ConvexPolygonBounds.hpp | 8 +++++-- .../Acts/Surfaces/ConvexPolygonBounds.ipp | 8 +++++++ Core/include/Acts/Surfaces/CylinderBounds.hpp | 2 -- Core/include/Acts/Surfaces/DiamondBounds.hpp | 5 +++-- .../Acts/Surfaces/DiscTrapezoidBounds.hpp | 6 +++--- Core/include/Acts/Surfaces/EllipseBounds.hpp | 7 +++---- Core/include/Acts/Surfaces/LineBounds.hpp | 5 +++-- .../include/Acts/Surfaces/TrapezoidBounds.hpp | 9 +++----- Core/src/Surfaces/ConeBounds.cpp | 8 +++++++ Core/src/Surfaces/ConvexPolygonBounds.cpp | 8 ++++++- Core/src/Surfaces/CylinderBounds.cpp | 21 +++++++++++++++++++ Core/src/Surfaces/DiamondBounds.cpp | 17 +++++++++++++++ Core/src/Surfaces/DiscTrapezoidBounds.cpp | 12 ++++++++++- Core/src/Surfaces/EllipseBounds.cpp | 8 ++++--- Core/src/Surfaces/LineBounds.cpp | 8 +++++++ Core/src/Surfaces/RadialBounds.cpp | 3 +-- Core/src/Surfaces/TrapezoidBounds.cpp | 16 +++++++++++--- .../Core/Surfaces/SurfaceBoundsTests.cpp | 8 +++++++ 19 files changed, 131 insertions(+), 33 deletions(-) diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index d0d684016a8..58e2958d249 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -77,8 +77,6 @@ class ConeBounds : public SurfaceBounds { /// @param values The parameter array ConeBounds(const std::array& values) noexcept(false); - ~ConeBounds() override = default; - BoundsType type() const final; /// Return the bound values as dynamically sized vector @@ -86,6 +84,9 @@ class ConeBounds : public SurfaceBounds { /// @return this returns a copy of the internal values std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// inside method for local position /// /// @param lposition is the local position to be checked diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index e802056e7fd..011f329f14e 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -100,10 +100,11 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// @param values The values to build up the vertices ConvexPolygonBounds(const value_array& values) noexcept(false); - ~ConvexPolygonBounds() override = default; - BoundsType type() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// Return whether a local 2D point lies inside of the bounds defined by this /// object. /// @param lposition The local position to check @@ -161,6 +162,9 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// @return The bounds type BoundsType type() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// Return whether a local 2D point lies inside of the bounds defined by this /// object. /// @param lposition The local position to check diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 9f1a61955ae..5982acdc647 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -8,6 +8,7 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/ThrowAssert.hpp" #include @@ -101,6 +102,13 @@ Acts::SurfaceBounds::BoundsType Acts::ConvexPolygonBounds::type() const { return SurfaceBounds::eConvexPolygon; } +template +Acts::Vector2 Acts::ConvexPolygonBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, m_vertices, metric); +} + template bool Acts::ConvexPolygonBounds::inside( const Acts::Vector2& lposition, diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index f178f960fb8..8f27f9505b4 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -85,8 +85,6 @@ class CylinderBounds : public SurfaceBounds { checkConsistency(); } - ~CylinderBounds() override = default; - BoundsType type() const final; /// Return the bound values as dynamically sized vector diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index 7497bd22309..f286747ae8f 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -71,8 +71,6 @@ class DiamondBounds : public PlanarBounds { Vector2{*std::max_element(values.begin(), values.begin() + 2), values[eHalfLengthYpos]}) {} - ~DiamondBounds() override = default; - BoundsType type() const final; /// Return the bound values as dynamically sized vector @@ -80,6 +78,9 @@ class DiamondBounds : public PlanarBounds { /// @return this returns a copy of the internal values std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside /// the bounds Inside can be called without/with tolerances. diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index 32c63c2aef6..e154672e4f8 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -8,7 +8,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -64,8 +63,6 @@ class DiscTrapezoidBounds : public DiscBounds { checkConsistency(); } - ~DiscTrapezoidBounds() override = default; - SurfaceBounds::BoundsType type() const final; /// Return the bound values as dynamically sized vector @@ -73,6 +70,9 @@ class DiscTrapezoidBounds : public DiscBounds { /// @return this returns a copy of the internal values std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// This method checks if the radius given in the LocalPosition is inside /// [rMin,rMax] /// if only tol0 is given and additional in the phi sector is tol1 is given diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index ea90e3d2a88..cd6764d7054 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -47,8 +47,6 @@ class EllipseBounds : public PlanarBounds { eSize = 6 }; - EllipseBounds() = delete; - /// Constructor for full of an ellipsoid ring /// /// @param innerRx The inner ellipse radius in x @@ -73,8 +71,6 @@ class EllipseBounds : public PlanarBounds { checkConsistency(); } - ~EllipseBounds() override = default; - BoundsType type() const final; /// Return the bound values as dynamically sized vector @@ -82,6 +78,9 @@ class EllipseBounds : public PlanarBounds { /// @return this returns a copy of the internal values std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// This method checks if the point given in the local coordinates is between /// two ellipsoids if only tol0 is given and additional in the phi sector is /// tol1 is given diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index e3169d8a845..b9cc5fa980c 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -44,8 +44,6 @@ class LineBounds : public SurfaceBounds { checkConsistency(); } - ~LineBounds() override = default; - BoundsType type() const final; /// Return the bound values as dynamically sized vector @@ -53,6 +51,9 @@ class LineBounds : public SurfaceBounds { /// @return this returns a copy of the internal values std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside /// the bounds Inside can be called without/with tolerances. diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index 8ccd3a5c928..6d702df2bb5 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -8,17 +8,13 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include #include -#include #include -#include #include namespace Acts { @@ -56,12 +52,13 @@ class TrapezoidBounds : public PlanarBounds { /// @param values the values to be stream in TrapezoidBounds(const std::array& values) noexcept(false); - ~TrapezoidBounds() override; - BoundsType type() const final; std::vector values() const final; + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& metric) const final; + /// The orientation of the Trapezoid is according to the figure above, /// in words: the shorter of the two parallel sides of the trapezoid /// intersects diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 5dce8995326..659270cd9f1 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -57,6 +57,14 @@ Acts::Vector2 Acts::ConeBounds::shifted(const Acts::Vector2& lposition) const { return shifted; } +Acts::Vector2 Acts::ConeBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + auto rphiHalf = r(lposition[eBoundLoc1]) * get(eHalfPhiSector); + return detail::computeClosestPointOnAlignedBox(Vector2(-rphiHalf, get(eMinZ)), + Vector2(rphiHalf, get(eMaxZ)), + shifted(lposition), metric); +} + bool Acts::ConeBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { diff --git a/Core/src/Surfaces/ConvexPolygonBounds.cpp b/Core/src/Surfaces/ConvexPolygonBounds.cpp index f6b08624308..d50cb5502db 100644 --- a/Core/src/Surfaces/ConvexPolygonBounds.cpp +++ b/Core/src/Surfaces/ConvexPolygonBounds.cpp @@ -12,7 +12,6 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" -#include #include #include @@ -49,6 +48,13 @@ Acts::ConvexPolygonBounds::type() const { return SurfaceBounds::eConvexPolygon; } +Acts::Vector2 Acts::ConvexPolygonBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, std::span(m_vertices.data(), m_vertices.size()), + metric); +} + bool Acts::ConvexPolygonBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index c538b5c170b..c5c24cba812 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -13,6 +13,7 @@ #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" +#include "Acts/Utilities/detail/periodic.hpp" #include #include @@ -44,6 +45,26 @@ Acts::ActsMatrix<2, 2> Acts::CylinderBounds::jacobian() const { return j; } +Acts::Vector2 Acts::CylinderBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + double bevelMinZ = get(eBevelMinZ); + double bevelMaxZ = get(eBevelMaxZ); + double halfLengthZ = get(eHalfLengthZ); + double radius = get(eR); + + Vector2 lowerLeft = {-radius, -halfLengthZ}; + Vector2 middleLeft = {0., -(halfLengthZ + radius * std::tan(bevelMinZ))}; + Vector2 upperLeft = {radius, -halfLengthZ}; + Vector2 upperRight = {radius, halfLengthZ}; + Vector2 middleRight = {0., (halfLengthZ + radius * std::tan(bevelMaxZ))}; + Vector2 lowerRight = {-radius, halfLengthZ}; + Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, + upperRight, middleRight, lowerRight}; + + return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, + vertices, metric); +} + bool Acts::CylinderBounds::inside( const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const { diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index aa913404c0f..e4e2f69cd36 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -11,6 +11,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -20,6 +21,22 @@ Acts::SurfaceBounds::BoundsType Acts::DiamondBounds::type() const { return SurfaceBounds::eDiamond; } +Acts::Vector2 Acts::DiamondBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + // Vertices starting at lower left (min rel. phi) + // counter-clockwise + double x1 = get(DiamondBounds::eHalfLengthXnegY); + double y1 = get(DiamondBounds::eHalfLengthYneg); + double x2 = get(DiamondBounds::eHalfLengthXzeroY); + double y2 = 0.; + double x3 = get(DiamondBounds::eHalfLengthXposY); + double y3 = get(DiamondBounds::eHalfLengthYpos); + Vector2 vertices[] = {{-x1, -y1}, {x1, -y1}, {x2, y2}, + {x3, y3}, {-x3, y3}, {-x2, y2}}; + return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, + vertices, metric); +} + bool Acts::DiamondBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index ed02bac17de..77728ea5595 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -11,11 +11,11 @@ #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include #include -#include Acts::DiscTrapezoidBounds::DiscTrapezoidBounds(double halfXminR, double halfXmaxR, double minR, @@ -51,6 +51,16 @@ Acts::ActsMatrix<2, 2> Acts::DiscTrapezoidBounds::jacobianToLocalCartesian( return jacobian; } +Acts::Vector2 Acts::DiscTrapezoidBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, + {get(eHalfLengthXmaxR), m_ymax}, + {-get(eHalfLengthXmaxR), m_ymax}, + {-get(eHalfLengthXminR), get(eMinR)}}; + return detail::VerticesHelper::computeClosestPointOnPolygon( + toLocalCartesian(lposition), vertices, metric); +} + bool Acts::DiscTrapezoidBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index 485f36736d8..9081d8b06c6 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -11,12 +11,12 @@ #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" +#include "Acts/Utilities/MathHelpers.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include #include #include -#include using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; @@ -25,8 +25,10 @@ Acts::SurfaceBounds::BoundsType Acts::EllipseBounds::type() const { return SurfaceBounds::eEllipse; } -static inline double square(double x) { - return x * x; +Acts::Vector2 Acts::EllipseBounds::closestPoint( + const Acts::Vector2& /*lposition*/, + const Acts::SquareMatrix2& /*metric*/) const { + throw std::logic_error("Not implemented"); } /// @warning This **only** works for tolerance-based checks diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index bdb0673a010..aa22a55afb0 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -18,6 +18,14 @@ Acts::SurfaceBounds::BoundsType Acts::LineBounds::type() const { return SurfaceBounds::eLine; } +Acts::Vector2 Acts::LineBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + double r = get(LineBounds::eR); + double halfLengthZ = get(LineBounds::eHalfLengthZ); + return detail::computeClosestPointOnAlignedBox( + Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ), lposition, metric); +} + bool Acts::LineBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 9fa2cc82e27..78c662a0220 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -34,8 +34,7 @@ Acts::Vector2 Acts::RadialBounds::closestPoint( const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { return detail::computeClosestPointOnAlignedBox( Vector2(get(eMinR), -get(eHalfPhiSector)), - Vector2(get(eMaxR), get(eHalfPhiSector)), shifted(lposition), - std::nullopt); + Vector2(get(eMaxR), get(eHalfPhiSector)), shifted(lposition), metric); } bool Acts::RadialBounds::inside( diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 3450e8cea97..37c5eab767e 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -8,7 +8,6 @@ #include "Acts/Surfaces/TrapezoidBounds.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/ConvexPolygonBounds.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" @@ -44,12 +43,23 @@ Acts::TrapezoidBounds::TrapezoidBounds( checkConsistency(); } -Acts::TrapezoidBounds::~TrapezoidBounds() = default; - Acts::SurfaceBounds::BoundsType Acts::TrapezoidBounds::type() const { return SurfaceBounds::eTrapezoid; } +Acts::Vector2 Acts::TrapezoidBounds::closestPoint( + const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { + const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); + const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); + const double hlY = get(TrapezoidBounds::eHalfLengthY); + + Vector2 vertices[] = { + {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; + + return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, + vertices, metric); +} + bool Acts::TrapezoidBounds::inside( const Acts::Vector2& lposition, const Acts::BoundaryTolerance& boundaryTolerance) const { diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp index 470512383a0..452da8246aa 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp @@ -40,8 +40,16 @@ class SurfaceBoundsStub : public SurfaceBounds { #endif ~SurfaceBoundsStub() override = default; + BoundsType type() const final { return SurfaceBounds::eOther; } + std::vector values() const override { return m_values; } + + Vector2 closestPoint(const Vector2& lposition, + const SquareMatrix2& /*metric*/) const final { + return lposition; + } + bool inside(const Vector2& /*lpos*/, const BoundaryTolerance& /*boundaryTolerance*/) const final { return true; From e6e0cc23a0b8ec7248e8e509646e2bc31a6b5a67 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Tue, 17 Dec 2024 18:17:28 +0100 Subject: [PATCH 04/33] draft --- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 27 ++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 7c3ec5e31c3..befad48a982 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -54,18 +54,32 @@ class SurfaceBounds { /// @return is a BoundsType enum virtual BoundsType type() const = 0; + virtual bool isCartesian() const = 0; + + virtual SquareMatrix2 boundToCartesianJacobian( + const Vector2& lposition) const = 0; + + virtual SquareMatrix2 cartesianToBoundJacobian( + const Vector2& lposition) const = 0; + /// Access method for bound values, this is a dynamically sized /// vector containing the parameters needed to describe these bounds /// /// @return of the stored values for this SurfaceBounds object virtual std::vector values() const = 0; - virtual Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const = 0; + virtual bool inside(const Vector2& lposition) const = 0; + + virtual Vector2 closestPoint( + const Vector2& lposition, + const std::optional& metric) const = 0; virtual double distance(const Vector2& lposition, - const SquareMatrix2& metric) const { - return std::sqrt(lposition.transpose() * metric * lposition); + const std::optional& metric) const { + Vector2 closest = closestPoint(lposition, metric); + Vector2 diff = closest - lposition; + return std::sqrt((diff.transpose() * + metric.value_or(SquareMatrix2::Identity()) * diff)(0, 0)); } /// Inside check for the bounds object driven by the boundary check directive @@ -76,7 +90,10 @@ class SurfaceBounds { /// @param boundaryTolerance boundary check directive /// @return boolean indicator for the success of this operation virtual bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const = 0; + const BoundaryTolerance& boundaryTolerance) const { + // TODO + return inside(lposition); + } /// Output Method for std::ostream, to be overloaded by child classes /// From bdf87b6d43b9dbee94a170dfb2908a5518065ebb Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 11:28:21 +0100 Subject: [PATCH 05/33] clean annulus --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 100 ++++++------------- Core/src/Surfaces/AnnulusBounds.cpp | 15 +++ 2 files changed, 44 insertions(+), 71 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index c6e999b21b0..c9418b637d0 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -13,13 +13,11 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Utilities/detail/periodic.hpp" #include #include #include #include -#include #include namespace Acts { @@ -72,12 +70,26 @@ class AnnulusBounds : public DiscBounds { AnnulusBounds(const AnnulusBounds& source) = default; - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eAnnulus; } + + bool isCartesian() const final { return false; } + + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + return cartesianToBoundJacobian(lposition).inverse(); + } + + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { + return m_rotationStripPC * m_translation.jacobian(lposition); + } /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values - std::vector values() const final; + std::vector values() const final { + std::vector valvector; + valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); + return valvector; + } Vector2 closestPoint(const Vector2& lposition, const SquareMatrix2& metric) const final; @@ -103,24 +115,29 @@ class AnnulusBounds : public DiscBounds { /// @brief Returns the right angular edge of the module /// @return The right side angle - double phiMin() const; + double phiMin() const { return get(eMinPhiRel) + get(eAveragePhi); } /// @brief Returns the left angular edge of the module /// @return The left side angle - double phiMax() const; + double phiMax() const { return get(eMaxPhiRel) + get(eAveragePhi); } /// Returns true for full phi coverage - bool coversFullAzimuth() const final; + bool coversFullAzimuth() const final { + return (std::abs((get(eMinPhiRel) - get(eMaxPhiRel)) - std::numbers::pi) < + s_onSurfaceTolerance); + } /// Checks if this is inside the radial coverage /// given the a tolerance - bool insideRadialBounds(double R, double tolerance = 0.) const final; + bool insideRadialBounds(double R, double tolerance = 0.) const final { + return ((R + tolerance) > get(eMinR) && (R - tolerance) < get(eMaxR)); + } /// Return a reference radius for binning - double binningValueR() const final; + double binningValueR() const final { return 0.5 * (get(eMinR) + get(eMaxR)); } /// Return a reference radius for binning - double binningValuePhi() const final; + double binningValuePhi() const final { return get(eAveragePhi); } /// @brief Returns moduleOrigin, but rotated out, so @c averagePhi is already /// considered. The module origin needs to consider the rotation introduced by @@ -151,10 +168,10 @@ class AnnulusBounds : public DiscBounds { unsigned int quarterSegments = 2u) const override; /// This method returns inner radius - double rMin() const final; + double rMin() const final { return get(eMinR); } /// This method returns outer radius - double rMax() const final; + double rMax() const final { return get(eMaxR); } private: std::array m_values; @@ -205,63 +222,4 @@ class AnnulusBounds : public DiscBounds { Vector2 stripXYToModulePC(const Vector2& vStripXY) const; }; -inline SurfaceBounds::BoundsType AnnulusBounds::type() const { - return SurfaceBounds::eAnnulus; -} - -inline double AnnulusBounds::rMin() const { - return get(eMinR); -} - -inline double AnnulusBounds::rMax() const { - return get(eMaxR); -} - -inline double AnnulusBounds::phiMin() const { - return get(eMinPhiRel) + get(eAveragePhi); -} - -inline double AnnulusBounds::phiMax() const { - return get(eMaxPhiRel) + get(eAveragePhi); -} - -inline bool AnnulusBounds::coversFullAzimuth() const { - return (std::abs((get(eMinPhiRel) - get(eMaxPhiRel)) - std::numbers::pi) < - s_onSurfaceTolerance); -} - -inline bool AnnulusBounds::insideRadialBounds(double R, - double tolerance) const { - return ((R + tolerance) > get(eMinR) && (R - tolerance) < get(eMaxR)); -} - -inline double AnnulusBounds::binningValueR() const { - return 0.5 * (get(eMinR) + get(eMaxR)); -} - -inline double AnnulusBounds::binningValuePhi() const { - return get(eAveragePhi); -} - -inline std::vector AnnulusBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void AnnulusBounds::checkConsistency() noexcept(false) { - if (get(eMinR) < 0. || get(eMaxR) < 0. || get(eMinR) > get(eMaxR) || - std::abs(get(eMinR) - get(eMaxR)) < s_epsilon) { - throw std::invalid_argument("AnnulusBounds: invalid radial setup."); - } - if (get(eMinPhiRel) != detail::radian_sym(get(eMinPhiRel)) || - get(eMaxPhiRel) != detail::radian_sym(get(eMaxPhiRel)) || - get(eMinPhiRel) > get(eMaxPhiRel)) { - throw std::invalid_argument("AnnulusBounds: invalid phi boundary setup."); - } - if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { - throw std::invalid_argument("AnnulusBounds: invalid phi positioning."); - } -} - } // namespace Acts diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 0c29fc2bfd1..a5a85c83183 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -373,4 +373,19 @@ std::ostream& AnnulusBounds::toStream(std::ostream& sl) const { return sl; } +void AnnulusBounds::checkConsistency() noexcept(false) { + if (get(eMinR) < 0. || get(eMaxR) < 0. || get(eMinR) > get(eMaxR) || + std::abs(get(eMinR) - get(eMaxR)) < s_epsilon) { + throw std::invalid_argument("AnnulusBounds: invalid radial setup."); + } + if (get(eMinPhiRel) != detail::radian_sym(get(eMinPhiRel)) || + get(eMaxPhiRel) != detail::radian_sym(get(eMaxPhiRel)) || + get(eMinPhiRel) > get(eMaxPhiRel)) { + throw std::invalid_argument("AnnulusBounds: invalid phi boundary setup."); + } + if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { + throw std::invalid_argument("AnnulusBounds: invalid phi positioning."); + } +} + } // namespace Acts From f856077463393535ab757548888af6080235710a Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 15:12:36 +0100 Subject: [PATCH 06/33] tmp --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 10 +++------- Core/src/Surfaces/AnnulusBounds.cpp | 13 ++++++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index c9418b637d0..f3f15c38c4c 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -74,13 +74,9 @@ class AnnulusBounds : public DiscBounds { bool isCartesian() const final { return false; } - SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { - return cartesianToBoundJacobian(lposition).inverse(); - } + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { - return m_rotationStripPC * m_translation.jacobian(lposition); - } + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector /// @@ -92,7 +88,7 @@ class AnnulusBounds : public DiscBounds { } Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index a5a85c83183..826d4f03de8 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -13,6 +13,7 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" +#include "Acts/Utilities/detail/periodic.hpp" #include #include @@ -38,7 +39,7 @@ Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p, // weighted scalar product of line to point and segment line auto u = ((p - a).transpose() * metric * n).value() / f; // clamp to [0, 1], convert to point - return std::min(std::max(u, 0.), 1.) * n + a; + return std::clamp(u, 0., 1.) * n + a; } } // namespace @@ -157,8 +158,9 @@ std::vector AnnulusBounds::vertices( m_outLeftStripXY}; } -Vector2 AnnulusBounds::closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const { +Vector2 AnnulusBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { // locpo is PC in STRIP SYSTEM // we need to rotate the locpo Vector2 locpo_rotated = m_rotationStripPC * lposition; @@ -238,7 +240,7 @@ Vector2 AnnulusBounds::closestPoint(const Vector2& lposition, double B = cosDPhiPhiStrip; double C = -sinDPhiPhiStrip; - ActsMatrix<2, 2> jacobianStripPCToModulePC; + SquareMatrix2 jacobianStripPCToModulePC; jacobianStripPCToModulePC(0, 0) = (B * O_x + C * O_y + r_strip) / sqrtA; jacobianStripPCToModulePC(0, 1) = r_strip * (B * O_y + O_x * sinDPhiPhiStrip) / sqrtA; @@ -247,7 +249,8 @@ Vector2 AnnulusBounds::closestPoint(const Vector2& lposition, // Mahalanobis distance uses the coordinate weights (usually inverse // covariance) as a metric - auto metricModulePC = jacobianStripPCToModulePC.transpose() * metric * + auto metricModulePC = jacobianStripPCToModulePC.transpose() * + metric.value_or(SquareMatrix2::Identity()) * jacobianStripPCToModulePC; double minDist = std::numeric_limits::max(); From 7f29993ce60064682a95dd984bd33180f8fbbc6b Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 15:34:53 +0100 Subject: [PATCH 07/33] tmp --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 4 ++-- Core/include/Acts/Surfaces/ConeBounds.hpp | 3 --- Core/src/Surfaces/AnnulusBounds.cpp | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index f3f15c38c4c..48e4eb3e3a3 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -45,8 +45,6 @@ class AnnulusBounds : public DiscBounds { eSize = 7 }; - AnnulusBounds() = delete; - /// @brief Default constructor from parameters /// @param minR inner radius, in module system /// @param maxR outer radius, in module system @@ -87,6 +85,8 @@ class AnnulusBounds : public DiscBounds { return valvector; } + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 58e2958d249..9b9072d9382 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -34,7 +34,6 @@ namespace Acts { /// /// @image html ConeBounds.gif /// - class ConeBounds : public SurfaceBounds { public: enum BoundValues : int { @@ -46,8 +45,6 @@ class ConeBounds : public SurfaceBounds { eSize = 5 }; - ConeBounds() = delete; - /// Constructor - open cone with alpha, by default a full cone /// but optionally can make a conical section /// diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 826d4f03de8..b9a9aff86de 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -158,6 +158,20 @@ std::vector AnnulusBounds::vertices( m_outLeftStripXY}; } +SquareMatrix2 AnnulusBounds::boundToCartesianJacobian( + const Vector2& lposition) const { + return SquareMatrix2::Identity(); // TODO +} + +SquareMatrix2 AnnulusBounds::cartesianToBoundJacobian( + const Vector2& lposition) const { + return SquareMatrix2::Identity(); // TODO +} + +bool AnnulusBounds::inside(const Vector2& lposition) const { + return inside(lposition, 0., 0.); +} + Vector2 AnnulusBounds::closestPoint( const Vector2& lposition, const std::optional& metric) const { From a595467fd6834f93c4a022140f05c00a8d453bf0 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 15:48:02 +0100 Subject: [PATCH 08/33] tmp --- Core/include/Acts/Surfaces/ConeBounds.hpp | 13 ++++-- Core/src/Surfaces/ConeBounds.cpp | 53 ++++++++++++++++------- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 9b9072d9382..72df71501e7 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -76,13 +76,21 @@ class ConeBounds : public SurfaceBounds { BoundsType type() const final; + bool isCartesian() const final { return false; } + + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// inside method for local position /// @@ -90,8 +98,7 @@ class ConeBounds : public SurfaceBounds { /// @param boundaryTolerance is the boundary check directive /// @return is a boolean indicating if the position is inside bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance = - BoundaryTolerance::None()) const final; + const BoundaryTolerance& boundaryTolerance) const final; /// Output Method for std::ostream /// diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 659270cd9f1..06d48d39a4c 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -8,6 +8,7 @@ #include "Acts/Surfaces/ConeBounds.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" @@ -18,34 +19,45 @@ #include #include -Acts::ConeBounds::ConeBounds(double alpha, bool symm, double halfphi, - double avphi) noexcept(false) +namespace Acts { + +ConeBounds::ConeBounds(double alpha, bool symm, double halfphi, + double avphi) noexcept(false) : m_values({alpha, symm ? -std::numeric_limits::infinity() : 0, std::numeric_limits::infinity(), halfphi, avphi}), m_tanAlpha(std::tan(alpha)) { checkConsistency(); } -Acts::ConeBounds::ConeBounds(double alpha, double minz, double maxz, - double halfphi, double avphi) noexcept(false) +ConeBounds::ConeBounds(double alpha, double minz, double maxz, double halfphi, + double avphi) noexcept(false) : m_values({alpha, minz, maxz, halfphi, avphi}), m_tanAlpha(std::tan(alpha)) { checkConsistency(); } -Acts::ConeBounds::ConeBounds(const std::array& values) noexcept( - false) +ConeBounds::ConeBounds(const std::array& values) noexcept(false) : m_values(values), m_tanAlpha(std::tan(values[eAlpha])) { checkConsistency(); } -Acts::SurfaceBounds::BoundsType Acts::ConeBounds::type() const { +SurfaceBounds::BoundsType ConeBounds::type() const { return SurfaceBounds::eCone; } +SquareMatrix2 ConeBounds::boundToCartesianJacobian( + const Vector2& lposition) const { + return SquareMatrix2::Identity(); // TODO +} + +SquareMatrix2 ConeBounds::cartesianToBoundJacobian( + const Vector2& lposition) const { + return SquareMatrix2::Identity(); // TODO +} + /// Shift r-phi coordinate to be centered around the average phi. -Acts::Vector2 Acts::ConeBounds::shifted(const Acts::Vector2& lposition) const { - using Acts::detail::radian_sym; +Vector2 ConeBounds::shifted(const Vector2& lposition) const { + using detail::radian_sym; auto x = r(lposition[eBoundLoc1]); // cone radius at the local position Vector2 shifted; @@ -57,30 +69,39 @@ Acts::Vector2 Acts::ConeBounds::shifted(const Acts::Vector2& lposition) const { return shifted; } -Acts::Vector2 Acts::ConeBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +bool ConeBounds::inside(const Vector2& lposition) const { + auto rphiHalf = r(lposition[eBoundLoc1]) * get(eHalfPhiSector); + return detail::insideAlignedBox( + Vector2(-rphiHalf, get(eMinZ)), Vector2(rphiHalf, get(eMaxZ)), + BoundaryTolerance::None(), shifted(lposition), std::nullopt); +} + +Vector2 ConeBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { auto rphiHalf = r(lposition[eBoundLoc1]) * get(eHalfPhiSector); return detail::computeClosestPointOnAlignedBox(Vector2(-rphiHalf, get(eMinZ)), Vector2(rphiHalf, get(eMaxZ)), shifted(lposition), metric); } -bool Acts::ConeBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool ConeBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { auto rphiHalf = r(lposition[eBoundLoc1]) * get(eHalfPhiSector); return detail::insideAlignedBox( Vector2(-rphiHalf, get(eMinZ)), Vector2(rphiHalf, get(eMaxZ)), boundaryTolerance, shifted(lposition), std::nullopt); } -std::ostream& Acts::ConeBounds::toStream(std::ostream& sl) const { +std::ostream& ConeBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::ConeBounds: (tanAlpha, minZ, maxZ, halfPhiSector, averagePhi) " + sl << "ConeBounds: (tanAlpha, minZ, maxZ, halfPhiSector, averagePhi) " "= "; sl << "(" << m_tanAlpha << ", " << get(eMinZ) << ", " << get(eMaxZ) << ", " << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")"; sl << std::setprecision(-1); return sl; } + +} // namespace Acts From 793c9506b18fdcbee62a5827c9ac17cd70c5b404 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 16:09:32 +0100 Subject: [PATCH 09/33] includes --- Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index 011f329f14e..530888c1490 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -15,10 +15,7 @@ #include "Acts/Surfaces/SurfaceBounds.hpp" #include -#include -#include #include -#include #include #include From 0c965e7e89eff7070d7a95ff16e048e4c2f37b8b Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 16:31:45 +0100 Subject: [PATCH 10/33] tmp --- .../Acts/Surfaces/ConvexPolygonBounds.hpp | 8 ++- .../Acts/Surfaces/ConvexPolygonBounds.ipp | 7 ++ Core/include/Acts/Surfaces/CylinderBounds.hpp | 18 +++-- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 23 ++++-- Core/include/Acts/Surfaces/PlanarBounds.hpp | 12 ++++ Core/include/Acts/Surfaces/RadialBounds.hpp | 4 -- .../include/Acts/Surfaces/RectangleBounds.hpp | 8 +-- Core/src/Surfaces/ConvexPolygonBounds.cpp | 42 ++++++----- Core/src/Surfaces/CylinderBounds.cpp | 70 ++++++++++++------- Core/src/Surfaces/RectangleBounds.cpp | 33 +++++---- 10 files changed, 146 insertions(+), 79 deletions(-) diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index 530888c1490..76e96941d9a 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -99,8 +99,10 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { BoundsType type() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// Return whether a local 2D point lies inside of the bounds defined by this /// object. @@ -159,8 +161,10 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// @return The bounds type BoundsType type() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// Return whether a local 2D point lies inside of the bounds defined by this /// object. diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 5982acdc647..53cdad28022 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -102,6 +102,13 @@ Acts::SurfaceBounds::BoundsType Acts::ConvexPolygonBounds::type() const { return SurfaceBounds::eConvexPolygon; } +template +bool Acts::ConvexPolygonBounds::inside( + const Acts::Vector2& lposition) const { + return detail::insidePolygon(m_vertices, BoundaryTolerance::None(), lposition, + std::nullopt); +} + template Acts::Vector2 Acts::ConvexPolygonBounds::closestPoint( const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index 8f27f9505b4..dd6bf5ffe2b 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -45,6 +45,7 @@ namespace Acts { /// \ | / \ | / /// \|/______________\|/ /// 2 * ZhalfLength +/// class CylinderBounds : public SurfaceBounds { public: enum BoundValues : int { @@ -57,8 +58,6 @@ class CylinderBounds : public SurfaceBounds { eSize = 6 }; - CylinderBounds() = delete; - /// Constructor - full cylinder /// /// @param r The radius of the cylinder @@ -85,15 +84,23 @@ class CylinderBounds : public SurfaceBounds { checkConsistency(); } - BoundsType type() const final; + BoundsType type() const final { return eCylinder; } + + bool isCartesian() const final { return false; } + + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside @@ -141,9 +148,6 @@ class CylinderBounds : public SurfaceBounds { /// Helper method to shift into the phi-frame /// @param lposition the polar coordinates in the global frame Vector2 shifted(const Vector2& lposition) const; - - /// Return the jacobian into the polar coordinate - ActsMatrix<2, 2> jacobian() const; }; inline std::vector CylinderBounds::values() const { diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 60cd24a1d67..16bd0011b36 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -20,18 +20,29 @@ namespace Acts { class InfiniteBounds : public SurfaceBounds { public: - InfiniteBounds() = default; - - ~InfiniteBounds() override = default; - SurfaceBounds::BoundsType type() const final { return SurfaceBounds::eBoundless; } + bool isCartesian() const final { return true; } + + SquareMatrix2 boundToCartesianJacobian( + const Vector2& /*lposition*/) const final { + return SquareMatrix2::Identity(); + } + + SquareMatrix2 cartesianToBoundJacobian( + const Vector2& /*lposition*/) const final { + return SquareMatrix2::Identity(); + } + std::vector values() const final { return {}; } - Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& /*metric*/) const final { + bool inside(const Vector2& /*lposition*/) const final { return true; } + + Vector2 closestPoint( + const Vector2& lposition, + const std::optional& /*metric*/) const final { return lposition; } diff --git a/Core/include/Acts/Surfaces/PlanarBounds.hpp b/Core/include/Acts/Surfaces/PlanarBounds.hpp index 28bc0e42b60..961547065fc 100644 --- a/Core/include/Acts/Surfaces/PlanarBounds.hpp +++ b/Core/include/Acts/Surfaces/PlanarBounds.hpp @@ -36,6 +36,18 @@ class PlanarBounds : public SurfaceBounds { virtual std::vector vertices( unsigned int quarterSegments = 2u) const = 0; + bool isCartesian() const final { return true; } + + SquareMatrix2 boundToCartesianJacobian( + const Vector2& /*lposition*/) const final { + return SquareMatrix2::Identity(); + } + + SquareMatrix2 cartesianToBoundJacobian( + const Vector2& /*lposition*/) const final { + return SquareMatrix2::Identity(); + } + /// Bounding box parameters /// /// @return rectangle bounds for a bounding box diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index 65abdae499e..a99d0583331 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -38,8 +38,6 @@ class RadialBounds : public DiscBounds { eSize = 4 }; - RadialBounds() = delete; - /// Constructor for full disc of symmetric disc around phi=0 /// /// @param minR The inner radius (0 for full disc) @@ -60,8 +58,6 @@ class RadialBounds : public DiscBounds { checkConsistency(); } - ~RadialBounds() override = default; - SurfaceBounds::BoundsType type() const final; /// Return the bound values as dynamically sized vector diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index 9d9e0d72771..44497ef9f9a 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -39,8 +39,6 @@ class RectangleBounds : public PlanarBounds { eSize = 4 }; - RectangleBounds() = delete; - /// Constructor with halflength in x and y - symmetric /// /// @param halfX halflength in X @@ -68,14 +66,14 @@ class RectangleBounds : public PlanarBounds { checkConsistency(); } - ~RectangleBounds() override = default; - BoundsType type() const final; std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside diff --git a/Core/src/Surfaces/ConvexPolygonBounds.cpp b/Core/src/Surfaces/ConvexPolygonBounds.cpp index d50cb5502db..31fd953dd39 100644 --- a/Core/src/Surfaces/ConvexPolygonBounds.cpp +++ b/Core/src/Surfaces/ConvexPolygonBounds.cpp @@ -15,7 +15,9 @@ #include #include -std::ostream& Acts::ConvexPolygonBoundsBase::toStream(std::ostream& sl) const { +namespace Acts { + +std::ostream& ConvexPolygonBoundsBase::toStream(std::ostream& sl) const { std::vector vtxs = vertices(); sl << "Acts::ConvexPolygonBounds<" << vtxs.size() << ">: vertices: [x, y]\n"; for (std::size_t i = 0; i < vtxs.size(); i++) { @@ -29,7 +31,7 @@ std::ostream& Acts::ConvexPolygonBoundsBase::toStream(std::ostream& sl) const { return sl; } -std::vector Acts::ConvexPolygonBoundsBase::values() const { +std::vector ConvexPolygonBoundsBase::values() const { std::vector values; for (const auto& vtx : vertices()) { values.push_back(vtx.x()); @@ -38,42 +40,50 @@ std::vector Acts::ConvexPolygonBoundsBase::values() const { return values; } -Acts::ConvexPolygonBounds::ConvexPolygonBounds( +ConvexPolygonBounds::ConvexPolygonBounds( const std::vector& vertices) : m_vertices(vertices.begin(), vertices.end()), m_boundingBox(makeBoundingBox(vertices)) {} -Acts::SurfaceBounds::BoundsType -Acts::ConvexPolygonBounds::type() const { +SurfaceBounds::BoundsType ConvexPolygonBounds::type() const { return SurfaceBounds::eConvexPolygon; } -Acts::Vector2 Acts::ConvexPolygonBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +bool ConvexPolygonBounds::inside( + const Vector2& lposition) const { + return detail::insidePolygon(m_vertices, BoundaryTolerance::None(), lposition, + std::nullopt); +} + +Vector2 ConvexPolygonBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { return detail::VerticesHelper::computeClosestPointOnPolygon( lposition, std::span(m_vertices.data(), m_vertices.size()), - metric); + metric.value_or(SquareMatrix2::Identity())); } -bool Acts::ConvexPolygonBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool ConvexPolygonBounds::inside( + const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { return detail::insidePolygon( std::span(m_vertices.data(), m_vertices.size()), boundaryTolerance, lposition, std::nullopt); } -std::vector Acts::ConvexPolygonBounds< - Acts::PolygonDynamic>::vertices(unsigned int /*lseg*/) const { +std::vector ConvexPolygonBounds::vertices( + unsigned int /*lseg*/) const { return {m_vertices.begin(), m_vertices.end()}; } -const Acts::RectangleBounds& -Acts::ConvexPolygonBounds::boundingBox() const { +const RectangleBounds& ConvexPolygonBounds::boundingBox() + const { return m_boundingBox; } -void Acts::ConvexPolygonBounds::checkConsistency() const +void ConvexPolygonBounds::checkConsistency() const noexcept(false) { convex_impl(m_vertices); } + +} // namespace Acts diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index c5c24cba812..3130061f23b 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -8,6 +8,7 @@ #include "Acts/Surfaces/CylinderBounds.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" @@ -22,22 +23,24 @@ #include #include -using Acts::VectorHelpers::perp; -using Acts::VectorHelpers::phi; +namespace Acts { -Acts::SurfaceBounds::BoundsType Acts::CylinderBounds::type() const { - return SurfaceBounds::eCylinder; -} +using VectorHelpers::perp; +using VectorHelpers::phi; -Acts::Vector2 Acts::CylinderBounds::shifted( - const Acts::Vector2& lposition) const { - return {Acts::detail::radian_sym((lposition[Acts::eBoundLoc0] / get(eR)) - - get(eAveragePhi)), - lposition[Acts::eBoundLoc1]}; +SquareMatrix2 CylinderBounds::boundToCartesianJacobian( + const Vector2& /*lposition*/) const { + SquareMatrix2 j; + j(0, eBoundLoc0) = get(eR); + j(0, eBoundLoc1) = 0; + j(1, eBoundLoc0) = 0; + j(1, eBoundLoc1) = 1; + return j; } -Acts::ActsMatrix<2, 2> Acts::CylinderBounds::jacobian() const { - ActsMatrix<2, 2> j; +SquareMatrix2 CylinderBounds::cartesianToBoundJacobian( + const Vector2& /*lposition*/) const { + SquareMatrix2 j; j(0, eBoundLoc0) = 1 / get(eR); j(0, eBoundLoc1) = 0; j(1, eBoundLoc0) = 0; @@ -45,8 +48,19 @@ Acts::ActsMatrix<2, 2> Acts::CylinderBounds::jacobian() const { return j; } -Acts::Vector2 Acts::CylinderBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +Vector2 CylinderBounds::shifted(const Vector2& lposition) const { + return { + detail::radian_sym((lposition[eBoundLoc0] / get(eR)) - get(eAveragePhi)), + lposition[eBoundLoc1]}; +} + +bool CylinderBounds::inside(const Vector2& lposition) const { + return false; // TODO +} + +Vector2 CylinderBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { double bevelMinZ = get(eBevelMinZ); double bevelMaxZ = get(eBevelMaxZ); double halfLengthZ = get(eHalfLengthZ); @@ -61,13 +75,12 @@ Acts::Vector2 Acts::CylinderBounds::closestPoint( Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, upperRight, middleRight, lowerRight}; - return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, - vertices, metric); + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } -bool Acts::CylinderBounds::inside( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +bool CylinderBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { double bevelMinZ = get(eBevelMinZ); double bevelMaxZ = get(eBevelMaxZ); @@ -75,9 +88,10 @@ bool Acts::CylinderBounds::inside( double halfPhi = get(eHalfPhiSector); if (bevelMinZ == 0. || bevelMaxZ == 0.) { - return detail::insideAlignedBox( - Vector2(-halfPhi, -halfLengthZ), Vector2(halfPhi, halfLengthZ), - boundaryTolerance, shifted(lposition), jacobian()); + return detail::insideAlignedBox(Vector2(-halfPhi, -halfLengthZ), + Vector2(halfPhi, halfLengthZ), + boundaryTolerance, shifted(lposition), + boundToCartesianJacobian(lposition)); } double radius = get(eR); @@ -111,13 +125,13 @@ bool Acts::CylinderBounds::inside( upperRight, middleRight, lowerRight}; return detail::insidePolygon(vertices, boundaryTolerance, lposition, - jacobian()); + boundToCartesianJacobian(lposition)); } -std::ostream& Acts::CylinderBounds::toStream(std::ostream& sl) const { +std::ostream& CylinderBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::CylinderBounds: (radius, halfLengthZ, halfPhiSector, " + sl << "CylinderBounds: (radius, halfLengthZ, halfPhiSector, " "averagePhi, bevelMinZ, bevelMaxZ) = "; sl << "(" << get(eR) << ", " << get(eHalfLengthZ) << ", "; sl << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ", "; @@ -126,7 +140,7 @@ std::ostream& Acts::CylinderBounds::toStream(std::ostream& sl) const { return sl; } -std::vector Acts::CylinderBounds::circleVertices( +std::vector CylinderBounds::circleVertices( const Transform3 transform, unsigned int quarterSegments) const { std::vector vertices; @@ -173,7 +187,7 @@ std::vector Acts::CylinderBounds::circleVertices( return vertices; } -void Acts::CylinderBounds::checkConsistency() noexcept(false) { +void CylinderBounds::checkConsistency() noexcept(false) { if (get(eR) <= 0.) { throw std::invalid_argument( "CylinderBounds: invalid radial setup: radius is negative"); @@ -196,3 +210,5 @@ void Acts::CylinderBounds::checkConsistency() noexcept(false) { throw std::invalid_argument("CylinderBounds: invalid bevel at max Z."); } } + +} // namespace Acts diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index cb2991d26c7..531813d3b7f 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -8,39 +8,46 @@ #include "Acts/Surfaces/RectangleBounds.hpp" +#include "Acts/Definitions/Algebra.hpp" +#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include #include -Acts::Vector2 Acts::RectangleBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +namespace Acts { + +bool RectangleBounds::inside(const Vector2& lposition) const { + return detail::insideAlignedBox(m_min, m_max, BoundaryTolerance::None(), + lposition, std::nullopt); +} + +Vector2 RectangleBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { std::array vertices = { {m_min, {m_max[0], m_min[1]}, m_max, {m_min[0], m_max[1]}}}; - return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, - vertices, metric); + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } -bool Acts::RectangleBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool RectangleBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { return detail::insideAlignedBox(m_min, m_max, boundaryTolerance, lposition, std::nullopt); } -std::vector Acts::RectangleBounds::vertices( - unsigned int /*lseg*/) const { +std::vector RectangleBounds::vertices(unsigned int /*lseg*/) const { // counter-clockwise starting from bottom-left corner return {m_min, {m_max.x(), m_min.y()}, m_max, {m_min.x(), m_max.y()}}; } -const Acts::RectangleBounds& Acts::RectangleBounds::boundingBox() const { +const RectangleBounds& RectangleBounds::boundingBox() const { return (*this); } -// ostream operator overload -std::ostream& Acts::RectangleBounds::toStream(std::ostream& sl) const { +std::ostream& RectangleBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::RectangleBounds: (hlX, hlY) = " @@ -51,3 +58,5 @@ std::ostream& Acts::RectangleBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts From 7a1c005565d42e73c8c4bd7e8f65fb981706ff84 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 17:40:01 +0100 Subject: [PATCH 11/33] tmp --- .../Acts/Surfaces/ConvexPolygonBounds.hpp | 8 -- .../Acts/Surfaces/ConvexPolygonBounds.ipp | 49 +++++------ Core/include/Acts/Surfaces/DiamondBounds.hpp | 10 +-- .../Acts/Surfaces/DiscTrapezoidBounds.hpp | 21 ++--- Core/include/Acts/Surfaces/EllipseBounds.hpp | 8 +- Core/include/Acts/Surfaces/LineBounds.hpp | 18 +++- Core/include/Acts/Surfaces/PlaneSurface.hpp | 6 -- Core/include/Acts/Surfaces/RadialBounds.hpp | 14 ++- .../include/Acts/Surfaces/TrapezoidBounds.hpp | 6 +- Core/include/Acts/Utilities/ThrowAssert.hpp | 1 + Core/src/Surfaces/DiamondBounds.cpp | 39 +++++--- Core/src/Surfaces/DiscTrapezoidBounds.cpp | 72 ++++++++------- Core/src/Surfaces/EllipseBounds.cpp | 45 +++++----- Core/src/Surfaces/LineBounds.cpp | 29 ++++-- Core/src/Surfaces/RadialBounds.cpp | 41 ++++++--- Core/src/Surfaces/TrapezoidBounds.cpp | 88 ++++++++++++------- 16 files changed, 275 insertions(+), 180 deletions(-) diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index 76e96941d9a..18ecca6f22e 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -79,8 +79,6 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { static_assert(N >= 3, "ConvexPolygonBounds needs at least 3 sides."); - ConvexPolygonBounds() = delete; - /// Constructor from a vector of vertices, to facilitate construction. /// This will throw if the vector size does not match `num_vertices`. /// This will throw if the vertices do not form a convex polygon. @@ -146,12 +144,6 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { public: constexpr static int eSize = -1; - /// Default constructor, deleted - ConvexPolygonBounds() = delete; - - /// Defaulted destructor - ~ConvexPolygonBounds() override = default; - /// Constructor from a vector of vertices, to facilitate construction. /// This will throw if the vertices do not form a convex polygon. /// @param vertices The list of vertices. diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 53cdad28022..e7fb80f8d27 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -6,18 +6,15 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" -#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/ThrowAssert.hpp" -#include -#include +namespace Acts { template - requires std::same_as -void Acts::ConvexPolygonBoundsBase::convex_impl( - const coll_t& vertices) noexcept(false) { + requires std::same_as +void ConvexPolygonBoundsBase::convex_impl(const coll_t& vertices) noexcept( + false) { const std::size_t N = vertices.size(); for (std::size_t i = 0; i < N; i++) { std::size_t j = (i + 1) % N; @@ -53,7 +50,7 @@ void Acts::ConvexPolygonBoundsBase::convex_impl( } template -Acts::RectangleBounds Acts::ConvexPolygonBoundsBase::makeBoundingBox( +RectangleBounds ConvexPolygonBoundsBase::makeBoundingBox( const coll_t& vertices) { Vector2 vmax, vmin; vmax = vertices[0]; @@ -68,8 +65,8 @@ Acts::RectangleBounds Acts::ConvexPolygonBoundsBase::makeBoundingBox( } template -Acts::ConvexPolygonBounds::ConvexPolygonBounds( - const std::vector& vertices) noexcept(false) +ConvexPolygonBounds::ConvexPolygonBounds( + const std::vector& vertices) noexcept(false) : m_vertices(), m_boundingBox(makeBoundingBox(vertices)) { throw_assert(vertices.size() == N, "Size and number of given vertices do not match."); @@ -80,15 +77,15 @@ Acts::ConvexPolygonBounds::ConvexPolygonBounds( } template -Acts::ConvexPolygonBounds::ConvexPolygonBounds( +ConvexPolygonBounds::ConvexPolygonBounds( const vertex_array& vertices) noexcept(false) : m_vertices(vertices), m_boundingBox(makeBoundingBox(vertices)) { checkConsistency(); } template -Acts::ConvexPolygonBounds::ConvexPolygonBounds( - const value_array& values) noexcept(false) +ConvexPolygonBounds::ConvexPolygonBounds(const value_array& values) noexcept( + false) : m_vertices(), m_boundingBox(0., 0.) { for (std::size_t i = 0; i < N; i++) { m_vertices[i] = Vector2(values[2 * i], values[2 * i + 1]); @@ -98,44 +95,46 @@ Acts::ConvexPolygonBounds::ConvexPolygonBounds( } template -Acts::SurfaceBounds::BoundsType Acts::ConvexPolygonBounds::type() const { +SurfaceBounds::BoundsType ConvexPolygonBounds::type() const { return SurfaceBounds::eConvexPolygon; } template -bool Acts::ConvexPolygonBounds::inside( - const Acts::Vector2& lposition) const { +bool ConvexPolygonBounds::inside(const Vector2& lposition) const { return detail::insidePolygon(m_vertices, BoundaryTolerance::None(), lposition, std::nullopt); } template -Acts::Vector2 Acts::ConvexPolygonBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +Vector2 ConvexPolygonBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { return detail::VerticesHelper::computeClosestPointOnPolygon( - lposition, m_vertices, metric); + lposition, m_vertices, metric.value_or(SquareMatrix2::Identity())); } template -bool Acts::ConvexPolygonBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool ConvexPolygonBounds::inside( + const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { return detail::insidePolygon(m_vertices, boundaryTolerance, lposition, std::nullopt); } template -std::vector Acts::ConvexPolygonBounds::vertices( +std::vector ConvexPolygonBounds::vertices( unsigned int /*ignoredSegments*/) const { return {m_vertices.begin(), m_vertices.end()}; } template -const Acts::RectangleBounds& Acts::ConvexPolygonBounds::boundingBox() const { +const RectangleBounds& ConvexPolygonBounds::boundingBox() const { return m_boundingBox; } template -void Acts::ConvexPolygonBounds::checkConsistency() const noexcept(false) { +void ConvexPolygonBounds::checkConsistency() const noexcept(false) { convex_impl(m_vertices); } + +} // namespace Acts diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index f286747ae8f..cc0116a7422 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" @@ -17,7 +16,6 @@ #include #include -#include #include #include #include @@ -39,8 +37,6 @@ class DiamondBounds : public PlanarBounds { eSize = 5 }; - DiamondBounds() = delete; - /// Constructor for convex hexagon symmetric about the y axis /// /// @param halfXnegY is the halflength in x at minimal y @@ -71,15 +67,17 @@ class DiamondBounds : public PlanarBounds { Vector2{*std::max_element(values.begin(), values.begin() + 2), values[eHalfLengthYpos]}) {} - BoundsType type() const final; + BoundsType type() const final { return eDiamond; } /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index e154672e4f8..d1c0bfb2f84 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -63,15 +63,23 @@ class DiscTrapezoidBounds : public DiscBounds { checkConsistency(); } - SurfaceBounds::BoundsType type() const final; + BoundsType type() const final { return eDiscTrapezoid; } + + bool isCartesian() const final { return false; } + + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// This method checks if the radius given in the LocalPosition is inside /// [rMin,rMax] @@ -80,8 +88,7 @@ class DiscTrapezoidBounds : public DiscBounds { /// coordinates) /// @param boundaryTolerance is the boundary check directive bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance = - BoundaryTolerance::None()) const final; + const BoundaryTolerance& boundaryTolerance) const final; /// Output Method for std::ostream std::ostream& toStream(std::ostream& sl) const final; @@ -145,12 +152,6 @@ class DiscTrapezoidBounds : public DiscBounds { /// /// @param lposition The local position in polar coordinates Vector2 toLocalCartesian(const Vector2& lposition) const; - - /// Jacobian - /// into its Cartesian representation - /// - /// @param lposition The local position in polar coordinates - ActsMatrix<2, 2> jacobianToLocalCartesian(const Vector2& lposition) const; }; inline double DiscTrapezoidBounds::rMin() const { diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index cd6764d7054..450c92fa1f4 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -71,20 +71,24 @@ class EllipseBounds : public PlanarBounds { checkConsistency(); } - BoundsType type() const final; + BoundsType type() const final { return eEllipse; } /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// This method checks if the point given in the local coordinates is between /// two ellipsoids if only tol0 is given and additional in the phi sector is /// tol1 is given /// + /// @warning This **only** works for tolerance-based checks + /// /// @param lposition Local position (assumed to be in right surface frame) /// @param boundaryTolerance boundary check directive /// @return boolean indicator for the success of this operation diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index b9cc5fa980c..3a545b27361 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -26,8 +26,6 @@ class LineBounds : public SurfaceBounds { public: enum BoundValues : int { eR = 0, eHalfLengthZ = 1, eSize = 2 }; - LineBounds() = delete; - /// Constructor /// /// @param r is the radius of the cylinder, default = 0. @@ -46,13 +44,27 @@ class LineBounds : public SurfaceBounds { BoundsType type() const final; + bool isCartesian() const final { return true; } + + SquareMatrix2 boundToCartesianJacobian( + const Vector2& /*lposition*/) const final { + return SquareMatrix2::Identity(); + } + + SquareMatrix2 cartesianToBoundJacobian( + const Vector2& /*lposition*/) const final { + return SquareMatrix2::Identity(); + } + /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// Inside check for the bounds object driven by the boundary check directive /// Each Bounds has a method inside, which checks if a LocalPosition is inside diff --git a/Core/include/Acts/Surfaces/PlaneSurface.hpp b/Core/include/Acts/Surfaces/PlaneSurface.hpp index e4fda361828..ddf968da2ea 100644 --- a/Core/include/Acts/Surfaces/PlaneSurface.hpp +++ b/Core/include/Acts/Surfaces/PlaneSurface.hpp @@ -13,7 +13,6 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/Polyhedron.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" @@ -21,8 +20,6 @@ #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Result.hpp" -#include -#include #include #include @@ -73,9 +70,6 @@ class PlaneSurface : public RegularSurface { std::shared_ptr pbounds = nullptr); public: - ~PlaneSurface() override = default; - PlaneSurface() = delete; - /// Assignment operator /// /// @param other The source PlaneSurface for assignment diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index a99d0583331..e1cadb3f631 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -58,15 +58,25 @@ class RadialBounds : public DiscBounds { checkConsistency(); } - SurfaceBounds::BoundsType type() const final; + SurfaceBounds::BoundsType type() const final { return SurfaceBounds::eDisc; } + + bool isCartesian() const final { return false; } + + SquareMatrix2 boundToCartesianJacobian( + const Vector2& /*lposition*/) const final; + + SquareMatrix2 cartesianToBoundJacobian( + const Vector2& /*lposition*/) const final; /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// For disc surfaces the local position in (r,phi) is checked /// diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index 6d702df2bb5..4b15e58e2fd 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -36,8 +36,6 @@ class TrapezoidBounds : public PlanarBounds { eSize = 4 }; - TrapezoidBounds() = delete; - /// Constructor for symmetric Trapezoid /// /// @param halfXnegY minimal half length X, definition at negative Y @@ -56,8 +54,10 @@ class TrapezoidBounds : public PlanarBounds { std::vector values() const final; + bool inside(const Vector2& lposition) const final; + Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& metric) const final; + const std::optional& metric) const final; /// The orientation of the Trapezoid is according to the figure above, /// in words: the shorter of the two parallel sides of the trapezoid diff --git a/Core/include/Acts/Utilities/ThrowAssert.hpp b/Core/include/Acts/Utilities/ThrowAssert.hpp index 2cc768daccf..0717c6b63f6 100644 --- a/Core/include/Acts/Utilities/ThrowAssert.hpp +++ b/Core/include/Acts/Utilities/ThrowAssert.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include #include #include diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index e4e2f69cd36..915c2494eb6 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -17,12 +17,26 @@ #include #include -Acts::SurfaceBounds::BoundsType Acts::DiamondBounds::type() const { - return SurfaceBounds::eDiamond; +namespace Acts { + +bool DiamondBounds::inside(const Vector2& lposition) const { + // Vertices starting at lower left (min rel. phi) + // counter-clockwise + double x1 = get(DiamondBounds::eHalfLengthXnegY); + double y1 = get(DiamondBounds::eHalfLengthYneg); + double x2 = get(DiamondBounds::eHalfLengthXzeroY); + double y2 = 0.; + double x3 = get(DiamondBounds::eHalfLengthXposY); + double y3 = get(DiamondBounds::eHalfLengthYpos); + Vector2 vertices[] = {{-x1, -y1}, {x1, -y1}, {x2, y2}, + {x3, y3}, {-x3, y3}, {-x2, y2}}; + return detail::insidePolygon(vertices, BoundaryTolerance::None(), lposition, + std::nullopt); } -Acts::Vector2 Acts::DiamondBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +Vector2 DiamondBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { // Vertices starting at lower left (min rel. phi) // counter-clockwise double x1 = get(DiamondBounds::eHalfLengthXnegY); @@ -33,13 +47,12 @@ Acts::Vector2 Acts::DiamondBounds::closestPoint( double y3 = get(DiamondBounds::eHalfLengthYpos); Vector2 vertices[] = {{-x1, -y1}, {x1, -y1}, {x2, y2}, {x3, y3}, {-x3, y3}, {-x2, y2}}; - return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, - vertices, metric); + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } -bool Acts::DiamondBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool DiamondBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { // Vertices starting at lower left (min rel. phi) // counter-clockwise double x1 = get(DiamondBounds::eHalfLengthXnegY); @@ -54,7 +67,7 @@ bool Acts::DiamondBounds::inside( std::nullopt); } -std::vector Acts::DiamondBounds::vertices( +std::vector DiamondBounds::vertices( unsigned int /*ignoredSegments*/) const { // Vertices starting at lower left (min rel. phi) // counter-clockwise @@ -67,11 +80,11 @@ std::vector Acts::DiamondBounds::vertices( return {{-x1, -y1}, {x1, -y1}, {x2, y2}, {x3, y3}, {-x3, y3}, {-x2, y2}}; } -const Acts::RectangleBounds& Acts::DiamondBounds::boundingBox() const { +const RectangleBounds& DiamondBounds::boundingBox() const { return m_boundingBox; } -std::ostream& Acts::DiamondBounds::toStream(std::ostream& sl) const { +std::ostream& DiamondBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::DiamondBounds: (halfXatYneg, halfXatYzero, halfXatYpos, " @@ -84,3 +97,5 @@ std::ostream& Acts::DiamondBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index 77728ea5595..f7883dd6651 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -8,6 +8,7 @@ #include "Acts/Surfaces/DiscTrapezoidBounds.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" @@ -16,64 +17,71 @@ #include #include #include +#include -Acts::DiscTrapezoidBounds::DiscTrapezoidBounds(double halfXminR, - double halfXmaxR, double minR, - double maxR, double avgPhi, - double stereo) noexcept(false) +namespace Acts { + +DiscTrapezoidBounds::DiscTrapezoidBounds(double halfXminR, double halfXmaxR, + double minR, double maxR, + double avgPhi, + double stereo) noexcept(false) : m_values({halfXminR, halfXmaxR, minR, maxR, avgPhi, stereo}) { checkConsistency(); m_ymax = std::sqrt(get(eMaxR) * get(eMaxR) - get(eHalfLengthXmaxR) * get(eHalfLengthXmaxR)); } -Acts::SurfaceBounds::BoundsType Acts::DiscTrapezoidBounds::type() const { - return SurfaceBounds::eDiscTrapezoid; -} - -Acts::Vector2 Acts::DiscTrapezoidBounds::toLocalCartesian( - const Acts::Vector2& lposition) const { +Vector2 DiscTrapezoidBounds::toLocalCartesian(const Vector2& lposition) const { return {lposition[eBoundLoc0] * std::sin(lposition[eBoundLoc1] - get(eAveragePhi)), lposition[eBoundLoc0] * std::cos(lposition[eBoundLoc1] - get(eAveragePhi))}; } -Acts::ActsMatrix<2, 2> Acts::DiscTrapezoidBounds::jacobianToLocalCartesian( - const Acts::Vector2& lposition) const { - ActsMatrix<2, 2> jacobian; - jacobian(0, eBoundLoc0) = std::sin(lposition[eBoundLoc1] - get(eAveragePhi)); - jacobian(1, eBoundLoc0) = std::cos(lposition[eBoundLoc1] - get(eAveragePhi)); - jacobian(0, eBoundLoc1) = - lposition[eBoundLoc0] * std::cos(lposition[eBoundLoc1]); - jacobian(1, eBoundLoc1) = - lposition[eBoundLoc0] * -std::sin(lposition[eBoundLoc1]); - return jacobian; +SquareMatrix2 DiscTrapezoidBounds::boundToCartesianJacobian( + const Vector2& lposition) const { + return SquareMatrix2::Identity(); // TODO +} + +SquareMatrix2 DiscTrapezoidBounds::cartesianToBoundJacobian( + const Vector2& lposition) const { + return SquareMatrix2::Identity(); // TODO +} + +bool DiscTrapezoidBounds::inside(const Vector2& lposition) const { + Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, + {get(eHalfLengthXmaxR), m_ymax}, + {-get(eHalfLengthXmaxR), m_ymax}, + {-get(eHalfLengthXminR), get(eMinR)}}; + return detail::insidePolygon(vertices, BoundaryTolerance::None(), + toLocalCartesian(lposition), std::nullopt); } -Acts::Vector2 Acts::DiscTrapezoidBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +Vector2 DiscTrapezoidBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, {get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXminR), get(eMinR)}}; return detail::VerticesHelper::computeClosestPointOnPolygon( - toLocalCartesian(lposition), vertices, metric); + toLocalCartesian(lposition), vertices, + metric.value_or(SquareMatrix2::Identity())); } -bool Acts::DiscTrapezoidBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool DiscTrapezoidBounds::inside( + const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, {get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXminR), get(eMinR)}}; - auto jacobian = jacobianToLocalCartesian(lposition); return detail::insidePolygon(vertices, boundaryTolerance, - toLocalCartesian(lposition), jacobian); + toLocalCartesian(lposition), + boundToCartesianJacobian(lposition)); } -std::vector Acts::DiscTrapezoidBounds::vertices( +std::vector DiscTrapezoidBounds::vertices( unsigned int /*ignoredSegments*/) const { Vector2 cAxis(std::cos(get(eAveragePhi)), std::sin(get(eAveragePhi))); Vector2 nAxis(cAxis.y(), -cAxis.x()); @@ -87,10 +95,10 @@ std::vector Acts::DiscTrapezoidBounds::vertices( } // ostream operator overload -std::ostream& Acts::DiscTrapezoidBounds::toStream(std::ostream& sl) const { +std::ostream& DiscTrapezoidBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::DiscTrapezoidBounds: (innerRadius, outerRadius, " + sl << "DiscTrapezoidBounds: (innerRadius, outerRadius, " "halfLengthXminR, " "halfLengthXmaxR, halfLengthY, halfPhiSector, averagePhi, rCenter, " "stereo) = "; @@ -101,3 +109,5 @@ std::ostream& Acts::DiscTrapezoidBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index 9081d8b06c6..fb7371ac2b5 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -8,6 +8,7 @@ #include "Acts/Surfaces/EllipseBounds.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" @@ -18,23 +19,26 @@ #include #include -using Acts::VectorHelpers::perp; -using Acts::VectorHelpers::phi; +namespace Acts { -Acts::SurfaceBounds::BoundsType Acts::EllipseBounds::type() const { - return SurfaceBounds::eEllipse; +bool EllipseBounds::inside(const Vector2& lposition) const { + double phi = + detail::radian_sym(VectorHelpers::phi(lposition) - get(eAveragePhi)); + return (-get(eHalfPhiSector) <= phi) && (phi < get(eHalfPhiSector)) && + (square(lposition[eBoundLoc0] / get(eInnerRx)) + + square(lposition[eBoundLoc1] / get(eInnerRy))) >= 1 && + (square(lposition[eBoundLoc0] / get(eOuterRx)) + + square(lposition[eBoundLoc1] / get(eOuterRy))) < 1; } -Acts::Vector2 Acts::EllipseBounds::closestPoint( - const Acts::Vector2& /*lposition*/, - const Acts::SquareMatrix2& /*metric*/) const { +Vector2 EllipseBounds::closestPoint( + const Vector2& /*lposition*/, + const std::optional& /*metric*/) const { throw std::logic_error("Not implemented"); } -/// @warning This **only** works for tolerance-based checks -bool Acts::EllipseBounds::inside( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +bool EllipseBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { if (boundaryTolerance.isInfinite()) { return true; } @@ -51,33 +55,32 @@ bool Acts::EllipseBounds::inside( bool insidePhi = (-phiHalf <= phi) && (phi < phiHalf); bool insideInner = (get(eInnerRx) <= tol0) || (get(eOuterRx) <= tol0) || - (1 < (square(lposition[Acts::eBoundLoc0] / (get(eInnerRx) - tol0)) + - square(lposition[Acts::eBoundLoc1] / (get(eOuterRx) - tol0)))); + (1 < (square(lposition[eBoundLoc0] / (get(eInnerRx) - tol0)) + + square(lposition[eBoundLoc1] / (get(eOuterRx) - tol0)))); bool insideOuter = - (square(lposition[Acts::eBoundLoc0] / (get(eInnerRy) + tol0)) + - square(lposition[Acts::eBoundLoc1] / (get(eOuterRy) + tol0))) < 1; + (square(lposition[eBoundLoc0] / (get(eInnerRy) + tol0)) + + square(lposition[eBoundLoc1] / (get(eOuterRy) + tol0))) < 1; return insidePhi && insideInner && insideOuter; } throw std::logic_error("Unsupported boundary check type"); } -std::vector Acts::EllipseBounds::vertices( +std::vector EllipseBounds::vertices( unsigned int quarterSegments) const { return detail::VerticesHelper::ellipsoidVertices( get(eInnerRx), get(eInnerRy), get(eOuterRx), get(eOuterRy), get(eAveragePhi), get(eHalfPhiSector), quarterSegments); } -const Acts::RectangleBounds& Acts::EllipseBounds::boundingBox() const { +const RectangleBounds& EllipseBounds::boundingBox() const { return m_boundingBox; } -// ostream operator overload -std::ostream& Acts::EllipseBounds::toStream(std::ostream& sl) const { +std::ostream& EllipseBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::EllipseBounds: (innerRadius0, outerRadius0, innerRadius1, " + sl << "EllipseBounds: (innerRadius0, outerRadius0, innerRadius1, " "outerRadius1, hPhiSector, averagePhi) = "; sl << "(" << get(eInnerRx) << ", " << get(eInnerRy) << ", " << get(eOuterRx) << ", " << get(eOuterRy) << ", " << get(eAveragePhi) << ", " @@ -85,3 +88,5 @@ std::ostream& Acts::EllipseBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index aa22a55afb0..b3602568f42 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -14,21 +14,31 @@ #include #include -Acts::SurfaceBounds::BoundsType Acts::LineBounds::type() const { +namespace Acts { + +SurfaceBounds::BoundsType LineBounds::type() const { return SurfaceBounds::eLine; } -Acts::Vector2 Acts::LineBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +bool LineBounds::inside(const Vector2& lposition) const { + double r = get(LineBounds::eR); + double halfLengthZ = get(LineBounds::eHalfLengthZ); + return detail::insideAlignedBox( + Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ), + BoundaryTolerance::None(), lposition, std::nullopt); +} + +Vector2 LineBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { double r = get(LineBounds::eR); double halfLengthZ = get(LineBounds::eHalfLengthZ); return detail::computeClosestPointOnAlignedBox( Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ), lposition, metric); } -bool Acts::LineBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool LineBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { double r = get(LineBounds::eR); double halfLengthZ = get(LineBounds::eHalfLengthZ); return detail::insideAlignedBox(Vector2(-r, -halfLengthZ), @@ -36,13 +46,14 @@ bool Acts::LineBounds::inside( lposition, std::nullopt); } -// ostream operator overload -std::ostream& Acts::LineBounds::toStream(std::ostream& sl) const { +std::ostream& LineBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::LineBounds: (radius, halflengthInZ) = "; + sl << "LineBounds: (radius, halflengthInZ) = "; sl << "(" << get(LineBounds::eR) << ", " << get(LineBounds::eHalfLengthZ) << ")"; sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 78c662a0220..f3736c791ac 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -17,12 +17,19 @@ #include #include -Acts::SurfaceBounds::BoundsType Acts::RadialBounds::type() const { - return SurfaceBounds::eDisc; +namespace Acts { + +SquareMatrix2 RadialBounds::boundToCartesianJacobian( + const Vector2& /*lposition*/) const { + return SquareMatrix2::Identity(); // TODO +} + +SquareMatrix2 RadialBounds::cartesianToBoundJacobian( + const Vector2& /*lposition*/) const { + return SquareMatrix2::Identity(); // TODO } -Acts::Vector2 Acts::RadialBounds::shifted( - const Acts::Vector2& lposition) const { +Vector2 RadialBounds::shifted(const Vector2& lposition) const { Vector2 tmp; tmp[eBoundLoc0] = lposition[eBoundLoc0]; tmp[eBoundLoc1] = @@ -30,35 +37,43 @@ Acts::Vector2 Acts::RadialBounds::shifted( return tmp; } -Acts::Vector2 Acts::RadialBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +bool RadialBounds::inside(const Vector2& lposition) const { + return detail::insideAlignedBox(Vector2(get(eMinR), -get(eHalfPhiSector)), + Vector2(get(eMaxR), get(eHalfPhiSector)), + BoundaryTolerance::None(), shifted(lposition), + std::nullopt); +} + +Vector2 RadialBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { return detail::computeClosestPointOnAlignedBox( Vector2(get(eMinR), -get(eHalfPhiSector)), Vector2(get(eMaxR), get(eHalfPhiSector)), shifted(lposition), metric); } -bool Acts::RadialBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool RadialBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { return detail::insideAlignedBox(Vector2(get(eMinR), -get(eHalfPhiSector)), Vector2(get(eMaxR), get(eHalfPhiSector)), boundaryTolerance, shifted(lposition), std::nullopt); } -std::vector Acts::RadialBounds::vertices( - unsigned int lseg) const { +std::vector RadialBounds::vertices(unsigned int lseg) const { return detail::VerticesHelper::circularVertices( get(eMinR), get(eMaxR), get(eAveragePhi), get(eHalfPhiSector), lseg); } -std::ostream& Acts::RadialBounds::toStream(std::ostream& sl) const { +std::ostream& RadialBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::RadialBounds: (innerRadius, outerRadius, hPhiSector, " + sl << "RadialBounds: (innerRadius, outerRadius, hPhiSector, " "averagePhi) = "; sl << "(" << get(eMinR) << ", " << get(eMaxR) << ", " << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")"; sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 37c5eab767e..38d1b6efc44 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -8,6 +8,7 @@ #include "Acts/Surfaces/TrapezoidBounds.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/ConvexPolygonBounds.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" @@ -15,25 +16,17 @@ #include #include -/// Constructor for symmetric Trapezoid -/// -/// @param halfXnegY minimal half length X, definition at negative Y -/// @param halfXposY maximal half length X, definition at positive Y -/// @param halfY half length Y - defined at x=0 -/// @param rotAngle: rotation angle of the bounds w.r.t coordinate axes -Acts::TrapezoidBounds::TrapezoidBounds(double halfXnegY, double halfXposY, - double halfY, - double rotAngle) noexcept(false) +namespace Acts { + +TrapezoidBounds::TrapezoidBounds(double halfXnegY, double halfXposY, + double halfY, double rotAngle) noexcept(false) : m_values({halfXnegY, halfXposY, halfY, rotAngle}), m_boundingBox(std::max(halfXnegY, halfXposY), halfY) { rotateBoundingBox(); checkConsistency(); } -/// Constructor for symmetric Trapezoid - from fixed size array -/// -/// @param values the values to be stream in -Acts::TrapezoidBounds::TrapezoidBounds( +TrapezoidBounds::TrapezoidBounds( const std::array& values) noexcept(false) : m_values(values), m_boundingBox( @@ -43,12 +36,46 @@ Acts::TrapezoidBounds::TrapezoidBounds( checkConsistency(); } -Acts::SurfaceBounds::BoundsType Acts::TrapezoidBounds::type() const { +SurfaceBounds::BoundsType TrapezoidBounds::type() const { return SurfaceBounds::eTrapezoid; } -Acts::Vector2 Acts::TrapezoidBounds::closestPoint( - const Acts::Vector2& lposition, const Acts::SquareMatrix2& metric) const { +bool TrapezoidBounds::inside(const Vector2& lposition) const { + const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); + const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); + const double hlY = get(TrapezoidBounds::eHalfLengthY); + const double rotAngle = get(TrapezoidBounds::eRotationAngle); + + const Vector2 extPosition = Eigen::Rotation2Dd(rotAngle) * lposition; + const double x = extPosition[0]; + const double y = extPosition[1]; + + if (std::abs(y) - hlY > 0) { + // outside y range + return false; + } + + if (std::abs(x) - std::max(hlXnY, hlXpY) > 0) { + // outside x range + return false; + } + + if (std::abs(x) - std::min(hlXnY, hlXpY) <= 0) { + // inside x range + return true; + } + + // at this stage, the point can only be in the triangles + // run slow-ish polygon check + Vector2 vertices[] = { + {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; + return detail::insidePolygon(vertices, BoundaryTolerance::None(), extPosition, + std::nullopt); +} + +Vector2 TrapezoidBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); const double hlY = get(TrapezoidBounds::eHalfLengthY); @@ -56,13 +83,12 @@ Acts::Vector2 Acts::TrapezoidBounds::closestPoint( Vector2 vertices[] = { {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; - return detail::VerticesHelper::computeClosestPointOnPolygon(lposition, - vertices, metric); + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } -bool Acts::TrapezoidBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +bool TrapezoidBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { if (boundaryTolerance.isInfinite()) { return true; } @@ -72,7 +98,7 @@ bool Acts::TrapezoidBounds::inside( const double hlY = get(TrapezoidBounds::eHalfLengthY); const double rotAngle = get(TrapezoidBounds::eRotationAngle); - const Acts::Vector2 extPosition = Eigen::Rotation2Dd(rotAngle) * lposition; + const Vector2 extPosition = Eigen::Rotation2Dd(rotAngle) * lposition; const double x = extPosition[0]; const double y = extPosition[1]; @@ -105,14 +131,14 @@ bool Acts::TrapezoidBounds::inside( std::nullopt); } -std::vector Acts::TrapezoidBounds::vertices( +std::vector TrapezoidBounds::vertices( unsigned int /*ignoredSegments*/) const { const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); const double hlY = get(TrapezoidBounds::eHalfLengthY); const double rotAngle = get(TrapezoidBounds::eRotationAngle); - std::vector vertices = { + std::vector vertices = { {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; for (auto& v : vertices) { v = Eigen::Rotation2Dd(-rotAngle) * v; @@ -120,27 +146,27 @@ std::vector Acts::TrapezoidBounds::vertices( return vertices; } -const Acts::RectangleBounds& Acts::TrapezoidBounds::boundingBox() const { +const RectangleBounds& TrapezoidBounds::boundingBox() const { return m_boundingBox; } -std::ostream& Acts::TrapezoidBounds::toStream(std::ostream& sl) const { +std::ostream& TrapezoidBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "Acts::TrapezoidBounds: (halfXnegY, halfXposY, halfY, rotAngle) = " + sl << "TrapezoidBounds: (halfXnegY, halfXposY, halfY, rotAngle) = " << "(" << get(eHalfLengthXnegY) << ", " << get(eHalfLengthXposY) << ", " << get(eHalfLengthY) << ", " << get(eRotationAngle) << ")"; sl << std::setprecision(-1); return sl; } -std::vector Acts::TrapezoidBounds::values() const { +std::vector TrapezoidBounds::values() const { std::vector valvector; valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); return valvector; } -void Acts::TrapezoidBounds::rotateBoundingBox() noexcept(false) { +void TrapezoidBounds::rotateBoundingBox() noexcept(false) { const double rotAngle = get(eRotationAngle); if (rotAngle != 0.) { @@ -148,7 +174,7 @@ void Acts::TrapezoidBounds::rotateBoundingBox() noexcept(false) { } } -void Acts::TrapezoidBounds::checkConsistency() noexcept(false) { +void TrapezoidBounds::checkConsistency() noexcept(false) { if (get(eHalfLengthXnegY) <= 0. || get(eHalfLengthXposY) <= 0.) { throw std::invalid_argument("TrapezoidBounds: invalid local x setup"); } @@ -156,3 +182,5 @@ void Acts::TrapezoidBounds::checkConsistency() noexcept(false) { throw std::invalid_argument("TrapezoidBounds: invalid local y setup"); } } + +} // namespace Acts From 79ada20c8b3a1f11876da4feefb58ba8ee91f0b3 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 19:44:08 +0100 Subject: [PATCH 12/33] make compile --- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 3 +- Core/src/Surfaces/AnnulusBounds.cpp | 2 + Core/src/Surfaces/ConeBounds.cpp | 2 + Core/src/Surfaces/CylinderBounds.cpp | 1 + Core/src/Surfaces/DiscTrapezoidBounds.cpp | 2 + .../Core/Surfaces/SurfaceBoundsTests.cpp | 42 +++++++++++-------- 6 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index befad48a982..de0c05173b7 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -91,7 +91,8 @@ class SurfaceBounds { /// @return boolean indicator for the success of this operation virtual bool inside(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const { - // TODO + (void)boundaryTolerance; + return inside(lposition); } diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index b9a9aff86de..f7557a47953 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -160,11 +160,13 @@ std::vector AnnulusBounds::vertices( SquareMatrix2 AnnulusBounds::boundToCartesianJacobian( const Vector2& lposition) const { + (void)lposition; return SquareMatrix2::Identity(); // TODO } SquareMatrix2 AnnulusBounds::cartesianToBoundJacobian( const Vector2& lposition) const { + (void)lposition; return SquareMatrix2::Identity(); // TODO } diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 06d48d39a4c..a6ab8fff225 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -47,11 +47,13 @@ SurfaceBounds::BoundsType ConeBounds::type() const { SquareMatrix2 ConeBounds::boundToCartesianJacobian( const Vector2& lposition) const { + (void)lposition; return SquareMatrix2::Identity(); // TODO } SquareMatrix2 ConeBounds::cartesianToBoundJacobian( const Vector2& lposition) const { + (void)lposition; return SquareMatrix2::Identity(); // TODO } diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index 3130061f23b..f108e85ee6b 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -55,6 +55,7 @@ Vector2 CylinderBounds::shifted(const Vector2& lposition) const { } bool CylinderBounds::inside(const Vector2& lposition) const { + (void)lposition; return false; // TODO } diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index f7883dd6651..f4e167bfbf2 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -40,11 +40,13 @@ Vector2 DiscTrapezoidBounds::toLocalCartesian(const Vector2& lposition) const { SquareMatrix2 DiscTrapezoidBounds::boundToCartesianJacobian( const Vector2& lposition) const { + (void)lposition; return SquareMatrix2::Identity(); // TODO } SquareMatrix2 DiscTrapezoidBounds::cartesianToBoundJacobian( const Vector2& lposition) const { + (void)lposition; return SquareMatrix2::Identity(); // TODO } diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp index 452da8246aa..811e4758e99 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp @@ -27,31 +27,37 @@ class SurfaceBoundsStub : public SurfaceBounds { std::iota(m_values.begin(), m_values.end(), 0); } -#if defined(__GNUC__) && (__GNUC__ == 13 || __GNUC__ == 14) && \ - !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warray-bounds" -#pragma GCC diagnostic ignored "-Wstringop-overflow" -#endif - SurfaceBoundsStub(const SurfaceBoundsStub& other) = default; -#if defined(__GNUC__) && (__GNUC__ == 13 || __GNUC__ == 14) && \ - !defined(__clang__) -#pragma GCC diagnostic pop -#endif - - ~SurfaceBoundsStub() override = default; - BoundsType type() const final { return SurfaceBounds::eOther; } - std::vector values() const override { return m_values; } + bool isCartesian() const final { return true; } + + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + std::vector values() const final { return m_values; } + + bool inside(const Vector2& lposition) const final { + (void)lposition; + return true; + } Vector2 closestPoint(const Vector2& lposition, - const SquareMatrix2& /*metric*/) const final { + const std::optional& metric) const final { + (void)metric; return lposition; } - bool inside(const Vector2& /*lpos*/, - const BoundaryTolerance& /*boundaryTolerance*/) const final { + bool inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const final { + (void)lposition; + (void)boundaryTolerance; return true; } From 17db3653816b71179a6fae51e24e176d6c5e5e83 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 21:10:28 +0100 Subject: [PATCH 13/33] tmp --- Core/include/Acts/Surfaces/ConeBounds.hpp | 16 ++- Core/include/Acts/Surfaces/ConeSurface.hpp | 5 +- Core/include/Acts/Surfaces/CylinderBounds.hpp | 12 +- .../include/Acts/Surfaces/CylinderSurface.hpp | 3 - Core/src/Surfaces/AnnulusBounds.cpp | 16 ++- Core/src/Surfaces/ConeBounds.cpp | 17 --- Core/src/Surfaces/ConeSurface.cpp | 1 - Core/src/Surfaces/CylinderBounds.cpp | 26 +---- Core/src/Surfaces/CylinderSurface.cpp | 110 ++++++++---------- 9 files changed, 87 insertions(+), 119 deletions(-) diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 72df71501e7..761e7bad054 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -74,13 +74,19 @@ class ConeBounds : public SurfaceBounds { /// @param values The parameter array ConeBounds(const std::array& values) noexcept(false); - BoundsType type() const final; + BoundsType type() const final { return eCone; } - bool isCartesian() const final { return false; } + bool isCartesian() const final { return true; } - SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } /// Return the bound values as dynamically sized vector /// @@ -129,6 +135,8 @@ class ConeBounds : public SurfaceBounds { /// Private helper function to shift a local 2D position /// + /// Shift r-phi coordinate to be centered around the average phi. + /// /// @param lposition The original local position Vector2 shifted(const Vector2& lposition) const; }; diff --git a/Core/include/Acts/Surfaces/ConeSurface.hpp b/Core/include/Acts/Surfaces/ConeSurface.hpp index 2f88bfe9532..12bb1a0f6d5 100644 --- a/Core/include/Acts/Surfaces/ConeSurface.hpp +++ b/Core/include/Acts/Surfaces/ConeSurface.hpp @@ -11,7 +11,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Alignment.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/Polyhedron.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" @@ -23,8 +22,6 @@ #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" -#include -#include #include #include #include @@ -41,7 +38,7 @@ namespace Acts { /// at the tip of the cone. /// Propagations to a cone surface will be returned in /// curvilinear coordinates. - +/// class ConeSurface : public RegularSurface { friend class Surface; diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index dd6bf5ffe2b..d368b9149b5 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -86,11 +86,17 @@ class CylinderBounds : public SurfaceBounds { BoundsType type() const final { return eCylinder; } - bool isCartesian() const final { return false; } + bool isCartesian() const final { return true; } - SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } /// Return the bound values as dynamically sized vector /// diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index 971ff7039f7..17228b9c682 100644 --- a/Core/include/Acts/Surfaces/CylinderSurface.hpp +++ b/Core/include/Acts/Surfaces/CylinderSurface.hpp @@ -11,7 +11,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Alignment.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/Polyhedron.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" @@ -24,8 +23,6 @@ #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" -#include -#include #include #include #include diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index f7557a47953..755fdfe8d48 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -160,14 +160,22 @@ std::vector AnnulusBounds::vertices( SquareMatrix2 AnnulusBounds::boundToCartesianJacobian( const Vector2& lposition) const { - (void)lposition; - return SquareMatrix2::Identity(); // TODO + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[0]); + j(0, 1) = -lposition[1] * std::sin(lposition[0]); + j(1, 0) = std::sin(lposition[0]); + j(1, 1) = lposition[1] * std::cos(lposition[0]); + return j; } SquareMatrix2 AnnulusBounds::cartesianToBoundJacobian( const Vector2& lposition) const { - (void)lposition; - return SquareMatrix2::Identity(); // TODO + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[0]); + j(0, 1) = std::sin(lposition[0]); + j(1, 0) = -std::sin(lposition[0]) / lposition[1]; + j(1, 1) = std::cos(lposition[0]) / lposition[1]; + return j; } bool AnnulusBounds::inside(const Vector2& lposition) const { diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index a6ab8fff225..7084731ec28 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -41,23 +41,6 @@ ConeBounds::ConeBounds(const std::array& values) noexcept(false) checkConsistency(); } -SurfaceBounds::BoundsType ConeBounds::type() const { - return SurfaceBounds::eCone; -} - -SquareMatrix2 ConeBounds::boundToCartesianJacobian( - const Vector2& lposition) const { - (void)lposition; - return SquareMatrix2::Identity(); // TODO -} - -SquareMatrix2 ConeBounds::cartesianToBoundJacobian( - const Vector2& lposition) const { - (void)lposition; - return SquareMatrix2::Identity(); // TODO -} - -/// Shift r-phi coordinate to be centered around the average phi. Vector2 ConeBounds::shifted(const Vector2& lposition) const { using detail::radian_sym; diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index 5dddd1527bf..a936bea58c4 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -14,7 +14,6 @@ #include "Acts/Surfaces/detail/AlignmentHelper.hpp" #include "Acts/Surfaces/detail/FacesHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/ThrowAssert.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index f108e85ee6b..358b8568ce0 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -9,7 +9,6 @@ #include "Acts/Surfaces/CylinderBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" @@ -28,30 +27,9 @@ namespace Acts { using VectorHelpers::perp; using VectorHelpers::phi; -SquareMatrix2 CylinderBounds::boundToCartesianJacobian( - const Vector2& /*lposition*/) const { - SquareMatrix2 j; - j(0, eBoundLoc0) = get(eR); - j(0, eBoundLoc1) = 0; - j(1, eBoundLoc0) = 0; - j(1, eBoundLoc1) = 1; - return j; -} - -SquareMatrix2 CylinderBounds::cartesianToBoundJacobian( - const Vector2& /*lposition*/) const { - SquareMatrix2 j; - j(0, eBoundLoc0) = 1 / get(eR); - j(0, eBoundLoc1) = 0; - j(1, eBoundLoc0) = 0; - j(1, eBoundLoc1) = 1; - return j; -} - Vector2 CylinderBounds::shifted(const Vector2& lposition) const { - return { - detail::radian_sym((lposition[eBoundLoc0] / get(eR)) - get(eAveragePhi)), - lposition[eBoundLoc1]}; + return {detail::radian_sym((lposition[0] / get(eR)) - get(eAveragePhi)), + lposition[1]}; } bool CylinderBounds::inside(const Vector2& lposition) const { diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index 23bb74e49f8..7ef76326e79 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -19,7 +19,6 @@ #include "Acts/Surfaces/detail/FacesHelper.hpp" #include "Acts/Surfaces/detail/MergeHelper.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/ThrowAssert.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -34,46 +33,41 @@ #include namespace Acts { -class DetectorElementBase; -} // namespace Acts -using Acts::VectorHelpers::perp; -using Acts::VectorHelpers::phi; +using VectorHelpers::perp; +using VectorHelpers::phi; -Acts::CylinderSurface::CylinderSurface(const CylinderSurface& other) +CylinderSurface::CylinderSurface(const CylinderSurface& other) : GeometryObject(), RegularSurface(other), m_bounds(other.m_bounds) {} -Acts::CylinderSurface::CylinderSurface(const GeometryContext& gctx, - const CylinderSurface& other, - const Transform3& shift) +CylinderSurface::CylinderSurface(const GeometryContext& gctx, + const CylinderSurface& other, + const Transform3& shift) : GeometryObject(), RegularSurface(gctx, other, shift), m_bounds(other.m_bounds) {} -Acts::CylinderSurface::CylinderSurface(const Transform3& transform, - double radius, double halfz, - double halfphi, double avphi, - double bevelMinZ, double bevelMaxZ) +CylinderSurface::CylinderSurface(const Transform3& transform, double radius, + double halfz, double halfphi, double avphi, + double bevelMinZ, double bevelMaxZ) : RegularSurface(transform), m_bounds(std::make_shared( radius, halfz, halfphi, avphi, bevelMinZ, bevelMaxZ)) {} -Acts::CylinderSurface::CylinderSurface( - std::shared_ptr cbounds, - const DetectorElementBase& detelement) +CylinderSurface::CylinderSurface(std::shared_ptr cbounds, + const DetectorElementBase& detelement) : RegularSurface(detelement), m_bounds(std::move(cbounds)) { /// surfaces representing a detector element must have bounds throw_assert(m_bounds, "CylinderBounds must not be nullptr"); } -Acts::CylinderSurface::CylinderSurface( - const Transform3& transform, std::shared_ptr cbounds) +CylinderSurface::CylinderSurface(const Transform3& transform, + std::shared_ptr cbounds) : RegularSurface(transform), m_bounds(std::move(cbounds)) { throw_assert(m_bounds, "CylinderBounds must not be nullptr"); } -Acts::CylinderSurface& Acts::CylinderSurface::operator=( - const CylinderSurface& other) { +CylinderSurface& CylinderSurface::operator=(const CylinderSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; @@ -82,11 +76,10 @@ Acts::CylinderSurface& Acts::CylinderSurface::operator=( } // return the binning position for ordering in the BinnedArray -Acts::Vector3 Acts::CylinderSurface::binningPosition( - const GeometryContext& gctx, BinningValue bValue) const { +Vector3 CylinderSurface::binningPosition(const GeometryContext& gctx, + BinningValue bValue) const { // special binning type for R-type methods - if (bValue == Acts::BinningValue::binR || - bValue == Acts::BinningValue::binRPhi) { + if (bValue == BinningValue::binR || bValue == BinningValue::binRPhi) { double R = bounds().get(CylinderBounds::eR); double phi = bounds().get(CylinderBounds::eAveragePhi); return localToGlobal(gctx, Vector2{phi * R, 0}, Vector3{}); @@ -99,7 +92,7 @@ Acts::Vector3 Acts::CylinderSurface::binningPosition( } // return the measurement frame: it's the tangential plane -Acts::RotationMatrix3 Acts::CylinderSurface::referenceFrame( +RotationMatrix3 CylinderSurface::referenceFrame( const GeometryContext& gctx, const Vector3& position, const Vector3& /*direction*/) const { RotationMatrix3 mFrame; @@ -118,22 +111,22 @@ Acts::RotationMatrix3 Acts::CylinderSurface::referenceFrame( return mFrame; } -Acts::Surface::SurfaceType Acts::CylinderSurface::type() const { +Surface::SurfaceType CylinderSurface::type() const { return Surface::Cylinder; } -Acts::Vector3 Acts::CylinderSurface::localToGlobal( - const GeometryContext& gctx, const Vector2& lposition) const { +Vector3 CylinderSurface::localToGlobal(const GeometryContext& gctx, + const Vector2& lposition) const { // create the position in the local 3d frame double r = bounds().get(CylinderBounds::eR); - double phi = lposition[Acts::eBoundLoc0] / r; - Vector3 position(r * cos(phi), r * sin(phi), lposition[Acts::eBoundLoc1]); + double phi = lposition[0] / r; + Vector3 position(r * cos(phi), r * sin(phi), lposition[1]); return transform(gctx) * position; } -Acts::Result Acts::CylinderSurface::globalToLocal( - const GeometryContext& gctx, const Vector3& position, - double tolerance) const { +Result CylinderSurface::globalToLocal(const GeometryContext& gctx, + const Vector3& position, + double tolerance) const { double inttol = tolerance; if (tolerance == s_onSurfaceTolerance) { // transform default value! @@ -153,19 +146,19 @@ Acts::Result Acts::CylinderSurface::globalToLocal( {bounds().get(CylinderBounds::eR) * phi(loc3Dframe), loc3Dframe.z()}); } -std::string Acts::CylinderSurface::name() const { - return "Acts::CylinderSurface"; +std::string CylinderSurface::name() const { + return "CylinderSurface"; } -Acts::Vector3 Acts::CylinderSurface::normal( - const GeometryContext& gctx, const Acts::Vector2& lposition) const { - double phi = lposition[Acts::eBoundLoc0] / m_bounds->get(CylinderBounds::eR); +Vector3 CylinderSurface::normal(const GeometryContext& gctx, + const Vector2& lposition) const { + double phi = lposition[eBoundLoc0] / m_bounds->get(CylinderBounds::eR); Vector3 localNormal(cos(phi), sin(phi), 0.); return transform(gctx).linear() * localNormal; } -Acts::Vector3 Acts::CylinderSurface::normal( - const GeometryContext& gctx, const Acts::Vector3& position) const { +Vector3 CylinderSurface::normal(const GeometryContext& gctx, + const Vector3& position) const { const Transform3& sfTransform = transform(gctx); // get it into the cylinder frame Vector3 pos3D = sfTransform.inverse() * position; @@ -175,19 +168,19 @@ Acts::Vector3 Acts::CylinderSurface::normal( return sfTransform.linear() * pos3D.normalized(); } -double Acts::CylinderSurface::pathCorrection( - const GeometryContext& gctx, const Acts::Vector3& position, - const Acts::Vector3& direction) const { +double CylinderSurface::pathCorrection(const GeometryContext& gctx, + const Vector3& position, + const Vector3& direction) const { Vector3 normalT = normal(gctx, position); double cosAlpha = normalT.dot(direction); return std::abs(1. / cosAlpha); } -const Acts::CylinderBounds& Acts::CylinderSurface::bounds() const { +const CylinderBounds& CylinderSurface::bounds() const { return (*m_bounds.get()); } -Acts::Polyhedron Acts::CylinderSurface::polyhedronRepresentation( +Polyhedron CylinderSurface::polyhedronRepresentation( const GeometryContext& gctx, unsigned int quarterSegments) const { auto ctrans = transform(gctx); @@ -199,13 +192,12 @@ Acts::Polyhedron Acts::CylinderSurface::polyhedronRepresentation( return Polyhedron(vertices, faces, triangularMesh, false); } -Acts::Vector3 Acts::CylinderSurface::rotSymmetryAxis( - const GeometryContext& gctx) const { +Vector3 CylinderSurface::rotSymmetryAxis(const GeometryContext& gctx) const { // fast access via transform matrix (and not rotation()) return transform(gctx).matrix().block<3, 1>(0, 2); } -Acts::detail::RealQuadraticEquation Acts::CylinderSurface::intersectionSolver( +detail::RealQuadraticEquation CylinderSurface::intersectionSolver( const Transform3& transform, const Vector3& position, const Vector3& direction) const { // Solve for radius R @@ -227,7 +219,7 @@ Acts::detail::RealQuadraticEquation Acts::CylinderSurface::intersectionSolver( return detail::RealQuadraticEquation(a, b, c); } -Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( +SurfaceMultiIntersection CylinderSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, double tolerance) const { @@ -294,7 +286,7 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( return {{second, first}, this}; } -Acts::AlignmentToPathMatrix Acts::CylinderSurface::alignmentToPathDerivative( +AlignmentToPathMatrix CylinderSurface::alignmentToPathDerivative( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -342,8 +334,7 @@ Acts::AlignmentToPathMatrix Acts::CylinderSurface::alignmentToPathDerivative( return alignToPath; } -Acts::ActsMatrix<2, 3> -Acts::CylinderSurface::localCartesianToBoundLocalDerivative( +ActsMatrix<2, 3> CylinderSurface::localCartesianToBoundLocalDerivative( const GeometryContext& gctx, const Vector3& position) const { using VectorHelpers::perp; using VectorHelpers::phi; @@ -363,11 +354,10 @@ Acts::CylinderSurface::localCartesianToBoundLocalDerivative( return loc3DToLocBound; } -std::pair, bool> -Acts::CylinderSurface::mergedWith(const CylinderSurface& other, - BinningValue direction, bool externalRotation, - const Logger& logger) const { - using namespace Acts::UnitLiterals; +std::pair, bool> CylinderSurface::mergedWith( + const CylinderSurface& other, BinningValue direction, bool externalRotation, + const Logger& logger) const { + using namespace UnitLiterals; ACTS_VERBOSE("Merging cylinder surfaces in " << binningValueName(direction) << " direction"); @@ -458,7 +448,7 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, double otherHlPhi = other.bounds().get(CylinderBounds::eHalfPhiSector); double otherAvgPhi = other.bounds().get(CylinderBounds::eAveragePhi); - if (direction == Acts::BinningValue::binZ) { + if (direction == BinningValue::binZ) { // z shift must match the bounds if (std::abs(otherLocal.linear().col(eY)[eX]) >= tolerance && @@ -505,7 +495,7 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, return {Surface::makeShared(newTransform, newBounds), zShift < 0}; - } else if (direction == Acts::BinningValue::binRPhi) { + } else if (direction == BinningValue::binRPhi) { // no z shift is allowed if (std::abs(translation[2]) > tolerance) { ACTS_ERROR( @@ -568,3 +558,5 @@ Acts::CylinderSurface::mergedWith(const CylinderSurface& other, binningValueName(direction)); } } + +} // namespace Acts From 289109a35ba60b48751ce5544f38c82aebbdc76b Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Dec 2024 21:31:41 +0100 Subject: [PATCH 14/33] jacobians --- Core/src/Surfaces/AnnulusBounds.cpp | 56 ++++++++++------------- Core/src/Surfaces/DiscTrapezoidBounds.cpp | 16 +++++-- Core/src/Surfaces/RadialBounds.cpp | 18 ++++++-- 3 files changed, 50 insertions(+), 40 deletions(-) diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 755fdfe8d48..ef945cb18e6 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -9,7 +9,6 @@ #include "Acts/Surfaces/AnnulusBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" @@ -91,17 +90,13 @@ AnnulusBounds::AnnulusBounds(const std::array& values) noexcept( // calculate corners in STRIP XY, keep them we need them for minDistance() m_outLeftStripXY = - circIx(m_moduleOrigin[eBoundLoc0], m_moduleOrigin[eBoundLoc1], get(eMaxR), - get(eMaxPhiRel)); + circIx(m_moduleOrigin[0], m_moduleOrigin[1], get(eMaxR), get(eMaxPhiRel)); m_inLeftStripXY = - circIx(m_moduleOrigin[eBoundLoc0], m_moduleOrigin[eBoundLoc1], get(eMinR), - get(eMaxPhiRel)); + circIx(m_moduleOrigin[0], m_moduleOrigin[1], get(eMinR), get(eMaxPhiRel)); m_outRightStripXY = - circIx(m_moduleOrigin[eBoundLoc0], m_moduleOrigin[eBoundLoc1], get(eMaxR), - get(eMinPhiRel)); + circIx(m_moduleOrigin[0], m_moduleOrigin[1], get(eMaxR), get(eMinPhiRel)); m_inRightStripXY = - circIx(m_moduleOrigin[eBoundLoc0], m_moduleOrigin[eBoundLoc1], get(eMinR), - get(eMinPhiRel)); + circIx(m_moduleOrigin[0], m_moduleOrigin[1], get(eMinR), get(eMinPhiRel)); m_outLeftStripPC = {m_outLeftStripXY.norm(), VectorHelpers::phi(m_outLeftStripXY)}; @@ -161,20 +156,20 @@ std::vector AnnulusBounds::vertices( SquareMatrix2 AnnulusBounds::boundToCartesianJacobian( const Vector2& lposition) const { SquareMatrix2 j; - j(0, 0) = std::cos(lposition[0]); - j(0, 1) = -lposition[1] * std::sin(lposition[0]); - j(1, 0) = std::sin(lposition[0]); - j(1, 1) = lposition[1] * std::cos(lposition[0]); + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = -lposition[0] * std::sin(lposition[1]); + j(1, 0) = std::sin(lposition[1]); + j(1, 1) = lposition[0] * std::cos(lposition[1]); return j; } SquareMatrix2 AnnulusBounds::cartesianToBoundJacobian( const Vector2& lposition) const { SquareMatrix2 j; - j(0, 0) = std::cos(lposition[0]); - j(0, 1) = std::sin(lposition[0]); - j(1, 0) = -std::sin(lposition[0]) / lposition[1]; - j(1, 1) = std::cos(lposition[0]) / lposition[1]; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = std::sin(lposition[1]); + j(1, 0) = -std::sin(lposition[1]) / lposition[0]; + j(1, 1) = std::cos(lposition[1]) / lposition[0]; return j; } @@ -193,10 +188,10 @@ Vector2 AnnulusBounds::closestPoint( // to the MODULE SYSTEM in PC via jacobian. The following transforms into // STRIP XY, does the shift into MODULE XY, and then transforms into MODULE PC double dphi = get(eAveragePhi); - double phi_strip = locpo_rotated[eBoundLoc1]; - double r_strip = locpo_rotated[eBoundLoc0]; - double O_x = m_shiftXY[eBoundLoc0]; - double O_y = m_shiftXY[eBoundLoc1]; + double phi_strip = locpo_rotated[1]; + double r_strip = locpo_rotated[0]; + double O_x = m_shiftXY[0]; + double O_y = m_shiftXY[1]; // For a transformation from cartesian into polar coordinates // @@ -299,9 +294,8 @@ Vector2 AnnulusBounds::closestPoint( // now: MODULE system. Need to transform locpo to MODULE PC // transform is STRIP PC -> STRIP XY -> MODULE XY -> MODULE PC - Vector2 locpoStripXY( - locpo_rotated[eBoundLoc0] * std::cos(locpo_rotated[eBoundLoc1]), - locpo_rotated[eBoundLoc0] * std::sin(locpo_rotated[eBoundLoc1])); + Vector2 locpoStripXY(locpo_rotated[0] * std::cos(locpo_rotated[1]), + locpo_rotated[0] * std::sin(locpo_rotated[1])); Vector2 locpoModulePC = stripXYToModulePC(locpoStripXY); // now check edges in MODULE PC (inner and outer circle) assuming Mahalanobis @@ -328,8 +322,8 @@ bool AnnulusBounds::inside(const Vector2& lposition, double tolR, // locpo is PC in STRIP SYSTEM // need to perform internal rotation induced by average phi Vector2 locpo_rotated = m_rotationStripPC * lposition; - double phiLoc = locpo_rotated[eBoundLoc1]; - double rLoc = locpo_rotated[eBoundLoc0]; + double phiLoc = locpo_rotated[1]; + double rLoc = locpo_rotated[0]; if (phiLoc < (get(eMinPhiRel) - tolPhi) || phiLoc > (get(eMaxPhiRel) + tolPhi)) { @@ -339,18 +333,16 @@ bool AnnulusBounds::inside(const Vector2& lposition, double tolR, // calculate R in MODULE SYSTEM to evaluate R-bounds if (tolR == 0.) { // don't need R, can use R^2 - double r_mod2 = - m_shiftPC[eBoundLoc0] * m_shiftPC[eBoundLoc0] + rLoc * rLoc + - 2 * m_shiftPC[eBoundLoc0] * rLoc * cos(phiLoc - m_shiftPC[eBoundLoc1]); + double r_mod2 = m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + + 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]); if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) { return false; } } else { // use R - double r_mod = sqrt( - m_shiftPC[eBoundLoc0] * m_shiftPC[eBoundLoc0] + rLoc * rLoc + - 2 * m_shiftPC[eBoundLoc0] * rLoc * cos(phiLoc - m_shiftPC[eBoundLoc1])); + double r_mod = sqrt(m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + + 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1])); if (r_mod < (get(eMinR) - tolR) || r_mod > (get(eMaxR) + tolR)) { return false; diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index f4e167bfbf2..fc17378f83a 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -40,14 +40,22 @@ Vector2 DiscTrapezoidBounds::toLocalCartesian(const Vector2& lposition) const { SquareMatrix2 DiscTrapezoidBounds::boundToCartesianJacobian( const Vector2& lposition) const { - (void)lposition; - return SquareMatrix2::Identity(); // TODO + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = -lposition[0] * std::sin(lposition[1]); + j(1, 0) = std::sin(lposition[1]); + j(1, 1) = lposition[0] * std::cos(lposition[1]); + return j; } SquareMatrix2 DiscTrapezoidBounds::cartesianToBoundJacobian( const Vector2& lposition) const { - (void)lposition; - return SquareMatrix2::Identity(); // TODO + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = std::sin(lposition[1]); + j(1, 0) = -std::sin(lposition[1]) / lposition[0]; + j(1, 1) = std::cos(lposition[1]) / lposition[0]; + return j; } bool DiscTrapezoidBounds::inside(const Vector2& lposition) const { diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index f3736c791ac..fac8b9382ed 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -20,13 +20,23 @@ namespace Acts { SquareMatrix2 RadialBounds::boundToCartesianJacobian( - const Vector2& /*lposition*/) const { - return SquareMatrix2::Identity(); // TODO + const Vector2& lposition) const { + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = -lposition[0] * std::sin(lposition[1]); + j(1, 0) = std::sin(lposition[1]); + j(1, 1) = lposition[0] * std::cos(lposition[1]); + return j; } SquareMatrix2 RadialBounds::cartesianToBoundJacobian( - const Vector2& /*lposition*/) const { - return SquareMatrix2::Identity(); // TODO + const Vector2& lposition) const { + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = std::sin(lposition[1]); + j(1, 0) = -std::sin(lposition[1]) / lposition[0]; + j(1, 1) = std::cos(lposition[1]) / lposition[0]; + return j; } Vector2 RadialBounds::shifted(const Vector2& lposition) const { From edb688298cf721926797a09b437a6ffeefd947d7 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 09:38:19 +0100 Subject: [PATCH 15/33] metric --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 2 ++ Core/include/Acts/Surfaces/ConeBounds.hpp | 5 +++++ Core/include/Acts/Surfaces/CylinderBounds.hpp | 5 +++++ .../include/Acts/Surfaces/DiscTrapezoidBounds.hpp | 2 ++ Core/include/Acts/Surfaces/EllipseBounds.hpp | 3 --- Core/include/Acts/Surfaces/LineBounds.hpp | 15 ++++++++++----- Core/include/Acts/Surfaces/PlanarBounds.hpp | 13 +++++++++---- Core/include/Acts/Surfaces/RadialBounds.hpp | 8 ++++---- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 5 +++++ Core/src/Surfaces/AnnulusBounds.cpp | 10 ++++++++++ Core/src/Surfaces/DiscTrapezoidBounds.cpp | 10 ++++++++++ Core/src/Surfaces/LineBounds.cpp | 4 ---- Core/src/Surfaces/RadialBounds.cpp | 10 ++++++++++ .../Core/Surfaces/SurfaceBoundsTests.cpp | 15 ++++++++++++++- 14 files changed, 86 insertions(+), 21 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 48e4eb3e3a3..f5ce5cf25e7 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -76,6 +76,8 @@ class AnnulusBounds : public DiscBounds { SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; + /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 761e7bad054..528ce3ab65d 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -88,6 +88,11 @@ class ConeBounds : public SurfaceBounds { return SquareMatrix2::Identity(); } + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index d368b9149b5..24ad7faad8c 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -98,6 +98,11 @@ class CylinderBounds : public SurfaceBounds { return SquareMatrix2::Identity(); } + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index cb9978e1a80..c3fc8594792 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -72,6 +72,8 @@ class DiscTrapezoidBounds : public DiscBounds { SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; + /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index 450c92fa1f4..ac0b09bda94 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -16,9 +16,6 @@ #include "Acts/Utilities/detail/periodic.hpp" #include -#include -#include -#include #include #include #include diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index 3a545b27361..657c679c182 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -42,17 +42,22 @@ class LineBounds : public SurfaceBounds { checkConsistency(); } - BoundsType type() const final; + BoundsType type() const final { return eLine; } bool isCartesian() const final { return true; } - SquareMatrix2 boundToCartesianJacobian( - const Vector2& /*lposition*/) const final { + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; return SquareMatrix2::Identity(); } - SquareMatrix2 cartesianToBoundJacobian( - const Vector2& /*lposition*/) const final { + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; return SquareMatrix2::Identity(); } diff --git a/Core/include/Acts/Surfaces/PlanarBounds.hpp b/Core/include/Acts/Surfaces/PlanarBounds.hpp index 961547065fc..b223f5f84c7 100644 --- a/Core/include/Acts/Surfaces/PlanarBounds.hpp +++ b/Core/include/Acts/Surfaces/PlanarBounds.hpp @@ -38,13 +38,18 @@ class PlanarBounds : public SurfaceBounds { bool isCartesian() const final { return true; } - SquareMatrix2 boundToCartesianJacobian( - const Vector2& /*lposition*/) const final { + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; return SquareMatrix2::Identity(); } - SquareMatrix2 cartesianToBoundJacobian( - const Vector2& /*lposition*/) const final { + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; return SquareMatrix2::Identity(); } diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index e1cadb3f631..da81a12bb6a 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -62,11 +62,11 @@ class RadialBounds : public DiscBounds { bool isCartesian() const final { return false; } - SquareMatrix2 boundToCartesianJacobian( - const Vector2& /*lposition*/) const final; + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; - SquareMatrix2 cartesianToBoundJacobian( - const Vector2& /*lposition*/) const final; + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector /// diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index de0c05173b7..77f96b48b3e 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -62,6 +62,11 @@ class SurfaceBounds { virtual SquareMatrix2 cartesianToBoundJacobian( const Vector2& lposition) const = 0; + virtual SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const { + SquareMatrix2 j = boundToCartesianJacobian(lposition); + return j.transpose() * j; + } + /// Access method for bound values, this is a dynamically sized /// vector containing the parameters needed to describe these bounds /// diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index ef945cb18e6..0b0425ae660 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -173,6 +173,16 @@ SquareMatrix2 AnnulusBounds::cartesianToBoundJacobian( return j; } +SquareMatrix2 AnnulusBounds::boundToCartesianMetric( + const Vector2& lposition) const { + SquareMatrix2 m; + m(0, 0) = 1; + m(0, 1) = 0; + m(1, 0) = 0; + m(1, 1) = lposition[0] * lposition[0]; + return m; +} + bool AnnulusBounds::inside(const Vector2& lposition) const { return inside(lposition, 0., 0.); } diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index fc17378f83a..2aafb1d4177 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -58,6 +58,16 @@ SquareMatrix2 DiscTrapezoidBounds::cartesianToBoundJacobian( return j; } +SquareMatrix2 DiscTrapezoidBounds::boundToCartesianMetric( + const Vector2& lposition) const { + SquareMatrix2 m; + m(0, 0) = 1; + m(0, 1) = 0; + m(1, 0) = 0; + m(1, 1) = lposition[0] * lposition[0]; + return m; +} + bool DiscTrapezoidBounds::inside(const Vector2& lposition) const { Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, {get(eHalfLengthXmaxR), m_ymax}, diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index b3602568f42..7f7deca2cf6 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -16,10 +16,6 @@ namespace Acts { -SurfaceBounds::BoundsType LineBounds::type() const { - return SurfaceBounds::eLine; -} - bool LineBounds::inside(const Vector2& lposition) const { double r = get(LineBounds::eR); double halfLengthZ = get(LineBounds::eHalfLengthZ); diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index fac8b9382ed..36d63aaafe3 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -39,6 +39,16 @@ SquareMatrix2 RadialBounds::cartesianToBoundJacobian( return j; } +SquareMatrix2 RadialBounds::boundToCartesianMetric( + const Vector2& lposition) const { + SquareMatrix2 m; + m(0, 0) = 1; + m(0, 1) = 0; + m(1, 0) = 0; + m(1, 1) = lposition[0] * lposition[0]; + return m; +} + Vector2 RadialBounds::shifted(const Vector2& lposition) const { Vector2 tmp; tmp[eBoundLoc0] = lposition[eBoundLoc0]; diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp index 811e4758e99..d55ab4844bc 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp @@ -27,7 +27,15 @@ class SurfaceBoundsStub : public SurfaceBounds { std::iota(m_values.begin(), m_values.end(), 0); } - BoundsType type() const final { return SurfaceBounds::eOther; } + SurfaceBoundsStub(const SurfaceBoundsStub& other) + : m_values(other.m_values) {} + + SurfaceBoundsStub& operator=(const SurfaceBoundsStub& other) { + m_values = other.m_values; + return *this; + } + + BoundsType type() const final { return eOther; } bool isCartesian() const final { return true; } @@ -41,6 +49,11 @@ class SurfaceBoundsStub : public SurfaceBounds { return SquareMatrix2::Identity(); } + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + std::vector values() const final { return m_values; } bool inside(const Vector2& lposition) const final { From a2bf8be93601ea2f7c1c5438caef2dc372341543 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 09:42:22 +0100 Subject: [PATCH 16/33] remove some unintended changes --- Core/src/Surfaces/AnnulusBounds.cpp | 2 +- Core/src/Surfaces/ConeBounds.cpp | 2 +- Core/src/Surfaces/CylinderBounds.cpp | 2 +- Core/src/Surfaces/DiscTrapezoidBounds.cpp | 2 +- Core/src/Surfaces/EllipseBounds.cpp | 2 +- Core/src/Surfaces/LineBounds.cpp | 2 +- Core/src/Surfaces/RadialBounds.cpp | 2 +- Core/src/Surfaces/TrapezoidBounds.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 0b0425ae660..eb2549b7ce1 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -393,7 +393,7 @@ Vector2 AnnulusBounds::moduleOrigin() const { std::ostream& AnnulusBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "AnnulusBounds: (innerRadius, outerRadius, minPhi, maxPhi) = "; + sl << "Acts::AnnulusBounds: (innerRadius, outerRadius, minPhi, maxPhi) = "; sl << "(" << get(eMinR) << ", " << get(eMaxR) << ", " << phiMin() << ", " << phiMax() << ")" << '\n'; sl << " - shift xy = " << m_shiftXY.x() << ", " << m_shiftXY.y() << '\n'; diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 7084731ec28..80e34378508 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -81,7 +81,7 @@ bool ConeBounds::inside(const Vector2& lposition, std::ostream& ConeBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "ConeBounds: (tanAlpha, minZ, maxZ, halfPhiSector, averagePhi) " + sl << "Acts::ConeBounds: (tanAlpha, minZ, maxZ, halfPhiSector, averagePhi) " "= "; sl << "(" << m_tanAlpha << ", " << get(eMinZ) << ", " << get(eMaxZ) << ", " << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")"; diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index 358b8568ce0..33d667d4e27 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -110,7 +110,7 @@ bool CylinderBounds::inside(const Vector2& lposition, std::ostream& CylinderBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "CylinderBounds: (radius, halfLengthZ, halfPhiSector, " + sl << "Acts::CylinderBounds: (radius, halfLengthZ, halfPhiSector, " "averagePhi, bevelMinZ, bevelMaxZ) = "; sl << "(" << get(eR) << ", " << get(eHalfLengthZ) << ", "; sl << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ", "; diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index 2aafb1d4177..c9938d5f2e5 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -118,7 +118,7 @@ std::vector DiscTrapezoidBounds::vertices( std::ostream& DiscTrapezoidBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "DiscTrapezoidBounds: (innerRadius, outerRadius, " + sl << "Acts::DiscTrapezoidBounds: (innerRadius, outerRadius, " "halfLengthXminR, " "halfLengthXmaxR, halfLengthY, halfPhiSector, averagePhi, rCenter, " "stereo) = "; diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index fb7371ac2b5..043fc850254 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -80,7 +80,7 @@ const RectangleBounds& EllipseBounds::boundingBox() const { std::ostream& EllipseBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "EllipseBounds: (innerRadius0, outerRadius0, innerRadius1, " + sl << "Acts::EllipseBounds: (innerRadius0, outerRadius0, innerRadius1, " "outerRadius1, hPhiSector, averagePhi) = "; sl << "(" << get(eInnerRx) << ", " << get(eInnerRy) << ", " << get(eOuterRx) << ", " << get(eOuterRy) << ", " << get(eAveragePhi) << ", " diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index 7f7deca2cf6..e39670c8765 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -45,7 +45,7 @@ bool LineBounds::inside(const Vector2& lposition, std::ostream& LineBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "LineBounds: (radius, halflengthInZ) = "; + sl << "Acts::LineBounds: (radius, halflengthInZ) = "; sl << "(" << get(LineBounds::eR) << ", " << get(LineBounds::eHalfLengthZ) << ")"; sl << std::setprecision(-1); diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 36d63aaafe3..ce6ae9c9311 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -88,7 +88,7 @@ std::vector RadialBounds::vertices(unsigned int lseg) const { std::ostream& RadialBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "RadialBounds: (innerRadius, outerRadius, hPhiSector, " + sl << "Acts::RadialBounds: (innerRadius, outerRadius, hPhiSector, " "averagePhi) = "; sl << "(" << get(eMinR) << ", " << get(eMaxR) << ", " << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")"; diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 38d1b6efc44..ac5f3e2588d 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -153,7 +153,7 @@ const RectangleBounds& TrapezoidBounds::boundingBox() const { std::ostream& TrapezoidBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); - sl << "TrapezoidBounds: (halfXnegY, halfXposY, halfY, rotAngle) = " + sl << "Acts::TrapezoidBounds: (halfXnegY, halfXposY, halfY, rotAngle) = " << "(" << get(eHalfLengthXnegY) << ", " << get(eHalfLengthXposY) << ", " << get(eHalfLengthY) << ", " << get(eRotationAngle) << ")"; sl << std::setprecision(-1); From 43c7d2303996508b998c6f3954f11be87d642356 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 10:26:53 +0100 Subject: [PATCH 17/33] default inside impl; fix compilation --- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 17 ++- Core/include/Acts/Surfaces/Surface.hpp | 15 +- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 34 ++++- Core/src/Surfaces/BoundaryTolerance.cpp | 1 - Core/src/Surfaces/Surface.cpp | 130 ++++++++++-------- .../Core/Surfaces/SurfaceBoundsTests.cpp | 18 ++- 6 files changed, 126 insertions(+), 89 deletions(-) diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 16bd0011b36..a7b461ddabe 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -20,19 +20,22 @@ namespace Acts { class InfiniteBounds : public SurfaceBounds { public: - SurfaceBounds::BoundsType type() const final { - return SurfaceBounds::eBoundless; - } + SurfaceBounds::BoundsType type() const final { return eBoundless; } bool isCartesian() const final { return true; } - SquareMatrix2 boundToCartesianJacobian( - const Vector2& /*lposition*/) const final { + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { + (void)lposition; return SquareMatrix2::Identity(); } - SquareMatrix2 cartesianToBoundJacobian( - const Vector2& /*lposition*/) const final { + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; return SquareMatrix2::Identity(); } diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index 43d8161aa8c..e1e1bd3b20c 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Alignment.hpp" -#include "Acts/Definitions/Common.hpp" #include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Geometry/DetectorElementBase.hpp" @@ -19,20 +18,14 @@ #include "Acts/Geometry/Polyhedron.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Surfaces/SurfaceError.hpp" -#include "Acts/Surfaces/detail/AlignmentHelper.hpp" -#include "Acts/Utilities/BinnedArray.hpp" -#include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Visualization/ViewConfig.hpp" #include -#include #include #include #include -#include #include namespace Acts { @@ -257,6 +250,14 @@ class Surface : public virtual GeometryObject, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::None(), double tolerance = s_onSurfaceTolerance) const; + virtual Vector2 closestPointOnBounds( + const Vector2& lposition, + const std::optional& metric) const; + + virtual double distanceToBounds( + const Vector2& lposition, + const std::optional& metric) const; + /// The insideBounds method for local positions /// /// @param lposition The local position to check diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 77f96b48b3e..9ebe33c837e 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -12,6 +12,7 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include +#include #include namespace Acts { @@ -62,10 +63,8 @@ class SurfaceBounds { virtual SquareMatrix2 cartesianToBoundJacobian( const Vector2& lposition) const = 0; - virtual SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const { - SquareMatrix2 j = boundToCartesianJacobian(lposition); - return j.transpose() * j; - } + virtual SquareMatrix2 boundToCartesianMetric( + const Vector2& lposition) const = 0; /// Access method for bound values, this is a dynamically sized /// vector containing the parameters needed to describe these bounds @@ -96,9 +95,32 @@ class SurfaceBounds { /// @return boolean indicator for the success of this operation virtual bool inside(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const { - (void)boundaryTolerance; + if (boundaryTolerance.isInfinite()) { + return true; + } + + if (inside(lposition)) { + return true; + } + + if (!boundaryTolerance.hasTolerance()) { + return false; + } - return inside(lposition); + std::optional jacobian; + std::optional metric; + if (boundaryTolerance.hasChi2Bound()) { + SquareMatrix2 j = boundToCartesianJacobian(lposition); + jacobian = j; + metric = j.transpose() * boundaryTolerance.asChi2Bound().weight * j; + } else if (!isCartesian()) { + jacobian = boundToCartesianJacobian(lposition); + metric = boundToCartesianMetric(lposition); + } + + Vector2 closest = closestPoint(lposition, metric); + Vector2 distance = closest - lposition; + return boundaryTolerance.isTolerated(distance, jacobian); } /// Output Method for std::ostream, to be overloaded by child classes diff --git a/Core/src/Surfaces/BoundaryTolerance.cpp b/Core/src/Surfaces/BoundaryTolerance.cpp index b5077fa4ec4..3538a82f414 100644 --- a/Core/src/Surfaces/BoundaryTolerance.cpp +++ b/Core/src/Surfaces/BoundaryTolerance.cpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Algebra.hpp" -#include #include #include diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 0fbfe6bc982..d3b28738c53 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -12,23 +12,24 @@ #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Surfaces/detail/AlignmentHelper.hpp" #include "Acts/Utilities/JacobianHelpers.hpp" -#include "Acts/Utilities/VectorHelpers.hpp" #include "Acts/Visualization/ViewConfig.hpp" #include #include -std::array - Acts::Surface::s_surfaceTypeNames = { - "Cone", "Cylinder", "Disc", "Perigee", "Plane", "Straw", "Curvilinear"}; +namespace Acts { -Acts::Surface::Surface(const Transform3& transform) +std::array + Surface::s_surfaceTypeNames = {"Cone", "Cylinder", "Disc", "Perigee", + "Plane", "Straw", "Curvilinear"}; + +Surface::Surface(const Transform3& transform) : GeometryObject(), m_transform(std::make_unique(transform)) {} -Acts::Surface::Surface(const DetectorElementBase& detelement) +Surface::Surface(const DetectorElementBase& detelement) : GeometryObject(), m_associatedDetElement(&detelement) {} -Acts::Surface::Surface(const Surface& other) +Surface::Surface(const Surface& other) : GeometryObject(other), std::enable_shared_from_this(), m_associatedDetElement(other.m_associatedDetElement), @@ -38,19 +39,18 @@ Acts::Surface::Surface(const Surface& other) } } -Acts::Surface::Surface(const GeometryContext& gctx, const Surface& other, - const Transform3& shift) +Surface::Surface(const GeometryContext& gctx, const Surface& other, + const Transform3& shift) : GeometryObject(), m_transform(std::make_unique(shift * other.transform(gctx))), m_surfaceMaterial(other.m_surfaceMaterial) {} -Acts::Surface::~Surface() = default; +Surface::~Surface() = default; -bool Acts::Surface::isOnSurface(const GeometryContext& gctx, - const Vector3& position, - const Vector3& direction, - const BoundaryTolerance& boundaryTolerance, - double tolerance) const { +bool Surface::isOnSurface(const GeometryContext& gctx, const Vector3& position, + const Vector3& direction, + const BoundaryTolerance& boundaryTolerance, + double tolerance) const { // global to local transformation auto lpResult = globalToLocal(gctx, position, direction, tolerance); if (!lpResult.ok()) { @@ -59,7 +59,7 @@ bool Acts::Surface::isOnSurface(const GeometryContext& gctx, return bounds().inside(lpResult.value(), boundaryTolerance); } -Acts::AlignmentToBoundMatrix Acts::Surface::alignmentToBoundDerivative( +AlignmentToBoundMatrix Surface::alignmentToBoundDerivative( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const FreeVector& pathDerivative) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -81,8 +81,7 @@ Acts::AlignmentToBoundMatrix Acts::Surface::alignmentToBoundDerivative( return alignToBound; } -Acts::AlignmentToBoundMatrix -Acts::Surface::alignmentToBoundDerivativeWithoutCorrection( +AlignmentToBoundMatrix Surface::alignmentToBoundDerivativeWithoutCorrection( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { (void)direction; @@ -123,7 +122,7 @@ Acts::Surface::alignmentToBoundDerivativeWithoutCorrection( return alignToBound; } -Acts::AlignmentToPathMatrix Acts::Surface::alignmentToPathDerivative( +AlignmentToPathMatrix Surface::alignmentToPathDerivative( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -149,15 +148,15 @@ Acts::AlignmentToPathMatrix Acts::Surface::alignmentToPathDerivative( return alignToPath; } -std::shared_ptr Acts::Surface::getSharedPtr() { +std::shared_ptr Surface::getSharedPtr() { return shared_from_this(); } -std::shared_ptr Acts::Surface::getSharedPtr() const { +std::shared_ptr Surface::getSharedPtr() const { return shared_from_this(); } -Acts::Surface& Acts::Surface::operator=(const Surface& other) { +Surface& Surface::operator=(const Surface& other) { if (&other != this) { GeometryObject::operator=(other); // detector element, identifier & layer association are unique @@ -173,7 +172,7 @@ Acts::Surface& Acts::Surface::operator=(const Surface& other) { return *this; } -bool Acts::Surface::operator==(const Surface& other) const { +bool Surface::operator==(const Surface& other) const { // (a) fast exit for pointer comparison if (&other == this) { return true; @@ -205,18 +204,18 @@ bool Acts::Surface::operator==(const Surface& other) const { } // overload dump for stream operator -std::ostream& Acts::Surface::toStreamImpl(const GeometryContext& gctx, - std::ostream& sl) const { +std::ostream& Surface::toStreamImpl(const GeometryContext& gctx, + std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(4); sl << name() << std::endl; const Vector3& sfcenter = center(gctx); sl << " Center position (x, y, z) = (" << sfcenter.x() << ", " << sfcenter.y() << ", " << sfcenter.z() << ")" << std::endl; - Acts::RotationMatrix3 rot(transform(gctx).matrix().block<3, 3>(0, 0)); - Acts::Vector3 rotX(rot.col(0)); - Acts::Vector3 rotY(rot.col(1)); - Acts::Vector3 rotZ(rot.col(2)); + RotationMatrix3 rot(transform(gctx).matrix().block<3, 3>(0, 0)); + Vector3 rotX(rot.col(0)); + Vector3 rotY(rot.col(1)); + Vector3 rotZ(rot.col(2)); sl << std::setprecision(6); sl << " Rotation: colX = (" << rotX(0) << ", " << rotX(1) << ", " << rotX(2) << ")" << std::endl; @@ -229,41 +228,51 @@ std::ostream& Acts::Surface::toStreamImpl(const GeometryContext& gctx, return sl; } -std::string Acts::Surface::toString(const GeometryContext& gctx) const { +std::string Surface::toString(const GeometryContext& gctx) const { std::stringstream ss; ss << toStream(gctx); return ss.str(); } -Acts::Vector3 Acts::Surface::center(const GeometryContext& gctx) const { +Vector3 Surface::center(const GeometryContext& gctx) const { // fast access via transform matrix (and not translation()) auto tMatrix = transform(gctx).matrix(); return Vector3(tMatrix(0, 3), tMatrix(1, 3), tMatrix(2, 3)); } -const Acts::Transform3& Acts::Surface::transform( - const GeometryContext& gctx) const { +const Transform3& Surface::transform(const GeometryContext& gctx) const { if (m_associatedDetElement != nullptr) { return m_associatedDetElement->transform(gctx); } return *m_transform; } -bool Acts::Surface::insideBounds( +Vector2 Surface::closestPointOnBounds( + const Vector2& lposition, + const std::optional& metric) const { + return bounds().closestPoint(lposition, metric); +} + +double Surface::distanceToBounds( const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { + const std::optional& metric) const { + return bounds().distance(lposition, metric); +} + +bool Surface::insideBounds(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { return bounds().inside(lposition, boundaryTolerance); } -Acts::RotationMatrix3 Acts::Surface::referenceFrame( - const GeometryContext& gctx, const Vector3& /*position*/, - const Vector3& /*direction*/) const { +RotationMatrix3 Surface::referenceFrame(const GeometryContext& gctx, + const Vector3& /*position*/, + const Vector3& /*direction*/) const { return transform(gctx).matrix().block<3, 3>(0, 0); } -Acts::BoundToFreeMatrix Acts::Surface::boundToFreeJacobian( - const GeometryContext& gctx, const Vector3& position, - const Vector3& direction) const { +BoundToFreeMatrix Surface::boundToFreeJacobian(const GeometryContext& gctx, + const Vector3& position, + const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); // retrieve the reference frame @@ -282,9 +291,9 @@ Acts::BoundToFreeMatrix Acts::Surface::boundToFreeJacobian( return jacToGlobal; } -Acts::FreeToBoundMatrix Acts::Surface::freeToBoundJacobian( - const GeometryContext& gctx, const Vector3& position, - const Vector3& direction) const { +FreeToBoundMatrix Surface::freeToBoundJacobian(const GeometryContext& gctx, + const Vector3& position, + const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); // The measurement frame of the surface @@ -304,9 +313,9 @@ Acts::FreeToBoundMatrix Acts::Surface::freeToBoundJacobian( return jacToLocal; } -Acts::FreeToPathMatrix Acts::Surface::freeToPathDerivative( - const GeometryContext& gctx, const Vector3& position, - const Vector3& direction) const { +FreeToPathMatrix Surface::freeToPathDerivative(const GeometryContext& gctx, + const Vector3& position, + const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); // The measurement frame of the surface @@ -321,45 +330,44 @@ Acts::FreeToPathMatrix Acts::Surface::freeToPathDerivative( return freeToPath; } -const Acts::DetectorElementBase* Acts::Surface::associatedDetectorElement() - const { +const DetectorElementBase* Surface::associatedDetectorElement() const { return m_associatedDetElement; } -const Acts::Layer* Acts::Surface::associatedLayer() const { +const Layer* Surface::associatedLayer() const { return m_associatedLayer; } -const Acts::ISurfaceMaterial* Acts::Surface::surfaceMaterial() const { +const ISurfaceMaterial* Surface::surfaceMaterial() const { return m_surfaceMaterial.get(); } -const std::shared_ptr& -Acts::Surface::surfaceMaterialSharedPtr() const { +const std::shared_ptr& +Surface::surfaceMaterialSharedPtr() const { return m_surfaceMaterial; } -void Acts::Surface::assignDetectorElement( - const DetectorElementBase& detelement) { +void Surface::assignDetectorElement(const DetectorElementBase& detelement) { m_associatedDetElement = &detelement; // resetting the transform as it will be handled through the detector element // now m_transform.reset(); } -void Acts::Surface::assignSurfaceMaterial( - std::shared_ptr material) { +void Surface::assignSurfaceMaterial( + std::shared_ptr material) { m_surfaceMaterial = std::move(material); } -void Acts::Surface::associateLayer(const Acts::Layer& lay) { +void Surface::associateLayer(const Layer& lay) { m_associatedLayer = (&lay); } -void Acts::Surface::visualize(IVisualization3D& helper, - const GeometryContext& gctx, - const ViewConfig& viewConfig) const { +void Surface::visualize(IVisualization3D& helper, const GeometryContext& gctx, + const ViewConfig& viewConfig) const { Polyhedron polyhedron = polyhedronRepresentation(gctx, viewConfig.quarterSegments); polyhedron.visualize(helper, viewConfig); } + +} // namespace Acts diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp index d55ab4844bc..b71becf18cd 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp @@ -27,13 +27,17 @@ class SurfaceBoundsStub : public SurfaceBounds { std::iota(m_values.begin(), m_values.end(), 0); } - SurfaceBoundsStub(const SurfaceBoundsStub& other) - : m_values(other.m_values) {} - - SurfaceBoundsStub& operator=(const SurfaceBoundsStub& other) { - m_values = other.m_values; - return *this; - } +#if defined(__GNUC__) && (__GNUC__ == 13 || __GNUC__ == 14) && \ + !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + SurfaceBoundsStub(const SurfaceBoundsStub& other) = default; +#if defined(__GNUC__) && (__GNUC__ == 13 || __GNUC__ == 14) && \ + !defined(__clang__) +#pragma GCC diagnostic pop +#endif BoundsType type() const final { return eOther; } From 7ea41157db0eb0230a2941023ff470850686065d Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 11:42:14 +0100 Subject: [PATCH 18/33] deduplicate inside --- .../Acts/Geometry/TrapezoidVolumeBounds.hpp | 2 - Core/include/Acts/Surfaces/AnnulusBounds.hpp | 11 +--- Core/include/Acts/Surfaces/ConeBounds.hpp | 9 +-- .../Acts/Surfaces/ConvexPolygonBounds.hpp | 17 +----- .../Acts/Surfaces/ConvexPolygonBounds.ipp | 8 --- Core/include/Acts/Surfaces/CylinderBounds.hpp | 11 +--- Core/include/Acts/Surfaces/DiamondBounds.hpp | 11 +--- Core/include/Acts/Surfaces/DiscBounds.hpp | 2 +- .../Acts/Surfaces/DiscTrapezoidBounds.hpp | 10 +--- Core/include/Acts/Surfaces/EllipseBounds.hpp | 13 +---- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 23 ++++---- Core/include/Acts/Surfaces/LineBounds.hpp | 12 +--- Core/include/Acts/Surfaces/RadialBounds.hpp | 10 +--- .../include/Acts/Surfaces/RectangleBounds.hpp | 11 +--- .../include/Acts/Surfaces/TrapezoidBounds.hpp | 15 ++--- Core/src/Surfaces/AnnulusBounds.cpp | 20 ------- Core/src/Surfaces/ConeBounds.cpp | 8 --- Core/src/Surfaces/ConvexPolygonBounds.cpp | 8 --- Core/src/Surfaces/CylinderBounds.cpp | 58 +++++++++---------- Core/src/Surfaces/DiamondBounds.cpp | 17 ------ Core/src/Surfaces/DiscTrapezoidBounds.cpp | 13 ----- Core/src/Surfaces/EllipseBounds.cpp | 28 --------- Core/src/Surfaces/LineBounds.cpp | 10 ---- Core/src/Surfaces/RadialBounds.cpp | 8 --- Core/src/Surfaces/RectangleBounds.cpp | 6 -- Core/src/Surfaces/TrapezoidBounds.cpp | 44 -------------- 26 files changed, 56 insertions(+), 329 deletions(-) diff --git a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp index 9ce660e5856..203cc18b3cf 100644 --- a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp @@ -13,11 +13,9 @@ #include "Acts/Geometry/VolumeBounds.hpp" #include -#include #include #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 9ceef033e91..183875e5bd8 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -88,15 +87,7 @@ class AnnulusBounds : public DiscBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Outstream operator /// diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index a7bf54316fe..69b3c2fc559 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include @@ -100,13 +99,7 @@ class ConeBounds : public SurfaceBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// inside method for local position - /// - /// @param lposition is the local position to be checked - /// @param boundaryTolerance is the boundary check directive - /// @return is a boolean indicating if the position is inside - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Output Method for std::ostream /// diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index 783f314dc6a..47c10d6c202 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -104,13 +103,7 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// Return whether a local 2D point lies inside of the bounds defined by this - /// object. - /// @param lposition The local position to check - /// @param boundaryTolerance The `BoundaryTolerance` object handling tolerances. - /// @return Whether the points is inside - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Return the vertices /// @@ -156,13 +149,7 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// Return whether a local 2D point lies inside of the bounds defined by this - /// object. - /// @param lposition The local position to check - /// @param boundaryTolerance The `BoundaryTolerance` object handling tolerances. - /// @return Whether the points is inside - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 9bf172e8878..7559ebb2796 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -108,14 +108,6 @@ Vector2 ConvexPolygonBounds::closestPoint( lposition, m_vertices, metric.value_or(SquareMatrix2::Identity())); } -template -bool ConvexPolygonBounds::inside( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - return detail::insidePolygon(m_vertices, boundaryTolerance, lposition, - std::nullopt); -} - template std::vector ConvexPolygonBounds::vertices( unsigned int /*ignoredSegments*/) const { diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index baa7804bf0e..b27f531e8da 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include @@ -113,15 +112,7 @@ class CylinderBounds : public SurfaceBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check tolerance directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Access to the bound values /// @param bValue the class nested enum for the array access diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index ba3a5b641ee..87c7ba9fd42 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -78,15 +77,7 @@ class DiamondBounds : public PlanarBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Return the vertices that describe this shape /// diff --git a/Core/include/Acts/Surfaces/DiscBounds.hpp b/Core/include/Acts/Surfaces/DiscBounds.hpp index 626f8e2405c..56669ceacab 100644 --- a/Core/include/Acts/Surfaces/DiscBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscBounds.hpp @@ -18,7 +18,7 @@ namespace Acts { /// /// common base class for all bounds that are in a r/phi frame /// - simply introduced to avoid wrong bound assignments to surfaces - +/// class DiscBounds : public SurfaceBounds { public: /// Return method for inner Radius diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index a5465902794..aa9f5bbf7cb 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -80,14 +79,7 @@ class DiscTrapezoidBounds : public DiscBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// This method checks if the radius given in the LocalPosition is inside - /// [rMin,rMax] - /// if only tol0 is given and additional in the phi sector is tol1 is given - /// @param lposition is the local position to be checked (in polar - /// coordinates) - /// @param boundaryTolerance is the boundary check directive - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Output Method for std::ostream std::ostream& toStream(std::ostream& sl) const final; diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index 12596a2e96b..481d6c0235e 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -78,17 +77,7 @@ class EllipseBounds : public PlanarBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// This method checks if the point given in the local coordinates is between - /// two ellipsoids if only tol0 is given and additional in the phi sector is - /// tol1 is given - /// - /// @warning This **only** works for tolerance-based checks - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 7c27e13aab0..91808ac4344 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" namespace Acts { @@ -41,21 +42,21 @@ class InfiniteBounds : public SurfaceBounds { std::vector values() const final { return {}; } - bool inside(const Vector2& /*lposition*/) const final { return true; } + bool inside(const Vector2& lposition) const final { + (void)lposition; + return true; + } - Vector2 closestPoint( - const Vector2& lposition, - const std::optional& /*metric*/) const final { + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final { + (void)metric; return lposition; } - /// Method inside() returns true for any case - /// - /// ignores input parameters - /// - /// @return always true - bool inside(const Vector2& /*lposition*/, - const BoundaryTolerance& /*boundaryTolerance*/) const final { + bool inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const final { + (void)lposition; + (void)boundaryTolerance; return true; } diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index 63684fad728..45e8113d6ea 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include @@ -70,16 +69,7 @@ class LineBounds : public SurfaceBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Output Method for std::ostream /// diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index 875a5b6eba2..5bc37cae9ee 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -76,14 +75,7 @@ class RadialBounds : public DiscBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// For disc surfaces the local position in (r,phi) is checked - /// - /// @param lposition local position to be checked - /// @param boundaryTolerance boundary check directive - /// - /// @return is a boolean indicating the operation success - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Outstream operator /// diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index 1d1a116d080..50e8ecb2963 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -72,15 +71,7 @@ class RectangleBounds : public PlanarBounds { Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index 42428d8e9a9..509ef301e86 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -55,11 +54,6 @@ class TrapezoidBounds : public PlanarBounds { std::vector values() const final; - bool inside(const Vector2& lposition) const final; - - Vector2 closestPoint(const Vector2& lposition, - const std::optional& metric) const final; - /// The orientation of the Trapezoid is according to the figure above, /// in words: the shorter of the two parallel sides of the trapezoid /// intersects @@ -98,11 +92,14 @@ class TrapezoidBounds : public PlanarBounds { /// x_{min}) @f$ /// /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive /// /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + bool inside(const Vector2& lposition) const final; + + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 2f405d11b72..e0a38510547 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -9,7 +9,6 @@ #include "Acts/Surfaces/AnnulusBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -381,25 +380,6 @@ bool AnnulusBounds::inside(const Vector2& lposition, double tolR, return true; } -bool AnnulusBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - if (boundaryTolerance.isInfinite()) { - return true; - } - - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(); - absoluteBound.has_value()) { - return inside(lposition, absoluteBound->tolerance0, - absoluteBound->tolerance1); - } - - // TODO jacobian - Vector2 closestPoint = - this->closestPoint(lposition, boundaryTolerance.getMetric(std::nullopt)); - - return boundaryTolerance.isTolerated(lposition - closestPoint, std::nullopt); -} - Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { Vector2 vecModuleXY = vStripXY + m_shiftXY; return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)}; diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 5b948af5551..a95435fd58b 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -88,14 +88,6 @@ Vector2 ConeBounds::closestPoint( shifted(lposition), metric); } -bool ConeBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - auto rphiHalf = r(lposition[1]) * get(eHalfPhiSector); - return detail::insideAlignedBox( - Vector2(-rphiHalf, get(eMinZ)), Vector2(rphiHalf, get(eMaxZ)), - boundaryTolerance, shifted(lposition), std::nullopt); -} - std::ostream& ConeBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); diff --git a/Core/src/Surfaces/ConvexPolygonBounds.cpp b/Core/src/Surfaces/ConvexPolygonBounds.cpp index eb5cba655b4..6d3420b2cca 100644 --- a/Core/src/Surfaces/ConvexPolygonBounds.cpp +++ b/Core/src/Surfaces/ConvexPolygonBounds.cpp @@ -59,14 +59,6 @@ Vector2 ConvexPolygonBounds::closestPoint( metric.value_or(SquareMatrix2::Identity())); } -bool ConvexPolygonBounds::inside( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - return detail::insidePolygon( - std::span(m_vertices.data(), m_vertices.size()), - boundaryTolerance, lposition, std::nullopt); -} - std::vector ConvexPolygonBounds::vertices( unsigned int /*lseg*/) const { return {m_vertices.begin(), m_vertices.end()}; diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index 221dbceae42..ed6a39535d3 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -36,33 +36,6 @@ Vector2 CylinderBounds::shifted(const Vector2& lposition) const { } bool CylinderBounds::inside(const Vector2& lposition) const { - (void)lposition; - return false; // TODO -} - -Vector2 CylinderBounds::closestPoint( - const Vector2& lposition, - const std::optional& metric) const { - double bevelMinZ = get(eBevelMinZ); - double bevelMaxZ = get(eBevelMaxZ); - double halfLengthZ = get(eHalfLengthZ); - double radius = get(eR); - - Vector2 lowerLeft = {-radius, -halfLengthZ}; - Vector2 middleLeft = {0., -(halfLengthZ + radius * std::tan(bevelMinZ))}; - Vector2 upperLeft = {radius, -halfLengthZ}; - Vector2 upperRight = {radius, halfLengthZ}; - Vector2 middleRight = {0., (halfLengthZ + radius * std::tan(bevelMaxZ))}; - Vector2 lowerRight = {-radius, halfLengthZ}; - Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, - upperRight, middleRight, lowerRight}; - - return detail::VerticesHelper::computeClosestPointOnPolygon( - lposition, vertices, metric.value_or(SquareMatrix2::Identity())); -} - -bool CylinderBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { double bevelMinZ = get(eBevelMinZ); double bevelMaxZ = get(eBevelMaxZ); @@ -70,10 +43,10 @@ bool CylinderBounds::inside(const Vector2& lposition, double halfPhi = get(eHalfPhiSector); if (bevelMinZ == 0. || bevelMaxZ == 0.) { - return detail::insideAlignedBox(Vector2(-halfPhi, -halfLengthZ), - Vector2(halfPhi, halfLengthZ), - boundaryTolerance, shifted(lposition), - boundToCartesianJacobian(lposition)); + return detail::insideAlignedBox( + Vector2(-halfPhi, -halfLengthZ), Vector2(halfPhi, halfLengthZ), + BoundaryTolerance::None(), shifted(lposition), + boundToCartesianJacobian(lposition)); } double radius = get(eR); @@ -106,10 +79,31 @@ bool CylinderBounds::inside(const Vector2& lposition, Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, upperRight, middleRight, lowerRight}; - return detail::insidePolygon(vertices, boundaryTolerance, lposition, + return detail::insidePolygon(vertices, BoundaryTolerance::None(), lposition, boundToCartesianJacobian(lposition)); } +Vector2 CylinderBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + double bevelMinZ = get(eBevelMinZ); + double bevelMaxZ = get(eBevelMaxZ); + double halfLengthZ = get(eHalfLengthZ); + double radius = get(eR); + + Vector2 lowerLeft = {-radius, -halfLengthZ}; + Vector2 middleLeft = {0., -(halfLengthZ + radius * std::tan(bevelMinZ))}; + Vector2 upperLeft = {radius, -halfLengthZ}; + Vector2 upperRight = {radius, halfLengthZ}; + Vector2 middleRight = {0., (halfLengthZ + radius * std::tan(bevelMaxZ))}; + Vector2 lowerRight = {-radius, halfLengthZ}; + Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, + upperRight, middleRight, lowerRight}; + + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); +} + std::ostream& CylinderBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index ff5ba2af332..5a6338a6c28 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -9,7 +9,6 @@ #include "Acts/Surfaces/DiamondBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" @@ -66,22 +65,6 @@ Vector2 DiamondBounds::closestPoint( lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } -bool DiamondBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - // Vertices starting at lower left (min rel. phi) - // counter-clockwise - double x1 = get(DiamondBounds::eHalfLengthXnegY); - double y1 = get(DiamondBounds::eHalfLengthYneg); - double x2 = get(DiamondBounds::eHalfLengthXzeroY); - double y2 = 0.; - double x3 = get(DiamondBounds::eHalfLengthXposY); - double y3 = get(DiamondBounds::eHalfLengthYpos); - Vector2 vertices[] = {{-x1, -y1}, {x1, -y1}, {x2, y2}, - {x3, y3}, {-x3, y3}, {-x2, y2}}; - return detail::insidePolygon(vertices, boundaryTolerance, lposition, - std::nullopt); -} - std::vector DiamondBounds::vertices( unsigned int /*ignoredSegments*/) const { // Vertices starting at lower left (min rel. phi) diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index b6fd2771410..76cf1cfc4f5 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -9,7 +9,6 @@ #include "Acts/Surfaces/DiscTrapezoidBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -103,18 +102,6 @@ Vector2 DiscTrapezoidBounds::closestPoint( metric.value_or(SquareMatrix2::Identity())); } -bool DiscTrapezoidBounds::inside( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, - {get(eHalfLengthXmaxR), m_ymax}, - {-get(eHalfLengthXmaxR), m_ymax}, - {-get(eHalfLengthXminR), get(eMinR)}}; - return detail::insidePolygon(vertices, boundaryTolerance, - toLocalCartesian(lposition), - boundToCartesianJacobian(lposition)); -} - std::vector DiscTrapezoidBounds::vertices( unsigned int /*ignoredSegments*/) const { Vector2 cAxis(std::cos(get(eAveragePhi)), std::sin(get(eAveragePhi))); diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index 0d6942b4761..f257214299c 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -8,7 +8,6 @@ #include "Acts/Surfaces/EllipseBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/MathHelpers.hpp" #include "Acts/Utilities/VectorHelpers.hpp" @@ -60,33 +59,6 @@ Vector2 EllipseBounds::closestPoint( throw std::logic_error("Not implemented"); } -bool EllipseBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - if (boundaryTolerance.isInfinite()) { - return true; - } - - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(); - absoluteBound.has_value()) { - double tol0 = absoluteBound->tolerance0; - double tol1 = absoluteBound->tolerance1; - - double phi = - detail::radian_sym(VectorHelpers::phi(lposition) - get(eAveragePhi)); - double phiHalf = get(eHalfPhiSector) + tol1; - - bool insidePhi = (-phiHalf <= phi) && (phi < phiHalf); - bool insideInner = (get(eInnerRx) <= tol0) || (get(eOuterRx) <= tol0) || - (1 < (square(lposition[0] / (get(eInnerRx) - tol0)) + - square(lposition[1] / (get(eOuterRx) - tol0)))); - bool insideOuter = (square(lposition[0] / (get(eInnerRy) + tol0)) + - square(lposition[1] / (get(eOuterRy) + tol0))) < 1; - return insidePhi && insideInner && insideOuter; - } - - throw std::logic_error("Unsupported boundary check type"); -} - std::vector EllipseBounds::vertices( unsigned int quarterSegments) const { return detail::VerticesHelper::ellipsoidVertices( diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index a72609763fc..bf7a056b8ed 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -8,7 +8,6 @@ #include "Acts/Surfaces/LineBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include @@ -46,15 +45,6 @@ Vector2 LineBounds::closestPoint( Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ), lposition, metric); } -bool LineBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - double r = get(LineBounds::eR); - double halfLengthZ = get(LineBounds::eHalfLengthZ); - return detail::insideAlignedBox(Vector2(-r, -halfLengthZ), - Vector2(r, halfLengthZ), boundaryTolerance, - lposition, std::nullopt); -} - std::ostream& LineBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index c6736f512ef..bfa47388b19 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -87,14 +87,6 @@ Vector2 RadialBounds::closestPoint( Vector2(get(eMaxR), get(eHalfPhiSector)), shifted(lposition), metric); } -bool RadialBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - return detail::insideAlignedBox(Vector2(get(eMinR), -get(eHalfPhiSector)), - Vector2(get(eMaxR), get(eHalfPhiSector)), - boundaryTolerance, shifted(lposition), - std::nullopt); -} - std::vector RadialBounds::vertices(unsigned int lseg) const { return detail::VerticesHelper::circularVertices( get(eMinR), get(eMaxR), get(eAveragePhi), get(eHalfPhiSector), lseg); diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index a42b4dfd44b..ad56257559a 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -62,12 +62,6 @@ Vector2 RectangleBounds::closestPoint( lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } -bool RectangleBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - return detail::insideAlignedBox(m_min, m_max, boundaryTolerance, lposition, - std::nullopt); -} - std::vector RectangleBounds::vertices(unsigned int /*lseg*/) const { // counter-clockwise starting from bottom-left corner return {m_min, {m_max.x(), m_min.y()}, m_max, {m_min.x(), m_max.y()}}; diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 52a86f01a0e..33ae51d6a4a 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -86,50 +86,6 @@ Vector2 TrapezoidBounds::closestPoint( lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } -bool TrapezoidBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - if (boundaryTolerance.isInfinite()) { - return true; - } - - const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); - const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); - const double hlY = get(TrapezoidBounds::eHalfLengthY); - const double rotAngle = get(TrapezoidBounds::eRotationAngle); - - const Vector2 extPosition = Eigen::Rotation2Dd(rotAngle) * lposition; - const double x = extPosition[0]; - const double y = extPosition[1]; - - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(true); - absoluteBound.has_value()) { - double tolX = absoluteBound->tolerance0; - double tolY = absoluteBound->tolerance1; - - if (std::abs(y) - hlY > tolY) { - // outside y range - return false; - } - - if (std::abs(x) - std::max(hlXnY, hlXpY) > tolX) { - // outside x range - return false; - } - - if (std::abs(x) - std::min(hlXnY, hlXpY) <= tolX) { - // inside x range - return true; - } - } - - // at this stage, the point can only be in the triangles - // run slow-ish polygon check - Vector2 vertices[] = { - {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; - return detail::insidePolygon(vertices, boundaryTolerance, extPosition, - std::nullopt); -} - std::vector TrapezoidBounds::vertices( unsigned int /*ignoredSegments*/) const { const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); From 890b4721be183ea11c4833f3dd98c92113181143 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 14:12:01 +0100 Subject: [PATCH 19/33] remove bounds check helpers --- .../Acts/Surfaces/ConvexPolygonBounds.ipp | 5 +- .../Surfaces/detail/BoundaryCheckHelper.hpp | 130 ------------- .../Acts/Surfaces/detail/VerticesHelper.hpp | 25 +++ Core/src/Surfaces/ConeBounds.cpp | 16 +- Core/src/Surfaces/ConvexPolygonBounds.cpp | 6 +- Core/src/Surfaces/CylinderBounds.cpp | 12 +- Core/src/Surfaces/DiamondBounds.cpp | 4 +- Core/src/Surfaces/DiscTrapezoidBounds.cpp | 6 +- Core/src/Surfaces/LineBounds.cpp | 9 +- Core/src/Surfaces/RadialBounds.cpp | 11 +- Core/src/Surfaces/RectangleBounds.cpp | 6 +- Core/src/Surfaces/TrapezoidBounds.cpp | 5 +- .../Benchmarks/BoundaryToleranceBenchmark.cpp | 43 ++--- .../Core/Surfaces/BoundaryToleranceTests.cpp | 175 +++++++----------- .../Core/Surfaces/TrapezoidBoundsTests.cpp | 22 +-- 15 files changed, 140 insertions(+), 335 deletions(-) delete mode 100644 Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 7559ebb2796..a5bd108b0be 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -6,7 +6,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/ThrowAssert.hpp" namespace Acts { @@ -96,8 +96,7 @@ ConvexPolygonBounds::ConvexPolygonBounds(const value_array& values) noexcept( template bool ConvexPolygonBounds::inside(const Vector2& lposition) const { - return detail::insidePolygon(m_vertices, BoundaryTolerance::None(), lposition, - std::nullopt); + return detail::VerticesHelper::isInsidePolygon(lposition, m_vertices); } template diff --git a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp b/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp deleted file mode 100644 index 10bff2b129e..00000000000 --- a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#pragma once - -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/VerticesHelper.hpp" - -#include - -namespace Acts::detail { - -inline Vector2 computeClosestPointOnAlignedBox( - const Vector2& lowerLeft, const Vector2& upperRight, const Vector2& point, - const std::optional& metricOpt) { - Vector2 closestPoint; - - if (!metricOpt.has_value()) { - closestPoint = - detail::VerticesHelper::computeEuclideanClosestPointOnRectangle( - point, lowerLeft, upperRight); - } else { - // TODO there might be a more optimal way to compute the closest point to a - // box with metric - - std::array vertices = {{lowerLeft, - {upperRight[0], lowerLeft[1]}, - upperRight, - {lowerLeft[0], upperRight[1]}}}; - - closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( - point, vertices, *metricOpt); - } - - return closestPoint; -} - -/// Check if a point is inside a box. -/// -/// @param lowerLeft The lower left corner of the box. -/// @param upperRight The upper right corner of the box. -/// @param tolerance The tolerance to use. -/// @param point The point to check. -/// @param jacobianOpt The Jacobian to transform the distance to Cartesian -/// -/// @return True if the point is inside the box. -inline bool insideAlignedBox(const Vector2& lowerLeft, - const Vector2& upperRight, - const BoundaryTolerance& tolerance, - const Vector2& point, - const std::optional& jacobianOpt) { - if (tolerance.isInfinite()) { - return true; - } - - if (detail::VerticesHelper::isInsideRectangle(point, lowerLeft, upperRight)) { - return true; - } - - if (!tolerance.hasTolerance()) { - return false; - } - - std::optional metricOpt = - tolerance.hasMetric(jacobianOpt.has_value()) - ? std::optional(tolerance.getMetric(jacobianOpt)) - : std::nullopt; - - Vector2 closestPoint = - computeClosestPointOnAlignedBox(lowerLeft, upperRight, point, metricOpt); - - Vector2 distance = closestPoint - point; - - return tolerance.isTolerated(distance, jacobianOpt); -} - -/// Check if a point is inside a polygon. -/// -/// @param vertices The vertices of the polygon. -/// @param tolerance The tolerance to use. -/// @param point The point to check. -/// @param jacobianOpt The Jacobian to transform the distance to Cartesian -/// -/// @return True if the point is inside the polygon. -inline bool insidePolygon(std::span vertices, - const BoundaryTolerance& tolerance, - const Vector2& point, - const std::optional& jacobianOpt) { - if (tolerance.isInfinite()) { - // The null boundary check always succeeds - return true; - } - - if (detail::VerticesHelper::isInsidePolygon(point, vertices)) { - // If the point falls inside the polygon, the check always succeeds - return true; - } - - if (!tolerance.hasTolerance()) { - // Outside of the polygon, since we've eliminated the case of an absence of - // check above, we know we'll always fail if the tolerance is zero. - // - // This allows us to avoid the expensive computeClosestPointOnPolygon - // computation in this simple case. - return false; - } - - // TODO: When tolerance is not 0, we could also avoid this computation in - // some cases by testing against a bounding box of the polygon, padded - // on each side with our tolerance. Check if this optimization is - // worthwhile in some production workflows, and if so implement it. - - SquareMatrix2 metric = tolerance.getMetric(jacobianOpt); - - // We are outside of the polygon, but there is a tolerance. Must find what - // the closest point on the polygon is and check if it's within tolerance. - auto closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( - point, vertices, metric); - - Vector2 distance = closestPoint - point; - - return tolerance.isTolerated(distance, jacobianOpt); -} - -} // namespace Acts::detail diff --git a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp index 24373a59c5c..392641a4573 100644 --- a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp @@ -297,4 +297,29 @@ inline Vector2 computeEuclideanClosestPointOnRectangle( } } +inline Vector2 computeClosestPointOnAlignedBox( + const Vector2& lowerLeft, const Vector2& upperRight, const Vector2& point, + const std::optional& metricOpt) { + Vector2 closestPoint; + + if (!metricOpt.has_value()) { + closestPoint = + detail::VerticesHelper::computeEuclideanClosestPointOnRectangle( + point, lowerLeft, upperRight); + } else { + // TODO there might be a more optimal way to compute the closest point to a + // box with metric + + std::array vertices = {{lowerLeft, + {upperRight[0], lowerLeft[1]}, + upperRight, + {lowerLeft[0], upperRight[1]}}}; + + closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( + point, vertices, *metricOpt); + } + + return closestPoint; +} + } // namespace Acts::detail::VerticesHelper diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index a95435fd58b..a606d995314 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -8,8 +8,8 @@ #include "Acts/Surfaces/ConeBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Definitions/Tolerance.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/detail/periodic.hpp" #include @@ -74,18 +74,18 @@ Vector2 ConeBounds::shifted(const Vector2& lposition) const { bool ConeBounds::inside(const Vector2& lposition) const { auto rphiHalf = r(lposition[1]) * get(eHalfPhiSector); - return detail::insideAlignedBox( - Vector2(-rphiHalf, get(eMinZ)), Vector2(rphiHalf, get(eMaxZ)), - BoundaryTolerance::None(), shifted(lposition), std::nullopt); + return detail::VerticesHelper::isInsideRectangle( + shifted(lposition), Vector2(-rphiHalf, get(eMinZ)), + Vector2(rphiHalf, get(eMaxZ))); } Vector2 ConeBounds::closestPoint( const Vector2& lposition, const std::optional& metric) const { auto rphiHalf = r(lposition[1]) * get(eHalfPhiSector); - return detail::computeClosestPointOnAlignedBox(Vector2(-rphiHalf, get(eMinZ)), - Vector2(rphiHalf, get(eMaxZ)), - shifted(lposition), metric); + return detail::VerticesHelper::computeClosestPointOnAlignedBox( + Vector2(-rphiHalf, get(eMinZ)), Vector2(rphiHalf, get(eMaxZ)), + shifted(lposition), metric); } std::ostream& ConeBounds::toStream(std::ostream& sl) const { diff --git a/Core/src/Surfaces/ConvexPolygonBounds.cpp b/Core/src/Surfaces/ConvexPolygonBounds.cpp index 6d3420b2cca..45116922d64 100644 --- a/Core/src/Surfaces/ConvexPolygonBounds.cpp +++ b/Core/src/Surfaces/ConvexPolygonBounds.cpp @@ -9,8 +9,7 @@ #include "Acts/Surfaces/ConvexPolygonBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -47,8 +46,7 @@ ConvexPolygonBounds::ConvexPolygonBounds( bool ConvexPolygonBounds::inside( const Vector2& lposition) const { - return detail::insidePolygon(m_vertices, BoundaryTolerance::None(), lposition, - std::nullopt); + return detail::VerticesHelper::isInsidePolygon(lposition, m_vertices); } Vector2 ConvexPolygonBounds::closestPoint( diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index ed6a39535d3..c01de5d3a11 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -8,8 +8,6 @@ #include "Acts/Surfaces/CylinderBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -43,10 +41,9 @@ bool CylinderBounds::inside(const Vector2& lposition) const { double halfPhi = get(eHalfPhiSector); if (bevelMinZ == 0. || bevelMaxZ == 0.) { - return detail::insideAlignedBox( - Vector2(-halfPhi, -halfLengthZ), Vector2(halfPhi, halfLengthZ), - BoundaryTolerance::None(), shifted(lposition), - boundToCartesianJacobian(lposition)); + return detail::VerticesHelper::isInsideRectangle( + shifted(lposition), Vector2(-halfPhi, -halfLengthZ), + Vector2(halfPhi, halfLengthZ)); } double radius = get(eR); @@ -79,8 +76,7 @@ bool CylinderBounds::inside(const Vector2& lposition) const { Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, upperRight, middleRight, lowerRight}; - return detail::insidePolygon(vertices, BoundaryTolerance::None(), lposition, - boundToCartesianJacobian(lposition)); + return detail::VerticesHelper::isInsidePolygon(lposition, vertices); } Vector2 CylinderBounds::closestPoint( diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index 5a6338a6c28..4a54411713b 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -9,7 +9,6 @@ #include "Acts/Surfaces/DiamondBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include @@ -44,8 +43,7 @@ bool DiamondBounds::inside(const Vector2& lposition) const { double y3 = get(DiamondBounds::eHalfLengthYpos); Vector2 vertices[] = {{-x1, -y1}, {x1, -y1}, {x2, y2}, {x3, y3}, {-x3, y3}, {-x2, y2}}; - return detail::insidePolygon(vertices, BoundaryTolerance::None(), lposition, - std::nullopt); + return detail::VerticesHelper::isInsidePolygon(lposition, vertices); } Vector2 DiamondBounds::closestPoint( diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index 76cf1cfc4f5..392d06288d3 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -9,7 +9,7 @@ #include "Acts/Surfaces/DiscTrapezoidBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/detail/periodic.hpp" #include @@ -86,8 +86,8 @@ bool DiscTrapezoidBounds::inside(const Vector2& lposition) const { {get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXminR), get(eMinR)}}; - return detail::insidePolygon(vertices, BoundaryTolerance::None(), - toLocalCartesian(lposition), std::nullopt); + return detail::VerticesHelper::isInsidePolygon(toLocalCartesian(lposition), + vertices); } Vector2 DiscTrapezoidBounds::closestPoint( diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index bf7a056b8ed..8369cb1af1d 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -8,7 +8,7 @@ #include "Acts/Surfaces/LineBounds.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -31,9 +31,8 @@ void LineBounds::checkConsistency() noexcept(false) { bool LineBounds::inside(const Vector2& lposition) const { double r = get(LineBounds::eR); double halfLengthZ = get(LineBounds::eHalfLengthZ); - return detail::insideAlignedBox( - Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ), - BoundaryTolerance::None(), lposition, std::nullopt); + return detail::VerticesHelper::isInsideRectangle( + lposition, Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ)); } Vector2 LineBounds::closestPoint( @@ -41,7 +40,7 @@ Vector2 LineBounds::closestPoint( const std::optional& metric) const { double r = get(LineBounds::eR); double halfLengthZ = get(LineBounds::eHalfLengthZ); - return detail::computeClosestPointOnAlignedBox( + return detail::VerticesHelper::computeClosestPointOnAlignedBox( Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ), lposition, metric); } diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index bfa47388b19..917723373d8 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -8,8 +8,6 @@ #include "Acts/Surfaces/RadialBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -73,16 +71,15 @@ Vector2 RadialBounds::shifted(const Vector2& lposition) const { } bool RadialBounds::inside(const Vector2& lposition) const { - return detail::insideAlignedBox(Vector2(get(eMinR), -get(eHalfPhiSector)), - Vector2(get(eMaxR), get(eHalfPhiSector)), - BoundaryTolerance::None(), shifted(lposition), - std::nullopt); + return detail::VerticesHelper::isInsideRectangle( + shifted(lposition), Vector2(get(eMinR), -get(eHalfPhiSector)), + Vector2(get(eMaxR), get(eHalfPhiSector))); } Vector2 RadialBounds::closestPoint( const Vector2& lposition, const std::optional& metric) const { - return detail::computeClosestPointOnAlignedBox( + return detail::VerticesHelper::computeClosestPointOnAlignedBox( Vector2(get(eMinR), -get(eHalfPhiSector)), Vector2(get(eMaxR), get(eHalfPhiSector)), shifted(lposition), metric); } diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index ad56257559a..1fcf5ba5b33 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -9,8 +9,7 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -48,8 +47,7 @@ void RectangleBounds::checkConsistency() noexcept(false) { } bool RectangleBounds::inside(const Vector2& lposition) const { - return detail::insideAlignedBox(m_min, m_max, BoundaryTolerance::None(), - lposition, std::nullopt); + return detail::VerticesHelper::isInsideRectangle(lposition, m_min, m_max); } Vector2 RectangleBounds::closestPoint( diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 33ae51d6a4a..71a7ced6c7c 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -8,9 +8,7 @@ #include "Acts/Surfaces/TrapezoidBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/ConvexPolygonBounds.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include #include @@ -68,8 +66,7 @@ bool TrapezoidBounds::inside(const Vector2& lposition) const { // run slow-ish polygon check Vector2 vertices[] = { {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; - return detail::insidePolygon(vertices, BoundaryTolerance::None(), extPosition, - std::nullopt); + return detail::VerticesHelper::isInsidePolygon(extPosition, vertices); } Vector2 TrapezoidBounds::closestPoint( diff --git a/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp b/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp index f18a32070be..2c1c384cc65 100644 --- a/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp +++ b/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp @@ -7,16 +7,12 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Units.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/ConvexPolygonBounds.hpp" #include "Acts/Tests/CommonHelpers/BenchmarkTools.hpp" #include -#include -#include #include -#include #include #include @@ -26,7 +22,8 @@ int main(int /*argc*/, char** /*argv[]*/) { // === PROBLEM DATA === // Trapezoidal area of interest - const Vector2 poly[] = {{0.4, 0.25}, {0.6, 0.25}, {0.8, 0.75}, {0.2, 0.75}}; + ConvexPolygonBounds poly( + {{0.4, 0.25}, {0.6, 0.25}, {0.8, 0.75}, {0.2, 0.75}}); // Covariance matrix which specifies "soft" boundary check tolerance SquareMatrix2 cov; @@ -107,35 +104,21 @@ int main(int /*argc*/, char** /*argv[]*/) { default: // do nothing break; }; - run_bench( - [&] { - return detail::insidePolygon(poly, check, center, std::nullopt); - }, - num_inside_points, "Center"); - run_bench( - [&] { - return detail::insidePolygon(poly, check, edge_inside, std::nullopt); - }, - num_inside_points, "Inside edge"); - run_bench( - [&] { - return detail::insidePolygon(poly, check, edge_outside, std::nullopt); - }, - num_outside_points, "Outside edge"); - run_bench( - [&] { - return detail::insidePolygon(poly, check, far_away, std::nullopt); - }, - num_outside_points, "Far away"); + run_bench([&] { return poly.inside(center, check); }, num_inside_points, + "Center"); + run_bench([&] { return poly.inside(edge_inside, check); }, + num_inside_points, "Inside edge"); + run_bench([&] { return poly.inside(edge_outside, check); }, + num_outside_points, "Outside edge"); + run_bench([&] { return poly.inside(far_away, check); }, num_outside_points, + "Far away"); // Pre-rolled random points std::vector points(num_outside_points); std::generate(points.begin(), points.end(), random_point); run_bench_with_inputs( - [&](const auto& point) { - return detail::insidePolygon(poly, check, point, std::nullopt); - }, - points, "Random"); + [&](const auto& point) { return poly.inside(point, check); }, points, + "Random"); }; // Benchmark scenarios diff --git a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp index edc401e9b83..42559b215de 100644 --- a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp @@ -11,13 +11,10 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" -#include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" +#include "Acts/Surfaces/ConvexPolygonBounds.hpp" +#include "Acts/Surfaces/PlanarBounds.hpp" -#include -#include #include -#include #include namespace Acts::Test { @@ -30,15 +27,12 @@ BOOST_AUTO_TEST_SUITE(Surfaces) BOOST_AUTO_TEST_CASE(BoundaryCheckBoxSimple) { Vector2 ll(-1, -1); Vector2 ur(1, 1); + RectangleBounds bounds(ll, ur); auto tolerance = BoundaryTolerance::None(); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } // Aligned box w/ tolerance check along first axis @@ -49,18 +43,14 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckBoxToleranceLoc0) { em.execute([]() { Vector2 ll(-1, -1); Vector2 ur(1, 1); - auto tolerance = BoundaryTolerance::AbsoluteBound( + RectangleBounds bounds(ll, ur); + BoundaryTolerance::AbsoluteBound tolerance( 1.5, std::numeric_limits::infinity()); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {4, 4}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({4, 4}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); return 0; }); @@ -72,134 +62,97 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckBoxCovariance) { cov << 1, 0.5, 0.5, 2; Vector2 ll(-1, -1); Vector2 ur(1, 1); + RectangleBounds bounds(ll, ur); auto tolerance = BoundaryTolerance::Chi2Bound(cov.inverse(), 3.); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {4, 4}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 3}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {3, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({4, 4}, tolerance)); + BOOST_CHECK(bounds.inside({0, 3}, tolerance)); + BOOST_CHECK(bounds.inside({3, 0}, tolerance)); } // Triangle w/ simple check BOOST_AUTO_TEST_CASE(BoundaryCheckTriangleSimple) { - Vector2 vertices[] = {{-2, 0}, {2, 0}, {0, 2}}; + ConvexPolygonBounds poly({{-2, 0}, {2, 0}, {0, 2}}); auto tolerance = BoundaryTolerance::None(); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 1}, std::nullopt)); - BOOST_CHECK( - !detail::insidePolygon(vertices, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insidePolygon(vertices, tolerance, {0, -1}, std::nullopt)); + BOOST_CHECK(poly.inside({0, 0}, tolerance)); + BOOST_CHECK(poly.inside({0, 1}, tolerance)); + BOOST_CHECK(!poly.inside({2, 2}, tolerance)); + BOOST_CHECK(!poly.inside({0, -1}, tolerance)); } // Triangle w/ covariance check BOOST_AUTO_TEST_CASE(BoundaryCheckTriangleCovariance) { - Vector2 vertices[] = {{-2, 0}, {2, 0}, {0, 2}}; + ConvexPolygonBounds poly({{-2, 0}, {2, 0}, {0, 2}}); SquareMatrix2 cov; cov << 0.5, 0, 0, 0.5; auto tolerance = BoundaryTolerance::Chi2Bound(cov.inverse(), 4.1); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 1}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 3}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 4}, std::nullopt)); - BOOST_CHECK( - !detail::insidePolygon(vertices, tolerance, {0, 5}, std::nullopt)); + BOOST_CHECK(poly.inside({0, 0}, tolerance)); + BOOST_CHECK(poly.inside({0, 1}, tolerance)); + BOOST_CHECK(poly.inside({0, 2}, tolerance)); + BOOST_CHECK(poly.inside({0, 3}, tolerance)); + BOOST_CHECK(poly.inside({0, 4}, tolerance)); + BOOST_CHECK(!poly.inside({0, 5}, tolerance)); } BOOST_AUTO_TEST_CASE(BoundaryCheckDifferentTolerances) { Vector2 ll(-1, -1); Vector2 ur(1, 1); + RectangleBounds bounds(ll, ur); { auto tolerance = BoundaryTolerance::None(); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::Infinite(); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::AbsoluteBound(0.5, 0.5); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({0, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::AbsoluteCartesian(0.5, 0.5); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({0, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::AbsoluteEuclidean(1.1); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 1.); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {3, 3}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({3, 3}, tolerance)); } } diff --git a/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp index 52155fec5fe..de1f3b55d33 100644 --- a/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp @@ -15,11 +15,10 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include -#include #include #include #include @@ -128,7 +127,6 @@ BOOST_AUTO_TEST_CASE(TrapezoidBoundsProperties) { !trapezoidBoundsObject.inside(outside, BoundaryTolerance::None())); const auto vertices = trapezoidBoundsObject.vertices(); - BoundaryTolerance tolerance = BoundaryTolerance::None(); std::vector testPoints = { // inside @@ -165,8 +163,8 @@ BOOST_AUTO_TEST_CASE(TrapezoidBoundsProperties) { for (const auto& p : testPoints) { BOOST_TEST_CONTEXT("p=" << p.transpose()) { BOOST_CHECK_EQUAL( - detail::insidePolygon(vertices, tolerance, p, std::nullopt), - trapezoidBoundsObject.inside(p, tolerance)); + detail::VerticesHelper::isInsidePolygon(p, vertices), + trapezoidBoundsObject.inside(p, BoundaryTolerance::None())); } } } @@ -179,22 +177,16 @@ BOOST_DATA_TEST_CASE( bdata::random((bdata::engine = std::mt19937(), bdata::seed = 22, bdata::distribution = std::uniform_real_distribution(-3, 3))) ^ - bdata::xrange(1000) * bdata::make({0., 0.1, 0.2, 0.3}), - x, y, index, tol) { + bdata::xrange(1000), + x, y, index) { (void)index; static const TrapezoidBounds trapezoidBoundsObject(minHalfX, maxHalfX, halfY); static const auto vertices = trapezoidBoundsObject.vertices(); - BoundaryTolerance tolerance = BoundaryTolerance::None(); - - if (tol != 0.) { - tolerance = BoundaryTolerance::AbsoluteBound{tol, tol}; - } - BOOST_CHECK_EQUAL( - detail::insidePolygon(vertices, tolerance, {x, y}, std::nullopt), - trapezoidBoundsObject.inside({x, y}, tolerance)); + detail::VerticesHelper::isInsidePolygon(Vector2{x, y}, vertices), + trapezoidBoundsObject.inside({x, y}, BoundaryTolerance::None())); } /// Unit test for testing TrapezoidBounds assignment From b9e21685466ac0105d01a538932ba3b339604b97 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 14:55:23 +0100 Subject: [PATCH 20/33] doc --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 12 +++-- .../Acts/Surfaces/BoundaryTolerance.hpp | 6 --- Core/include/Acts/Surfaces/ConeBounds.hpp | 12 +++-- .../Acts/Surfaces/ConvexPolygonBounds.hpp | 5 +- Core/include/Acts/Surfaces/CylinderBounds.hpp | 8 +++- Core/include/Acts/Surfaces/DiamondBounds.hpp | 3 ++ .../Acts/Surfaces/DiscTrapezoidBounds.hpp | 8 +++- Core/include/Acts/Surfaces/EllipseBounds.hpp | 3 ++ Core/include/Acts/Surfaces/InfiniteBounds.hpp | 9 ++++ Core/include/Acts/Surfaces/LineBounds.hpp | 8 +++- Core/include/Acts/Surfaces/PlanarBounds.hpp | 5 +- Core/include/Acts/Surfaces/RadialBounds.hpp | 10 +++- .../include/Acts/Surfaces/RectangleBounds.hpp | 4 ++ Core/include/Acts/Surfaces/SurfaceBounds.hpp | 47 +++++++++++++------ .../include/Acts/Surfaces/TrapezoidBounds.hpp | 5 ++ .../Acts/Surfaces/detail/VerticesHelper.hpp | 1 + Core/src/Surfaces/BoundaryTolerance.cpp | 20 -------- 17 files changed, 109 insertions(+), 57 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 183875e5bd8..b89c14087d9 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -65,32 +65,34 @@ class AnnulusBounds : public DiscBounds { /// @param values The parameter array AnnulusBounds(const std::array& values) noexcept(false); - AnnulusBounds(const AnnulusBounds& source) = default; - - BoundsType type() const final { return SurfaceBounds::eAnnulus; } + BoundsType type() const final { return eAnnulus; } + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return false; } + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; using SurfaceBounds::inside; /// Outstream operator - /// /// @param sl is the ostream to be dumped into std::ostream& toStream(std::ostream& sl) const final; diff --git a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp index bc852d1e3ef..301ddfcd9b3 100644 --- a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp +++ b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp @@ -167,12 +167,6 @@ class BoundaryTolerance { bool isTolerated(const Vector2& distance, const std::optional& jacobianOpt) const; - /// Check if there is a metric assigned with this tolerance. - bool hasMetric(bool hasJacobian) const; - - /// Get the metric for the tolerance. - SquareMatrix2 getMetric(const std::optional& jacobian) const; - private: Variant m_variant; diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 69b3c2fc559..9588dff0823 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -70,39 +70,43 @@ class ConeBounds : public SurfaceBounds { /// @param values The parameter array ConeBounds(const std::array& values) noexcept(false); + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eCone; } + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return true; } + /// @copydoc SurfaceBounds::isCylindrical SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::isCylindrical SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::isCylindrical SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } - /// Return the bound values as dynamically sized vector - /// - /// @return this returns a copy of the internal values + /// @copydoc SurfaceBounds::values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::inside Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; using SurfaceBounds::inside; /// Output Method for std::ostream - /// /// @param sl is the ostrea into which the dump is done /// @return is the input object std::ostream& toStream(std::ostream& sl) const final; diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index 47c10d6c202..49c75d0cc59 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -38,7 +38,6 @@ class ConvexPolygonBoundsBase : public PlanarBounds { BoundsType type() const final { return eConvexPolygon; } /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; @@ -98,8 +97,10 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// @param values The values to build up the vertices ConvexPolygonBounds(const value_array& values) noexcept(false); + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; @@ -144,8 +145,10 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// @param vertices The list of vertices. ConvexPolygonBounds(const std::vector& vertices); + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index b27f531e8da..8e806813ced 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -83,32 +83,38 @@ class CylinderBounds : public SurfaceBounds { checkConsistency(); } + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eCylinder; } + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return true; } + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index 87c7ba9fd42..35923e934b5 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -65,6 +65,7 @@ class DiamondBounds : public PlanarBounds { Vector2{*std::max_element(values.begin(), values.begin() + 2), values[eHalfLengthYpos]}) {} + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eDiamond; } /// Return the bound values as dynamically sized vector @@ -72,8 +73,10 @@ class DiamondBounds : public PlanarBounds { /// @return this returns a copy of the internal values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index aa9f5bbf7cb..6c9ef7478e1 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -59,23 +59,29 @@ class DiscTrapezoidBounds : public DiscBounds { checkConsistency(); } + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eDiscTrapezoid; } + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return false; } + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index 481d6c0235e..9cd29c53bf9 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -65,6 +65,7 @@ class EllipseBounds : public PlanarBounds { checkConsistency(); } + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eEllipse; } /// Return the bound values as dynamically sized vector @@ -72,8 +73,10 @@ class EllipseBounds : public PlanarBounds { /// @return this returns a copy of the internal values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 91808ac4344..984d88d9e80 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -21,38 +21,47 @@ namespace Acts { /// class InfiniteBounds : public SurfaceBounds { public: + /// @copydoc SurfaceBounds::type SurfaceBounds::BoundsType type() const final { return eBoundless; } + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return true; } + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::values std::vector values() const final { return {}; } + /// @copydoc SurfaceBounds::inside(const Vector2&) bool inside(const Vector2& lposition) const final { (void)lposition; return true; } + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final { (void)metric; return lposition; } + /// @copydoc SurfaceBounds::inside(const Vector2&, const BoundaryTolerance&) bool inside(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const final { (void)lposition; diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index 45e8113d6ea..2256f8e4f80 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -40,32 +40,38 @@ class LineBounds : public SurfaceBounds { checkConsistency(); } + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eLine; } + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return true; } + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/PlanarBounds.hpp b/Core/include/Acts/Surfaces/PlanarBounds.hpp index b223f5f84c7..5a4dd02ed7e 100644 --- a/Core/include/Acts/Surfaces/PlanarBounds.hpp +++ b/Core/include/Acts/Surfaces/PlanarBounds.hpp @@ -36,25 +36,28 @@ class PlanarBounds : public SurfaceBounds { virtual std::vector vertices( unsigned int quarterSegments = 2u) const = 0; + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return true; } + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } /// Bounding box parameters - /// /// @return rectangle bounds for a bounding box virtual const RectangleBounds& boundingBox() const = 0; }; diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index 5bc37cae9ee..42bb9945540 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -55,23 +55,29 @@ class RadialBounds : public DiscBounds { checkConsistency(); } - SurfaceBounds::BoundsType type() const final { return SurfaceBounds::eDisc; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eDisc; } + /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return false; } + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index 50e8ecb2963..289322063e3 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -62,12 +62,16 @@ class RectangleBounds : public PlanarBounds { checkConsistency(); } + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eRectangle; } + /// @copydoc SurfaceBounds::values std::vector values() const final; + /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index b53a196b702..fef37c4a50b 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -51,33 +51,53 @@ class SurfaceBounds { virtual ~SurfaceBounds() = default; /// Return the bounds type - for persistency optimization - /// - /// @return is a BoundsType enum + /// @return the bounds type virtual BoundsType type() const = 0; + /// Check if the bound coordinates are cartesian + /// @return true if the bound coordinates are cartesian virtual bool isCartesian() const = 0; + /// Computes the bound to cartesian jacobian at a given local position + /// @param lposition is the local position at which the jacobian is computed + /// @return the bound to cartesian jacobian virtual SquareMatrix2 boundToCartesianJacobian( const Vector2& lposition) const = 0; + /// Computes the cartesian to bound jacobian at a given local position + /// @param lposition is the local position at which the jacobian is computed + /// @return the cartesian to bound jacobian virtual SquareMatrix2 cartesianToBoundJacobian( const Vector2& lposition) const = 0; + /// Computes the bound to cartesian metric at a given local position + /// @param lposition is the local position at which the metric is computed + /// @return the bound to cartesian metric virtual SquareMatrix2 boundToCartesianMetric( const Vector2& lposition) const = 0; /// Access method for bound values, this is a dynamically sized /// vector containing the parameters needed to describe these bounds - /// /// @return of the stored values for this SurfaceBounds object virtual std::vector values() const = 0; + /// Inside check for the bounds object + /// @param lposition is the local position + /// @return true if the local position is inside the bounds virtual bool inside(const Vector2& lposition) const = 0; + /// Calculates the closest point on the bounds to a given local position + /// @param lposition is the local position + /// @param metric is the metric to be used for the distance calculation + /// @return the closest point on the bounds virtual Vector2 closestPoint( const Vector2& lposition, const std::optional& metric) const = 0; + /// Calculates the distance to the bounds from a given local position + /// @param lposition is the local position + /// @param metric is the metric to be used for the distance calculation + /// @return the distance to the bounds virtual double distance(const Vector2& lposition, const std::optional& metric) const { Vector2 closest = closestPoint(lposition, metric); @@ -86,13 +106,10 @@ class SurfaceBounds { metric.value_or(SquareMatrix2::Identity()) * diff)(0, 0)); } - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation + /// Inside check for the bounds object given a boundary tolerance. + /// @param lposition is the local position + /// @param boundaryTolerance is the boundary tolerance object + /// @return true if the local position is inside the bounds and tolerance virtual bool inside(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const { using enum BoundaryTolerance::ToleranceMode; @@ -101,14 +118,15 @@ class SurfaceBounds { return true; } - BoundaryTolerance::ToleranceMode mode = boundaryTolerance.toleranceMode(); + BoundaryTolerance::ToleranceMode toleranceMode = + boundaryTolerance.toleranceMode(); bool strictlyInside = inside(lposition); - if (mode == None) { + if (toleranceMode == None) { return strictlyInside; } - if (mode == Extend && strictlyInside) { + if (toleranceMode == Extend && strictlyInside) { return true; } @@ -126,7 +144,7 @@ class SurfaceBounds { Vector2 closest = closestPoint(lposition, metric); Vector2 distance = closest - lposition; - if (mode == Shrink) { + if (toleranceMode == Shrink) { return boundaryTolerance.isTolerated(distance, jacobian) && strictlyInside; } @@ -134,7 +152,6 @@ class SurfaceBounds { } /// Output Method for std::ostream, to be overloaded by child classes - /// /// @param os is the outstream in which the string dump is done virtual std::ostream& toStream(std::ostream& os) const = 0; diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index 509ef301e86..e6de3a4d1e7 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -50,10 +50,14 @@ class TrapezoidBounds : public PlanarBounds { /// @param values the values to be stream in TrapezoidBounds(const std::array& values) noexcept(false); + /// @copydoc SurfaceBounds::type BoundsType type() const final { return eTrapezoid; } + /// @copydoc SurfaceBounds::values std::vector values() const final; + /// @copydoc SurfaceBounds::inside + /// /// The orientation of the Trapezoid is according to the figure above, /// in words: the shorter of the two parallel sides of the trapezoid /// intersects @@ -96,6 +100,7 @@ class TrapezoidBounds : public PlanarBounds { /// @return boolean indicator for the success of this operation bool inside(const Vector2& lposition) const final; + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp index 392641a4573..30cf0c27244 100644 --- a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/Core/src/Surfaces/BoundaryTolerance.cpp b/Core/src/Surfaces/BoundaryTolerance.cpp index 971a026d7de..7da4962226e 100644 --- a/Core/src/Surfaces/BoundaryTolerance.cpp +++ b/Core/src/Surfaces/BoundaryTolerance.cpp @@ -205,24 +205,4 @@ bool BoundaryTolerance::isTolerated( throw std::logic_error("Unsupported tolerance type"); } -bool BoundaryTolerance::hasMetric(bool hasJacobian) const { - return hasJacobian || hasChi2Bound(); -} - -SquareMatrix2 BoundaryTolerance::getMetric( - const std::optional& jacobianOpt) const { - bool isCartesian = !jacobianOpt.has_value(); - SquareMatrix2 metric = SquareMatrix2::Identity(); - - if (const auto* chi2Bound = getVariantPtr(); - chi2Bound != nullptr) { - metric = chi2Bound->weight; - } else if (!isCartesian) { - const auto& jacobian = *jacobianOpt; - metric = jacobian.transpose() * jacobian; - } - - return metric; -} - } // namespace Acts From cf9a545c50e8c2a1cd1a8a4cd412f5661aa9a09b Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 14:59:41 +0100 Subject: [PATCH 21/33] rename tolerance mode --- Core/include/Acts/Surfaces/BoundaryTolerance.hpp | 12 ++++++------ Core/include/Acts/Surfaces/SurfaceBounds.hpp | 5 ++--- Core/src/Surfaces/BoundaryTolerance.cpp | 5 +++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp index 301ddfcd9b3..05c6489bcb9 100644 --- a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp +++ b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp @@ -108,10 +108,10 @@ class BoundaryTolerance { : maxChi2(maxChi2_), weight(weight_) {} }; - enum class ToleranceMode { - Extend, // Extend the boundary - None, // No tolerance - Shrink // Shrink the boundary + enum class Mode { + Extend, //< Extend the boundary + None, //< No tolerance + Shrink //< Shrink the boundary }; /// Underlying variant type @@ -147,8 +147,8 @@ class BoundaryTolerance { /// Check if the tolerance is chi2 with bound coordinates. bool hasChi2Bound() const; - /// Check if any tolerance is set. - ToleranceMode toleranceMode() const; + /// Get the tolerance mode. + Mode mode() const; /// Get the tolerance as absolute bound. AbsoluteBound asAbsoluteBound(bool isCartesian = false) const; diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index fef37c4a50b..1176c5234ff 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -112,14 +112,13 @@ class SurfaceBounds { /// @return true if the local position is inside the bounds and tolerance virtual bool inside(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const { - using enum BoundaryTolerance::ToleranceMode; + using enum BoundaryTolerance::Mode; if (boundaryTolerance.isInfinite()) { return true; } - BoundaryTolerance::ToleranceMode toleranceMode = - boundaryTolerance.toleranceMode(); + BoundaryTolerance::Mode toleranceMode = boundaryTolerance.mode(); bool strictlyInside = inside(lposition); if (toleranceMode == None) { diff --git a/Core/src/Surfaces/BoundaryTolerance.cpp b/Core/src/Surfaces/BoundaryTolerance.cpp index 7da4962226e..5bb54cabe41 100644 --- a/Core/src/Surfaces/BoundaryTolerance.cpp +++ b/Core/src/Surfaces/BoundaryTolerance.cpp @@ -60,8 +60,9 @@ bool BoundaryTolerance::hasChi2Bound() const { return holdsVariant(); } -BoundaryTolerance::ToleranceMode BoundaryTolerance::toleranceMode() const { - using enum ToleranceMode; +BoundaryTolerance::Mode BoundaryTolerance::mode() const { + using enum Mode; + if (isInfinite()) { return Extend; } From ef18a08229a2f42c9560a1255539891f867fed7f Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 15:02:09 +0100 Subject: [PATCH 22/33] fix doc --- Core/include/Acts/Surfaces/ConeBounds.hpp | 6 +++--- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 4 ++-- Core/include/Acts/Surfaces/TrapezoidBounds.hpp | 4 ---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 9588dff0823..0b1d3367ad6 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -76,19 +76,19 @@ class ConeBounds : public SurfaceBounds { /// @copydoc SurfaceBounds::isCartesian bool isCartesian() const final { return true; } - /// @copydoc SurfaceBounds::isCylindrical + /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } - /// @copydoc SurfaceBounds::isCylindrical + /// @copydoc SurfaceBounds::cartesianToBoundJacobian SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); } - /// @copydoc SurfaceBounds::isCylindrical + /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 984d88d9e80..8ddfca818da 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -48,7 +48,7 @@ class InfiniteBounds : public SurfaceBounds { /// @copydoc SurfaceBounds::values std::vector values() const final { return {}; } - /// @copydoc SurfaceBounds::inside(const Vector2&) + /// @copydoc SurfaceBounds::inside(const Vector2&) const bool inside(const Vector2& lposition) const final { (void)lposition; return true; @@ -61,7 +61,7 @@ class InfiniteBounds : public SurfaceBounds { return lposition; } - /// @copydoc SurfaceBounds::inside(const Vector2&, const BoundaryTolerance&) + /// @copydoc SurfaceBounds::inside(const Vector2&, const BoundaryTolerance&) const bool inside(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const final { (void)lposition; diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index e6de3a4d1e7..867cc62fa25 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -94,10 +94,6 @@ class TrapezoidBounds : public PlanarBounds { ///
/// and @f$ \delta_{I} = \delta_{II} = - \frac{1}{2}\kappa_{I}(x_{max} + /// x_{min}) @f$ - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// - /// @return boolean indicator for the success of this operation bool inside(const Vector2& lposition) const final; /// @copydoc SurfaceBounds::closestPoint From c1de29d11e740ef90be5323575437edff8beb510 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 15:05:02 +0100 Subject: [PATCH 23/33] rename tolerance mode --- .../Core/Surfaces/BoundaryToleranceTests.cpp | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp index 819a850477b..365bdb73612 100644 --- a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp @@ -15,18 +15,17 @@ #include "Acts/Surfaces/PlanarBounds.hpp" #include -#include namespace Acts::Test { BOOST_AUTO_TEST_SUITE(Surfaces) BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { - using enum BoundaryTolerance::ToleranceMode; + using enum BoundaryTolerance::Mode; { // Test None constructor BoundaryTolerance tolerance = BoundaryTolerance::None(); - BOOST_CHECK(tolerance.toleranceMode() == None); + BOOST_CHECK(tolerance.mode() == None); } // Test AbsoluteBound constructor @@ -35,9 +34,10 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { auto tolerance = BoundaryTolerance::AbsoluteBound(1.0, 2.0); BOOST_CHECK_EQUAL(tolerance.tolerance0, 1.0); BOOST_CHECK_EQUAL(tolerance.tolerance1, 2.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); - BOOST_CHECK(BoundaryTolerance{BoundaryTolerance::AbsoluteBound(0.0, 0.0)} - .toleranceMode() == None); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); + BOOST_CHECK( + BoundaryTolerance{BoundaryTolerance::AbsoluteBound(0.0, 0.0)}.mode() == + None); // Negative tolerances should throw BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteBound(-1.0, 2.0), @@ -51,14 +51,15 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { // Valid positive tolerance auto tolerance = BoundaryTolerance::AbsoluteEuclidean(1.0); BOOST_CHECK_EQUAL(tolerance.tolerance, 1.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); - BOOST_CHECK(BoundaryTolerance{BoundaryTolerance::AbsoluteEuclidean(0.0)} - .toleranceMode() == None); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); + BOOST_CHECK( + BoundaryTolerance{BoundaryTolerance::AbsoluteEuclidean(0.0)}.mode() == + None); // Valid negative tolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(-1.0); BOOST_CHECK_EQUAL(tolerance.tolerance, -1.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Shrink); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Shrink); } // Test AbsoluteCartesian constructor @@ -67,10 +68,10 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { auto tolerance = BoundaryTolerance::AbsoluteCartesian(1.0, 2.0); BOOST_CHECK_EQUAL(tolerance.tolerance0, 1.0); BOOST_CHECK_EQUAL(tolerance.tolerance1, 2.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); BOOST_CHECK( BoundaryTolerance{BoundaryTolerance::AbsoluteCartesian(0.0, 0.0)} - .toleranceMode() == None); + .mode() == None); // Negative tolerances should throw BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteCartesian(-1.0, 2.0), @@ -87,14 +88,15 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { // Valid positive chi2 bound auto tolerance = BoundaryTolerance::Chi2Bound(cov, 3.0); BOOST_CHECK_EQUAL(tolerance.maxChi2, 3.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); - BOOST_CHECK(BoundaryTolerance{BoundaryTolerance::Chi2Bound(cov, 0.0)} - .toleranceMode() == None); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); + BOOST_CHECK( + BoundaryTolerance{BoundaryTolerance::Chi2Bound(cov, 0.0)}.mode() == + None); // Valid negative chi2 bound tolerance = BoundaryTolerance::Chi2Bound(cov, -3.0); BOOST_CHECK_EQUAL(tolerance.maxChi2, -3.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Shrink); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Shrink); } // Test None constructor From 5032c8b52e1980584ae826937acc6d2122f454f1 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 15:12:22 +0100 Subject: [PATCH 24/33] simplify distance --- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 1176c5234ff..633778f7ea0 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -96,14 +96,13 @@ class SurfaceBounds { /// Calculates the distance to the bounds from a given local position /// @param lposition is the local position - /// @param metric is the metric to be used for the distance calculation /// @return the distance to the bounds - virtual double distance(const Vector2& lposition, - const std::optional& metric) const { + virtual double distance(const Vector2& lposition) const { + SquareMatrix2 metric = boundToCartesianMetric(lposition); + Vector2 closest = closestPoint(lposition, metric); Vector2 diff = closest - lposition; - return std::sqrt((diff.transpose() * - metric.value_or(SquareMatrix2::Identity()) * diff)(0, 0)); + return std::sqrt((diff.transpose() * metric * diff)(0, 0)); } /// Inside check for the bounds object given a boundary tolerance. From bf236b4166c8f7b686aaa8f073660b29eef68778 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 15:15:14 +0100 Subject: [PATCH 25/33] fix and docs --- Core/include/Acts/Surfaces/Surface.hpp | 16 +++++++++++----- Core/src/Surfaces/Surface.cpp | 6 ++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index e1e1bd3b20c..e3bcc24823e 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -250,13 +250,19 @@ class Surface : public virtual GeometryObject, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::None(), double tolerance = s_onSurfaceTolerance) const; + /// Calculates the closest point on the boundary of the surface to a given + /// point in local coordinates. + /// @param lposition The local position to check + /// @param metric The metric to use for the calculation + /// @return The closest point on the boundary of the surface virtual Vector2 closestPointOnBounds( - const Vector2& lposition, - const std::optional& metric) const; + const Vector2& lposition, std::optional& metric) const; - virtual double distanceToBounds( - const Vector2& lposition, - const std::optional& metric) const; + /// Calculates the distance to the boundary of the surface from a given point + /// in local coordinates. + /// @param lposition The local position to check + /// @return The distance to the boundary of the surface + virtual double distanceToBounds(const Vector2& lposition) const; /// The insideBounds method for local positions /// diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 5c55e2d26d5..40d770304bf 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -252,10 +252,8 @@ Vector2 Surface::closestPointOnBounds( return bounds().closestPoint(lposition, metric); } -double Surface::distanceToBounds( - const Vector2& lposition, - const std::optional& metric) const { - return bounds().distance(lposition, metric); +double Surface::distanceToBounds(const Vector2& lposition) const { + return bounds().distance(lposition); } bool Surface::insideBounds(const Vector2& lposition, From 217b13803d172c5e6e783bfcebc5a58fdc35db90 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 15:16:51 +0100 Subject: [PATCH 26/33] small fix --- Core/include/Acts/Surfaces/Surface.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index e3bcc24823e..f4778471241 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -256,7 +256,8 @@ class Surface : public virtual GeometryObject, /// @param metric The metric to use for the calculation /// @return The closest point on the boundary of the surface virtual Vector2 closestPointOnBounds( - const Vector2& lposition, std::optional& metric) const; + const Vector2& lposition, + const std::optional& metric) const; /// Calculates the distance to the boundary of the surface from a given point /// in local coordinates. From a0d665d41b49024b3138fe9cc41aaae3d865379e Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 15:35:59 +0100 Subject: [PATCH 27/33] remove cartesian to bound jacobians --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 3 --- Core/include/Acts/Surfaces/ConeBounds.hpp | 6 ------ Core/include/Acts/Surfaces/CylinderBounds.hpp | 6 ------ Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp | 3 --- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 6 ------ Core/include/Acts/Surfaces/LineBounds.hpp | 6 ------ Core/include/Acts/Surfaces/PlanarBounds.hpp | 6 ------ Core/include/Acts/Surfaces/RadialBounds.hpp | 3 --- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 6 ------ Core/src/Surfaces/AnnulusBounds.cpp | 10 ---------- Core/src/Surfaces/DiscTrapezoidBounds.cpp | 10 ---------- Core/src/Surfaces/RadialBounds.cpp | 10 ---------- Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp | 5 ----- 13 files changed, 80 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index b89c14087d9..283bed583ae 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -73,9 +73,6 @@ class AnnulusBounds : public DiscBounds { /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 0b1d3367ad6..c6d258a5266 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -82,12 +82,6 @@ class ConeBounds : public SurfaceBounds { return SquareMatrix2::Identity(); } - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { - (void)lposition; - return SquareMatrix2::Identity(); - } - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index 8e806813ced..05e84edc57d 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -95,12 +95,6 @@ class CylinderBounds : public SurfaceBounds { return SquareMatrix2::Identity(); } - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { - (void)lposition; - return SquareMatrix2::Identity(); - } - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index 6c9ef7478e1..922527a2120 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -68,9 +68,6 @@ class DiscTrapezoidBounds : public DiscBounds { /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 8ddfca818da..9ce1ded9449 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -33,12 +33,6 @@ class InfiniteBounds : public SurfaceBounds { return SquareMatrix2::Identity(); } - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { - (void)lposition; - return SquareMatrix2::Identity(); - } - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index 2256f8e4f80..9c9b7dce38c 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -52,12 +52,6 @@ class LineBounds : public SurfaceBounds { return SquareMatrix2::Identity(); } - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { - (void)lposition; - return SquareMatrix2::Identity(); - } - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; diff --git a/Core/include/Acts/Surfaces/PlanarBounds.hpp b/Core/include/Acts/Surfaces/PlanarBounds.hpp index 5a4dd02ed7e..b4cab64cc46 100644 --- a/Core/include/Acts/Surfaces/PlanarBounds.hpp +++ b/Core/include/Acts/Surfaces/PlanarBounds.hpp @@ -45,12 +45,6 @@ class PlanarBounds : public SurfaceBounds { return SquareMatrix2::Identity(); } - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { - (void)lposition; - return SquareMatrix2::Identity(); - } - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index 42bb9945540..5f27184cb90 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -64,9 +64,6 @@ class RadialBounds : public DiscBounds { /// @copydoc SurfaceBounds::boundToCartesianJacobian SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; - /// @copydoc SurfaceBounds::cartesianToBoundJacobian - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final; - /// @copydoc SurfaceBounds::boundToCartesianMetric SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 633778f7ea0..1bf4e90c945 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -64,12 +64,6 @@ class SurfaceBounds { virtual SquareMatrix2 boundToCartesianJacobian( const Vector2& lposition) const = 0; - /// Computes the cartesian to bound jacobian at a given local position - /// @param lposition is the local position at which the jacobian is computed - /// @return the cartesian to bound jacobian - virtual SquareMatrix2 cartesianToBoundJacobian( - const Vector2& lposition) const = 0; - /// Computes the bound to cartesian metric at a given local position /// @param lposition is the local position at which the metric is computed /// @return the bound to cartesian metric diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 3cad7efb4c2..c2d8f75700e 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -181,16 +181,6 @@ SquareMatrix2 AnnulusBounds::boundToCartesianJacobian( return j; } -SquareMatrix2 AnnulusBounds::cartesianToBoundJacobian( - const Vector2& lposition) const { - SquareMatrix2 j; - j(0, 0) = std::cos(lposition[1]); - j(0, 1) = std::sin(lposition[1]); - j(1, 0) = -std::sin(lposition[1]) / lposition[0]; - j(1, 1) = std::cos(lposition[1]) / lposition[0]; - return j; -} - SquareMatrix2 AnnulusBounds::boundToCartesianMetric( const Vector2& lposition) const { SquareMatrix2 m; diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index 392d06288d3..7444e475dfa 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -61,16 +61,6 @@ SquareMatrix2 DiscTrapezoidBounds::boundToCartesianJacobian( return j; } -SquareMatrix2 DiscTrapezoidBounds::cartesianToBoundJacobian( - const Vector2& lposition) const { - SquareMatrix2 j; - j(0, 0) = std::cos(lposition[1]); - j(0, 1) = std::sin(lposition[1]); - j(1, 0) = -std::sin(lposition[1]) / lposition[0]; - j(1, 1) = std::cos(lposition[1]) / lposition[0]; - return j; -} - SquareMatrix2 DiscTrapezoidBounds::boundToCartesianMetric( const Vector2& lposition) const { SquareMatrix2 m; diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 917723373d8..9e0cc8251ce 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -43,16 +43,6 @@ SquareMatrix2 RadialBounds::boundToCartesianJacobian( return j; } -SquareMatrix2 RadialBounds::cartesianToBoundJacobian( - const Vector2& lposition) const { - SquareMatrix2 j; - j(0, 0) = std::cos(lposition[1]); - j(0, 1) = std::sin(lposition[1]); - j(1, 0) = -std::sin(lposition[1]) / lposition[0]; - j(1, 1) = std::cos(lposition[1]) / lposition[0]; - return j; -} - SquareMatrix2 RadialBounds::boundToCartesianMetric( const Vector2& lposition) const { SquareMatrix2 m; diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp index 17656464c5a..6e7087b940b 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp @@ -49,11 +49,6 @@ class SurfaceBoundsStub : public SurfaceBounds { return SquareMatrix2::Identity(); } - SquareMatrix2 cartesianToBoundJacobian(const Vector2& lposition) const final { - (void)lposition; - return SquareMatrix2::Identity(); - } - SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { (void)lposition; return SquareMatrix2::Identity(); From 529a109d66331613b027894d4654fd4c4fbfdafe Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 16:05:17 +0100 Subject: [PATCH 28/33] fix doc; tolerance less annulus inside check --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 11 ---- Core/include/Acts/Surfaces/ConeBounds.hpp | 2 +- Core/src/Surfaces/AnnulusBounds.cpp | 56 +++++++------------- 3 files changed, 21 insertions(+), 48 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 283bed583ae..5693dc9d8c1 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -187,17 +187,6 @@ class AnnulusBounds : public DiscBounds { /// if consistency is not given void checkConsistency() noexcept(false); - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param tolR tolerance on the radius - /// @param tolPhi tolerance on the polar angle phi - /// @return boolean indicator for the success of this operation - virtual bool inside(const Vector2& lposition, double tolR, - double tolPhi) const final; - /// Transform the strip cartesian /// into the module polar system /// diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index c6d258a5266..4ab780265da 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -94,7 +94,7 @@ class ConeBounds : public SurfaceBounds { /// @copydoc SurfaceBounds::inside bool inside(const Vector2& lposition) const final; - /// @copydoc SurfaceBounds::inside + /// @copydoc SurfaceBounds::closestPoint Vector2 closestPoint(const Vector2& lposition, const std::optional& metric) const final; diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index c2d8f75700e..fde3bef837a 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -192,7 +192,26 @@ SquareMatrix2 AnnulusBounds::boundToCartesianMetric( } bool AnnulusBounds::inside(const Vector2& lposition) const { - return inside(lposition, 0., 0.); + // locpo is PC in STRIP SYSTEM + // need to perform internal rotation induced by average phi + Vector2 locpo_rotated = m_rotationStripPC * lposition; + double phiLoc = locpo_rotated[1]; + double rLoc = locpo_rotated[0]; + + if (phiLoc < get(eMinPhiRel) || phiLoc > get(eMaxPhiRel)) { + return false; + } + + // calculate R in MODULE SYSTEM to evaluate R-bounds + // don't need R, can use R^2 + double r_mod2 = m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + + 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]); + + if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) { + return false; + } + + return true; } Vector2 AnnulusBounds::closestPoint( @@ -335,41 +354,6 @@ Vector2 AnnulusBounds::closestPoint( return currentClosest; } -bool AnnulusBounds::inside(const Vector2& lposition, double tolR, - double tolPhi) const { - // locpo is PC in STRIP SYSTEM - // need to perform internal rotation induced by average phi - Vector2 locpo_rotated = m_rotationStripPC * lposition; - double phiLoc = locpo_rotated[1]; - double rLoc = locpo_rotated[0]; - - if (phiLoc < (get(eMinPhiRel) - tolPhi) || - phiLoc > (get(eMaxPhiRel) + tolPhi)) { - return false; - } - - // calculate R in MODULE SYSTEM to evaluate R-bounds - if (tolR == 0.) { - // don't need R, can use R^2 - double r_mod2 = m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + - 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]); - - if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) { - return false; - } - } else { - // use R - double r_mod = sqrt(m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + - 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1])); - - if (r_mod < (get(eMinR) - tolR) || r_mod > (get(eMaxR) + tolR)) { - return false; - } - } - - return true; -} - Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { Vector2 vecModuleXY = vStripXY + m_shiftXY; return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)}; From 97c568eb13826e6f0d33dbcd33ee1e4b28dd1a77 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 16:43:56 +0100 Subject: [PATCH 29/33] deal with different coordinate systems in annulus bounds --- Core/include/Acts/Surfaces/AnnulusBounds.hpp | 7 ++ Core/src/Surfaces/AnnulusBounds.cpp | 91 ++++++++++++-------- 2 files changed, 64 insertions(+), 34 deletions(-) diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 5693dc9d8c1..1f60c53cc26 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -193,6 +193,13 @@ class AnnulusBounds : public DiscBounds { /// @param vStripXY the position in the cartesian strip system /// @return the position in the module polar coordinate system Vector2 stripXYToModulePC(const Vector2& vStripXY) const; + + Vector2 stripPCToModulePC(const Vector2& vStripPC) const; + + Vector2 modulePCToStripPC(const Vector2& vModulePC) const; + + SquareMatrix2 stripPCToModulePCJacobian( + const Vector2& lpositionRotated) const; }; } // namespace Acts diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index fde3bef837a..422c99d16ad 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -214,19 +214,14 @@ bool AnnulusBounds::inside(const Vector2& lposition) const { return true; } -Vector2 AnnulusBounds::closestPoint( - const Vector2& lposition, - const std::optional& metric) const { - // locpo is PC in STRIP SYSTEM - // we need to rotate the locpo - Vector2 locpo_rotated = m_rotationStripPC * lposition; - +SquareMatrix2 AnnulusBounds::stripPCToModulePCJacobian( + const Vector2& lpositionRotated) const { // covariance is given in STRIP SYSTEM in PC we need to convert the covariance // to the MODULE SYSTEM in PC via jacobian. The following transforms into // STRIP XY, does the shift into MODULE XY, and then transforms into MODULE PC double dphi = get(eAveragePhi); - double phi_strip = locpo_rotated[1]; - double r_strip = locpo_rotated[0]; + double phi_strip = lpositionRotated[1]; + double r_strip = lpositionRotated[0]; double O_x = m_shiftXY[0]; double O_y = m_shiftXY[1]; @@ -296,20 +291,36 @@ Vector2 AnnulusBounds::closestPoint( double B = cosDPhiPhiStrip; double C = -sinDPhiPhiStrip; - SquareMatrix2 jacobianStripPCToModulePC; - jacobianStripPCToModulePC(0, 0) = (B * O_x + C * O_y + r_strip) / sqrtA; - jacobianStripPCToModulePC(0, 1) = - r_strip * (B * O_y + O_x * sinDPhiPhiStrip) / sqrtA; - jacobianStripPCToModulePC(1, 0) = -(B * O_y - C * O_x) / A; - jacobianStripPCToModulePC(1, 1) = r_strip * (B * O_x + C * O_y + r_strip) / A; + + SquareMatrix2 j; + j(0, 0) = (B * O_x + C * O_y + r_strip) / sqrtA; + j(0, 1) = r_strip * (B * O_y + O_x * sinDPhiPhiStrip) / sqrtA; + j(1, 0) = -(B * O_y - C * O_x) / A; + j(1, 1) = r_strip * (B * O_x + C * O_y + r_strip) / A; + return j; +} + +Vector2 AnnulusBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + // locpo is PC in STRIP SYSTEM + // we need to rotate the local position + Vector2 lpositionRotated = m_rotationStripPC * lposition; + + SquareMatrix2 jacobianStripPCToModulePC = + stripPCToModulePCJacobian(lpositionRotated); // Mahalanobis distance uses inverse covariance as weights - const auto& weightStripPC = metric.value_or(SquareMatrix2::Identity()); - auto weightModulePC = jacobianStripPCToModulePC.transpose() * weightStripPC * - jacobianStripPCToModulePC; + SquareMatrix2 weightStripPC = metric.value_or(SquareMatrix2::Identity()); + SquareMatrix2 weightModulePC = jacobianStripPCToModulePC.transpose() * + weightStripPC * jacobianStripPCToModulePC; + Vector2 minClosest = Vector2::Zero(); double minDist = std::numeric_limits::max(); + // current closest point and distance. + // note that `currentClosest` is in STRIP PC and MODULE PC while `currentDist` + // is in metric units Vector2 currentClosest; double currentDist = 0; @@ -317,37 +328,37 @@ Vector2 AnnulusBounds::closestPoint( // first: STRIP system. locpo is in STRIP PC already currentClosest = closestOnSegment(m_inLeftStripPC, m_outLeftStripPC, - locpo_rotated, weightStripPC); - currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); + lpositionRotated, weightStripPC); + currentDist = squaredNorm(lpositionRotated - currentClosest, weightStripPC); + minClosest = currentClosest; minDist = currentDist; currentClosest = closestOnSegment(m_inRightStripPC, m_outRightStripPC, - locpo_rotated, weightStripPC); - currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); + lpositionRotated, weightStripPC); + currentDist = squaredNorm(lpositionRotated - currentClosest, weightStripPC); if (currentDist < minDist) { + minClosest = currentClosest; minDist = currentDist; } // now: MODULE system. Need to transform locpo to MODULE PC // transform is STRIP PC -> STRIP XY -> MODULE XY -> MODULE PC - Vector2 locpoStripXY( - locpo_rotated[eBoundLoc0] * std::cos(locpo_rotated[eBoundLoc1]), - locpo_rotated[eBoundLoc0] * std::sin(locpo_rotated[eBoundLoc1])); - Vector2 locpoModulePC = stripXYToModulePC(locpoStripXY); + Vector2 lpositionModulePC = stripPCToModulePC(lpositionRotated); - // now check edges in MODULE PC (inner and outer circle) assuming Mahalanobis - // distances are of same unit if covariance is correctly transformed + // now check edges in MODULE PC (inner and outer circle) currentClosest = closestOnSegment(m_inLeftModulePC, m_inRightModulePC, - locpoModulePC, weightModulePC); - currentDist = squaredNorm(locpoModulePC - currentClosest, weightModulePC); + lpositionModulePC, weightModulePC); + currentDist = squaredNorm(lpositionModulePC - currentClosest, weightModulePC); if (currentDist < minDist) { + minClosest = modulePCToStripPC(currentClosest); minDist = currentDist; } currentClosest = closestOnSegment(m_outLeftModulePC, m_outRightModulePC, - locpoModulePC, weightModulePC); - currentDist = squaredNorm(locpoModulePC - currentClosest, weightModulePC); + lpositionModulePC, weightModulePC); + currentDist = squaredNorm(lpositionModulePC - currentClosest, weightModulePC); if (currentDist < minDist) { + minClosest = modulePCToStripPC(currentClosest); minDist = currentDist; } @@ -355,8 +366,20 @@ Vector2 AnnulusBounds::closestPoint( } Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { - Vector2 vecModuleXY = vStripXY + m_shiftXY; - return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)}; + Vector2 vModuleXY = vStripXY + m_shiftXY; + return {vModuleXY.norm(), VectorHelpers::phi(vModuleXY)}; +} + +Vector2 AnnulusBounds::stripPCToModulePC(const Vector2& vStripPC) const { + return stripXYToModulePC({vStripPC[0] * std::cos(vStripPC[1]), + vStripPC[0] * std::sin(vStripPC[1])}); +} + +Vector2 AnnulusBounds::modulePCToStripPC(const Vector2& vModulePC) const { + Vector2 vModuleXY = {vModulePC[0] * std::cos(vModulePC[1]), + vModulePC[0] * std::sin(vModulePC[1])}; + Vector2 vStripXY = vModuleXY - m_shiftXY; + return {vStripXY.norm(), VectorHelpers::phi(vStripXY)}; } Vector2 AnnulusBounds::moduleOrigin() const { From 385c66dfa9b25153814414b51753754352112535 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 16:55:47 +0100 Subject: [PATCH 30/33] try fix annulus closest point --- Core/src/Surfaces/AnnulusBounds.cpp | 90 ++++++++++++++++------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 422c99d16ad..be4cd70bcb7 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -310,35 +310,37 @@ Vector2 AnnulusBounds::closestPoint( SquareMatrix2 jacobianStripPCToModulePC = stripPCToModulePCJacobian(lpositionRotated); - // Mahalanobis distance uses inverse covariance as weights - SquareMatrix2 weightStripPC = metric.value_or(SquareMatrix2::Identity()); - SquareMatrix2 weightModulePC = jacobianStripPCToModulePC.transpose() * - weightStripPC * jacobianStripPCToModulePC; + // calculate the metrics for STRIP PC and MODULE PC + SquareMatrix2 metricStripPC = metric.value_or(SquareMatrix2::Identity()); + SquareMatrix2 metricModulePC = jacobianStripPCToModulePC.transpose() * + metricStripPC * jacobianStripPCToModulePC; - Vector2 minClosest = Vector2::Zero(); + // minimum distance and associated point double minDist = std::numeric_limits::max(); + Vector2 minClosest = Vector2::Zero(); + + // first: STRIP system. lpositionRotated is in STRIP PC already + + { + Vector2 currentClosest = closestOnSegment(m_inLeftStripPC, m_outLeftStripPC, + lpositionRotated, metricStripPC); + double currentDist = + squaredNorm(lpositionRotated - currentClosest, metricStripPC); + if (currentDist < minDist) { + minDist = currentDist; + minClosest = m_rotationStripPC.inverse() * currentClosest; + } + } - // current closest point and distance. - // note that `currentClosest` is in STRIP PC and MODULE PC while `currentDist` - // is in metric units - Vector2 currentClosest; - double currentDist = 0; - - // do projection in STRIP PC - - // first: STRIP system. locpo is in STRIP PC already - currentClosest = closestOnSegment(m_inLeftStripPC, m_outLeftStripPC, - lpositionRotated, weightStripPC); - currentDist = squaredNorm(lpositionRotated - currentClosest, weightStripPC); - minClosest = currentClosest; - minDist = currentDist; - - currentClosest = closestOnSegment(m_inRightStripPC, m_outRightStripPC, - lpositionRotated, weightStripPC); - currentDist = squaredNorm(lpositionRotated - currentClosest, weightStripPC); - if (currentDist < minDist) { - minClosest = currentClosest; - minDist = currentDist; + { + Vector2 currentClosest = closestOnSegment( + m_inRightStripPC, m_outRightStripPC, lpositionRotated, metricStripPC); + double currentDist = + squaredNorm(lpositionRotated - currentClosest, metricStripPC); + if (currentDist < minDist) { + minDist = currentDist; + minClosest = m_rotationStripPC.inverse() * currentClosest; + } } // now: MODULE system. Need to transform locpo to MODULE PC @@ -346,23 +348,33 @@ Vector2 AnnulusBounds::closestPoint( Vector2 lpositionModulePC = stripPCToModulePC(lpositionRotated); // now check edges in MODULE PC (inner and outer circle) - currentClosest = closestOnSegment(m_inLeftModulePC, m_inRightModulePC, - lpositionModulePC, weightModulePC); - currentDist = squaredNorm(lpositionModulePC - currentClosest, weightModulePC); - if (currentDist < minDist) { - minClosest = modulePCToStripPC(currentClosest); - minDist = currentDist; + + { + Vector2 currentClosest = closestOnSegment( + m_inLeftModulePC, m_inRightModulePC, lpositionModulePC, metricModulePC); + double currentDist = + squaredNorm(lpositionModulePC - currentClosest, metricModulePC); + if (currentDist < minDist) { + minDist = currentDist; + minClosest = + m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); + } } - currentClosest = closestOnSegment(m_outLeftModulePC, m_outRightModulePC, - lpositionModulePC, weightModulePC); - currentDist = squaredNorm(lpositionModulePC - currentClosest, weightModulePC); - if (currentDist < minDist) { - minClosest = modulePCToStripPC(currentClosest); - minDist = currentDist; + { + Vector2 currentClosest = + closestOnSegment(m_outLeftModulePC, m_outRightModulePC, + lpositionModulePC, metricModulePC); + double currentDist = + squaredNorm(lpositionModulePC - currentClosest, metricModulePC); + if (currentDist < minDist) { + minDist = currentDist; + minClosest = + m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); + } } - return currentClosest; + return minClosest; } Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { From cd1363088a971d62707d7588930d7eba758bc4d2 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 17:25:18 +0100 Subject: [PATCH 31/33] minor --- Core/src/Surfaces/AnnulusBounds.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index be4cd70bcb7..0fa0017ae71 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -216,9 +216,6 @@ bool AnnulusBounds::inside(const Vector2& lposition) const { SquareMatrix2 AnnulusBounds::stripPCToModulePCJacobian( const Vector2& lpositionRotated) const { - // covariance is given in STRIP SYSTEM in PC we need to convert the covariance - // to the MODULE SYSTEM in PC via jacobian. The following transforms into - // STRIP XY, does the shift into MODULE XY, and then transforms into MODULE PC double dphi = get(eAveragePhi); double phi_strip = lpositionRotated[1]; double r_strip = lpositionRotated[0]; @@ -303,7 +300,7 @@ SquareMatrix2 AnnulusBounds::stripPCToModulePCJacobian( Vector2 AnnulusBounds::closestPoint( const Vector2& lposition, const std::optional& metric) const { - // locpo is PC in STRIP SYSTEM + // lposition is PC in STRIP SYSTEM // we need to rotate the local position Vector2 lpositionRotated = m_rotationStripPC * lposition; @@ -317,7 +314,7 @@ Vector2 AnnulusBounds::closestPoint( // minimum distance and associated point double minDist = std::numeric_limits::max(); - Vector2 minClosest = Vector2::Zero(); + Vector2 closest = Vector2::Zero(); // first: STRIP system. lpositionRotated is in STRIP PC already @@ -328,7 +325,7 @@ Vector2 AnnulusBounds::closestPoint( squaredNorm(lpositionRotated - currentClosest, metricStripPC); if (currentDist < minDist) { minDist = currentDist; - minClosest = m_rotationStripPC.inverse() * currentClosest; + closest = m_rotationStripPC.inverse() * currentClosest; } } @@ -339,11 +336,11 @@ Vector2 AnnulusBounds::closestPoint( squaredNorm(lpositionRotated - currentClosest, metricStripPC); if (currentDist < minDist) { minDist = currentDist; - minClosest = m_rotationStripPC.inverse() * currentClosest; + closest = m_rotationStripPC.inverse() * currentClosest; } } - // now: MODULE system. Need to transform locpo to MODULE PC + // now: MODULE system. Need to transform lposition to MODULE PC // transform is STRIP PC -> STRIP XY -> MODULE XY -> MODULE PC Vector2 lpositionModulePC = stripPCToModulePC(lpositionRotated); @@ -356,8 +353,7 @@ Vector2 AnnulusBounds::closestPoint( squaredNorm(lpositionModulePC - currentClosest, metricModulePC); if (currentDist < minDist) { minDist = currentDist; - minClosest = - m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); + closest = m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); } } @@ -369,12 +365,11 @@ Vector2 AnnulusBounds::closestPoint( squaredNorm(lpositionModulePC - currentClosest, metricModulePC); if (currentDist < minDist) { minDist = currentDist; - minClosest = - m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); + closest = m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); } } - return minClosest; + return closest; } Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { From c8be68fc08b5ea5e34d8ee3898dee7637607d361 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 18:26:30 +0100 Subject: [PATCH 32/33] minor --- Core/src/Surfaces/AnnulusBounds.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 0fa0017ae71..b4329a7c13c 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -24,10 +24,6 @@ namespace Acts { namespace { -double squaredNorm(const Vector2& v, const SquareMatrix2& metric) { - return (v.transpose() * metric * v).value(); -} - Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p, const SquareMatrix2& metric) { // connecting vector @@ -40,6 +36,10 @@ Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p, return std::clamp(u, 0., 1.) * n + a; } +double squaredNorm(const Vector2& v, const SquareMatrix2& metric) { + return (v.transpose() * metric * v).value(); +} + } // namespace AnnulusBounds::AnnulusBounds(const std::array& values) noexcept( From c6a42198ac7027f241d7532159ca0a32219bd7d2 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 19 Dec 2024 21:03:53 +0100 Subject: [PATCH 33/33] fixes and ref updates --- .../Acts/Surfaces/BoundaryTolerance.hpp | 4 + Core/src/Surfaces/TrapezoidBounds.cpp | 9 +- .../Core/Surfaces/BoundsRegressionTests.cpp | 767 +++++++++--------- 3 files changed, 395 insertions(+), 385 deletions(-) diff --git a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp index 0255545c891..53d068d7f00 100644 --- a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp +++ b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp @@ -72,6 +72,10 @@ class BoundaryTolerance { throw std::invalid_argument( "AbsoluteBound: Tolerance must be non-negative"); } + if ((tolerance0 == 0) != (tolerance1 == 0)) { + throw std::invalid_argument( + "AbsoluteBound: Both tolerances must be zero or non-zero"); + } } }; diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 71a7ced6c7c..0ca5b53a57e 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -75,12 +75,17 @@ Vector2 TrapezoidBounds::closestPoint( const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); const double hlY = get(TrapezoidBounds::eHalfLengthY); + const double rotAngle = get(TrapezoidBounds::eRotationAngle); + + const Vector2 extPosition = Eigen::Rotation2Dd(rotAngle) * lposition; Vector2 vertices[] = { {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; - return detail::VerticesHelper::computeClosestPointOnPolygon( - lposition, vertices, metric.value_or(SquareMatrix2::Identity())); + Vector2 extClosest = detail::VerticesHelper::computeClosestPointOnPolygon( + extPosition, vertices, metric.value_or(SquareMatrix2::Identity())); + + return Eigen::Rotation2Dd(-rotAngle) * extClosest; } std::vector TrapezoidBounds::vertices( diff --git a/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp b/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp index 56bec3caaa8..363652bb02d 100644 --- a/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp @@ -752,7 +752,7 @@ BOOST_AUTO_TEST_CASE(Rectangle) { parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteBound(1, 0)") { + BOOST_TEST_CONTEXT("AbsoluteBound(1, 0.01)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -836,12 +836,12 @@ BOOST_AUTO_TEST_CASE(Rectangle) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0.01); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 1)") { + BOOST_TEST_CONTEXT("AbsoluteBound(0.01, 0.1)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -925,7 +925,7 @@ BOOST_AUTO_TEST_CASE(Rectangle) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0.01, 0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } @@ -1749,43 +1749,44 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .........................................XXXXXXXXXXXXX.......................... ......................................XXXXXXXXXXXXXXXX.......................... ...................................XXXXXXXXXXXXXXXXXXX.......................... -................................XXXXXXXXXXXXXXXXXXXXXX.......................... +................................XXXXXXXXXXXXXXXXXXXXXXX......................... ............................XXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... @@ -1795,15 +1796,14 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. @@ -1827,7 +1827,7 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteBound(1, 0)") { + BOOST_TEST_CONTEXT("AbsoluteBound(1, 0.01)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -1838,19 +1838,19 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ ................................................................................ ................................................................................ -......................................................X......................... -...................................................XXXX......................... -................................................XXXXXXX......................... +................................................................................ +...................................................XXX.......................... +...............................................XXXXXXX.......................... ............................................XXXXXXXXXXX......................... .........................................XXXXXXXXXXXXXX......................... ......................................XXXXXXXXXXXXXXXXXX........................ -...................................XXXXXXXXXXXXXXXXXXXXX........................ +..................................XXXXXXXXXXXXXXXXXXXXXX........................ ...............................XXXXXXXXXXXXXXXXXXXXXXXXX........................ ............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... @@ -1882,23 +1882,23 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... -............XXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... ............XXXXXXXXXXXXXXXXXXXXXXX............................................. ...........XXXXXXXXXXXXXXXXXXXXX................................................ ...........XXXXXXXXXXXXXXXXXX................................................... -...........XXXXXXXXXXXXXX....................................................... +...........XXXXXXXXXXXXXXX...................................................... ...........XXXXXXXXXXX.......................................................... ..........XXXXXXXXX............................................................. ..........XXXXXX................................................................ -..........XX.................................................................... +..........XXX................................................................... ................................................................................ ................................................................................ ................................................................................ @@ -1911,12 +1911,12 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0.01); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteBound(0, 0.1)") { + BOOST_TEST_CONTEXT("AbsoluteBound(0, 0)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -1927,16 +1927,16 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ ................................................................................ ................................................................................ -.....................................................X.......................... -.................................................XXXXX.......................... -..............................................XXXXXXXX.......................... -...........................................XXXXXXXXXXXX......................... -........................................XXXXXXXXXXXXXXX......................... -....................................XXXXXXXXXXXXXXXXXXXX........................ -.................................XXXXXXXXXXXXXXXXXXXXXXX........................ -..............................XXXXXXXXXXXXXXXXXXXXXXXXXX........................ -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +................................................................................ +...................................................XXX.......................... +................................................XXXXXX.......................... +............................................XXXXXXXXXXX......................... +.........................................XXXXXXXXXXXXXX......................... +......................................XXXXXXXXXXXXXXXXXX........................ +...................................XXXXXXXXXXXXXXXXXXXXX........................ +...............................XXXXXXXXXXXXXXXXXXXXXXXXX........................ +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... @@ -1970,25 +1970,25 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXX........................................ -............XXXXXXXXXXXXXXXXXXXXXXXXX........................................... -...........XXXXXXXXXXXXXXXXXXXXXX............................................... -...........XXXXXXXXXXXXXXXXXXX.................................................. -...........XXXXXXXXXXXXXXXX..................................................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +............XXXXXXXXXXXXXXXXXXXXXXX............................................. +...........XXXXXXXXXXXXXXXXXXXXX................................................ +...........XXXXXXXXXXXXXXXXXX................................................... +...........XXXXXXXXXXXXXX....................................................... ...........XXXXXXXXXXX.......................................................... ..........XXXXXXXXX............................................................. ..........XXXXXX................................................................ -..........XXX................................................................... -..........X..................................................................... +..........XX.................................................................... +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -2000,7 +2000,7 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } @@ -2008,55 +2008,56 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 1.2)") { std::string reference = R"X( ................................................................................ -.....................................................XXX........................ +.....................................................XXXX....................... ..................................................XXXXXXX....................... -...............................................XXXXXXXXXX....................... -...........................................XXXXXXXXXXXXXX....................... +..............................................XXXXXXXXXXX....................... +...........................................XXXXXXXXXXXXXXX...................... ........................................XXXXXXXXXXXXXXXXXX...................... -.....................................XXXXXXXXXXXXXXXXXXXXX...................... -..................................XXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................................XXXXXXXXXXXXXXXXXXXXXX..................... +.................................XXXXXXXXXXXXXXXXXXXXXXXXXX..................... ..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... @@ -2065,13 +2066,12 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... @@ -2082,10 +2082,10 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .....XXXXXXXXXXXXXXXXXXXXXXX.................................................... .....XXXXXXXXXXXXXXXXXXXX....................................................... .....XXXXXXXXXXXXXXXXX.......................................................... -......XXXXXXXXXXXXX............................................................. -......XXXXXXXXX................................................................. -......XXXXXX.................................................................... -......XXX....................................................................... +.....XXXXXXXXXXXXXX............................................................. +.....XXXXXXXXXX................................................................. +.....XXXXXXX.................................................................... +.....XXXX....................................................................... ................................................................................ )X"; @@ -2103,21 +2103,21 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ ................................................................................ ................................................................................ -.....................................................XXX........................ -..................................................XXXXXXX....................... -...............................................XXXXXXXXXX....................... -............................................XXXXXXXXXXXXX....................... +.....................................................XX......................... +..................................................XXXXX......................... +...............................................XXXXXXXXX........................ +............................................XXXXXXXXXXXX........................ ........................................XXXXXXXXXXXXXXXXX....................... .....................................XXXXXXXXXXXXXXXXXXXX....................... ..................................XXXXXXXXXXXXXXXXXXXXXXX....................... ...............................XXXXXXXXXXXXXXXXXXXXXXXXXXX...................... ...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... ........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. @@ -2156,7 +2156,7 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... @@ -2187,21 +2187,21 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { std::string reference = R"X( ................................................................................ ................................................................................ -.....................................................XX......................... -..................................................XXXXX......................... -...............................................XXXXXXXX......................... -...........................................XXXXXXXXXXXX......................... -........................................XXXXXXXXXXXXXXX......................... -.....................................XXXXXXXXXXXXXXXXXX......................... -..................................XXXXXXXXXXXXXXXXXXXXX......................... -..............................XXXXXXXXXXXXXXXXXXXXXXXXXX........................ -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +....................................................XXX......................... +.................................................XXXXXX......................... +.............................................XXXXXXXXXXX........................ +..........................................XXXXXXXXXXXXXX........................ +.......................................XXXXXXXXXXXXXXXXXX....................... +....................................XXXXXXXXXXXXXXXXXXXXX....................... +................................XXXXXXXXXXXXXXXXXXXXXXXXX....................... +.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... @@ -2238,31 +2238,31 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... -........XXXXXXXXXXXXXXXXXXXXXXXXXXX............................................. -........XXXXXXXXXXXXXXXXXXXXXXX................................................. -.......XXXXXXXXXXXXXXXXXXXXX.................................................... -.......XXXXXXXXXXXXXXXXXX....................................................... -.......XXXXXXXXXXXXXXX.......................................................... -.......XXXXXXXXXXXX............................................................. -.......XXXXXXXX................................................................. -.......XXXXX.................................................................... -.......XX....................................................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXX............................................ +.........XXXXXXXXXXXXXXXXXXXXXXXX............................................... +.........XXXXXXXXXXXXXXXXXXXXX.................................................. +........XXXXXXXXXXXXXXXXXX...................................................... +........XXXXXXXXXXXXXXX......................................................... +........XXXXXXXXXXXX............................................................ +........XXXXXXXXX............................................................... +.......XXXXXX................................................................... +.......XXX...................................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ ................................................................................ ................................................................................ )X"; @@ -2476,8 +2476,8 @@ BOOST_AUTO_TEST_CASE(Annulus) { ................................................................................ ................................................................................ ................................................................................ -...................................XXX.......................................... -................................XXXXXXXXX....................................... +...................................XXXX......................................... +.................................XXXXXXXX....................................... ...............................XXXXXXXXXXX...................................... ..............................XXXXXXXXXXXXX..................................... ..............................XXXXXXXXXXXXXXX................................... @@ -2497,7 +2497,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ @@ -2508,7 +2508,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. @@ -2520,7 +2520,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... @@ -2586,7 +2586,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { .................................XXXXXXXXXXXXXXXXX.............................. ................................XXXXXXXXXXXXXXXXXXX............................. ...............................XXXXXXXXXXXXXXXXXXXXXX........................... -..............................XXXXXXXXXXXXXXXXXXXXXXXX.......................... +.............................XXXXXXXXXXXXXXXXXXXXXXXXX.......................... ............................XXXXXXXXXXXXXXXXXXXXXXXXXXX......................... ...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... @@ -2662,51 +2662,51 @@ BOOST_AUTO_TEST_CASE(Annulus) { ................................................................................ ................................................................................ ................................................................................ -.....................................X.......................................... -....................................XX.XX....................................... -....................................XXXXXXX..................................... -....................................XXXXXXXX.................................... -...................................XXXXXXXXXXX.................................. -..................................XXXXXXXXXXXXXX................................ -..................................XXXXXXXXXXXXXXXX.............................. -.................................XXXXXXXXXXXXXXXXXX............................. -................................XXXXXXXXXXXXXXXXXXXXX........................... -................................XXXXXXXXXXXXXXXXXXXXXXX......................... -...............................XXXXXXXXXXXXXXXXXXXXXXXXX........................ -..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXX................................... -..................XXXXXXXXXXXXXXXXXXXXXXXXX..................................... -..................XXXXXXXXXXXXXXXXXXXXXXXX...................................... -..................XXXXXXXXXXXXXXXXXXXXXX........................................ -...................XXXXXXXXXXXXXXXXXXX.......................................... -...................XXXXXXXXXXXXXXXXX............................................ -...................XXXXXXXXXXXXXXX.............................................. -...................XXXXXXXXXXXX................................................. -...................XXXXXXXXXX................................................... -.......................XXX...................................................... +......................................XXXX...................................... +....................................XXXXX....................................... +...................................XXXXXX....................................... +..................................XXXXXXXX...................................... +...................................XXXXXXXX..................................... +..................................XXXXXXXXXXX................................... +................................XXXXXXXXXXXXXX.................................. +................................XXXXXXXXXXXXXXX................................. +...............................XXXXXXXXXXXXXXXXXX............................... +..............................XXXXXXXXXXXXXXXXXXXX.............................. +.............................XXXXXXXXXXXXXXXXXXXXXXX............................ +............................XXXXXXXXXXXXXXXXXXXXXXXXX........................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.........X.............. +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......XX.............. +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....XXX.............. +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXX............... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +................XXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +................XXXXXXXXXXXXXXXXXXXXXXXXX....................................... +................XXXXXXXXXXXXXXXXXXXXXXX......................................... +................XXXXXXXXXXXXXXXXXXXXX........................................... +................XXXXXXXXXXXXXXXXXX.............................................. +................XXXXXXXXXXXXXXXXX............................................... +................XXXXXXXXXXXXX................................................... ................................................................................ ................................................................................ ................................................................................ @@ -2728,7 +2728,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { )X"; BoundaryTolerance tolerance = - BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 0.1); + BoundaryTolerance::Chi2Bound(Vector2(1, 10).asDiagonal(), 0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.5), parseMatrix(reference))); } @@ -2748,59 +2748,59 @@ BOOST_AUTO_TEST_CASE(Annulus) { ................................................................................ ................................................................................ ................................................................................ -................................................................................ -...................................X............................................ -..................................XXX........................................... -..................................XXXX.......................................... -.................................XXXXXX......................................... -................................XXXXXXXX........................................ -...............................XXXXXXXXXXX...................................... -...............................XXXXXXXXXXXX..................................... -..............................XXXXXXXXXXXXXX.................................... -.............................XXXXXXXXXXXXXXXX................................... -............................XXXXXXXXXXXXXXXXXX.................................. -...........................XXXXXXXXXXXXXXXXXXXX................................. -..........................XXXXXXXXXXXXXXXXXXXXXX................................ -.........................XXXXXXXXXXXXXXXXXXXXXXXXX.............................. -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................................XX.......................................... +....................................XXX......................................... +....................................XXXX........................................ +....................................XXXXXX...................................... +....................................XXXXXXX..................................... +...................................XXXXXXXXX.................................... +..................................XXXXXXXXXXXX.................................. +..................................XXXXXXXXXXXXX................................. +.................................XXXXXXXXXXXXXXXX............................... +................................XXXXXXXXXXXXXXXXXX.............................. +...............................XXXXXXXXXXXXXXXXXXXX............................. +..............................XXXXXXXXXXXXXXXXXXXXXXX........................... +.............................XXXXXXXXXXXXXXXXXXXXXXXXX.......................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -........................XXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -........................XXXXXXXXXXXXXXXXXXXXXXXX................................ -.........................XXXXXXXXXXXXXXXXXXXXXX................................. -.........................XXXXXXXXXXXXXXXXXXXXX.................................. -..........................XXXXXXXXXXXXXXXXXX.................................... -..........................XXXXXXXXXXXXXXXXX..................................... -..........................XXXXXXXXXXXXXXX....................................... -...........................XXXXXXXXXXXX......................................... -...........................XXXXXXXXXXX.......................................... -............................XXXXXXXX............................................ -............................XXXXXX.............................................. -.............................XXX................................................ -.............................X.................................................. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +......................XXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXX................................ +.......................XXXXXXXXXXXXXXXXXXXXXXXX................................. +.......................XXXXXXXXXXXXXXXXXXXXXX................................... +........................XXXXXXXXXXXXXXXXXXXX.................................... +........................XXXXXXXXXXXXXXXXXXX..................................... +.........................XXXXXXXXXXXXXXXX....................................... +.........................XXXXXXXXXXXXXXX........................................ +.........................XXXXXXXXXXXXX.......................................... +..........................XXXXXXXXXX............................................ +..........................XXXXXXXXX............................................. +..........................XXXXXXX............................................... +...........................XXXX................................................. +...........................XXX.................................................. +............................X................................................... +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -2818,7 +2818,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { )X"; BoundaryTolerance tolerance = - BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), -0.1); + BoundaryTolerance::Chi2Bound(Vector2(1, 10).asDiagonal(), -0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), parseMatrix(reference))); } @@ -2920,18 +2920,18 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ ................................................................................ ................................................................................ -...............................XX............................................... -...............................XXX.............................................. +................................................................................ +................................XX.............................................. ...............................XXXXX............................................ ..............................XXXXXXX........................................... -..............................XXXXXXXXX......................................... +.............................XXXXXXXXXX......................................... .............................XXXXXXXXXXX........................................ -.............................XXXXXXXXXXXXX...................................... +............................XXXXXXXXXXXXXX...................................... ............................XXXXXXXXXXXXXXXX.................................... -............................XXXXXXXXXXXXXXXXX................................... +...........................XXXXXXXXXXXXXXXXXX................................... ...........................XXXXXXXXXXXXXXXXXXXX................................. ..........................XXXXXXXXXXXXXXXXXXXXXX................................ -..........................XXXXXXXXXXXXXXXXXXXXXXXX.............................. +.........................XXXXXXXXXXXXXXXXXXXXXXXXX.............................. .........................XXXXXXXXXXXXXXXXXXXXXXXXXX............................. ........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... @@ -2939,56 +2939,56 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXX....................................... -...............XXXXXXXXXXXXXXXXXXXXXXXX......................................... -................XXXXXXXXXXXXXXXXXXXXX........................................... -................XXXXXXXXXXXXXXXXXXX............................................. -................XXXXXXXXXXXXXXXXX............................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXX........................................ +................XXXXXXXXXXXXXXXXXXXXXX.......................................... +................XXXXXXXXXXXXXXXXXXXX............................................ +................XXXXXXXXXXXXXXXXXX.............................................. ................XXXXXXXXXXXXXXX................................................. -.................XXXXXXXXXXX.................................................... +.................XXXXXXXXXXXX................................................... .................XXXXXXXXX...................................................... -.................XXXXXX......................................................... -.................XXX............................................................ +.................XXXXX.......................................................... +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -3008,84 +3008,84 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ ................................................................................ ................................................................................ -............................XX.................................................. -............................XXXX................................................ -...........................XXXXXX............................................... -...........................XXXXXXXX............................................. -..........................XXXXXXXXXX............................................ -..........................XXXXXXXXXXX........................................... -.........................XXXXXXXXXXXXXX......................................... -.........................XXXXXXXXXXXXXXX........................................ -........................XXXXXXXXXXXXXXXXXX...................................... -.......................XXXXXXXXXXXXXXXXXXXX..................................... -.......................XXXXXXXXXXXXXXXXXXXXX.................................... -......................XXXXXXXXXXXXXXXXXXXXXXXX.................................. -.....................XXXXXXXXXXXXXXXXXXXXXXXXXX................................. -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............................X................................................. +...............................XX............................................... +................................XX.............................................. +..................................XX............................................ +..................................XXX........................................... +..................................XXXX.......................................... +.................................XXXXXXX........................................ +.................................XXXXXXXX....................................... +................................XXXXXXXXXXX..................................... +................................XXXXXXXXXXXX.................................... +...............................XXXXXXXXXXXXXXX.................................. +..............................XXXXXXXXXXXXXXXXX................................. +..............................XXXXXXXXXXXXXXXXXX................................ +.............................XXXXXXXXXXXXXXXXXXXXX.............................. +............................XXXXXXXXXXXXXXXXXXXXXXX............................. +...........................XXXXXXXXXXXXXXXXXXXXXXXXXX........................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -...................XXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. -...................XXXXXXXXXXXXXXXXXXXXXXXXX.................................... -....................XXXXXXXXXXXXXXXXXXXXXXX..................................... -....................XXXXXXXXXXXXXXXXXXXXX....................................... -....................XXXXXXXXXXXXXXXXXXX......................................... -....................XXXXXXXXXXXXXXXXX........................................... -.....................XXXXXXXXXXXXXX............................................. -.....................XXXXXXXXXXX................................................ -.....................XXXXXXXXX.................................................. -......................XXXXXX.................................................... -......................XXX....................................................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +.................XXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +.................XXXXXXXXXXXXXXXXXXXXXXXX....................................... +..................XXXXXXXXXXXXXXXXXXXXX......................................... +..................XXXXXXXXXXXXXXXXXXX........................................... +..................XXXXXXXXXXXXXXXXX............................................. +...................XXXXXXXXXXXXXX............................................... +...................XXXXXXXXXXXX................................................. +...................XXXXXXXXXX................................................... +...................XXXXXXXX..................................................... +....................XXXX........................................................ +....................XXX......................................................... +....................XXX......................................................... +.....................XX......................................................... ................................................................................ ................................................................................ ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0.01); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } @@ -3097,11 +3097,11 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ ................................................................................ ................................................................................ -......................................X......................................... -......................................XXX....................................... -.....................................XXXXXX..................................... -.....................................XXXXXXX.................................... -....................................XXXXXXXXXX.................................. +................................................................................ +.......................................X........................................ +......................................X..XX..................................... +.....................................X.XXXXX.................................... +.....................................XXXXXXXXX.................................. ....................................XXXXXXXXXXXX................................ ...................................XXXXXXXXXXXXXX............................... ...................................XXXXXXXXXXXXXXXX............................. @@ -3113,39 +3113,39 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ...............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. .............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. @@ -3153,19 +3153,19 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... -......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................................ ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................................ .......XXXXXXXXXXXXXXXXXXXXXXXXXXX.............................................. .......XXXXXXXXXXXXXXXXXXXXXXXXX................................................ .......XXXXXXXXXXXXXXXXXXXXXXX.................................................. -.......XXXXXXXXXXXXXXXXXXXX..................................................... +.......XXXXXXXXXXXXXXXXXXXXX.................................................... .......XXXXXXXXXXXXXXXXXX....................................................... -........XXXXXXXXXXXXXX.......................................................... +........XXXXXXXXXXXXXXX......................................................... ........XXXXXXXXXXXX............................................................ -........XXXXXXXXX............................................................... ........XXXXXX.................................................................. -........XX...................................................................... +................................................................................ +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -3174,11 +3174,12 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0.01, 0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } } BOOST_AUTO_TEST_SUITE_END() + } // namespace Acts::Test