diff --git a/CI/codespell_ignore.txt b/CI/codespell_ignore.txt index e6ab8123413..ca114b4f26e 100644 --- a/CI/codespell_ignore.txt +++ b/CI/codespell_ignore.txt @@ -1,24 +1,21 @@ +aline +ans +boxs bu -strack -compres coner +dependees dthe -iself -sortings +exprot gaus -te -parm -writet -localy +iself lastr -exprot +localy +millepede +parm +pixelx pring -aline -boxs -ans -dthe -dthe +sortings +strack +te vart -pixelx -millepede -dependees +writet diff --git a/Core/include/Acts/Definitions/Algebra.hpp b/Core/include/Acts/Definitions/Algebra.hpp index 5684ab44c73..d81f987f7ba 100644 --- a/Core/include/Acts/Definitions/Algebra.hpp +++ b/Core/include/Acts/Definitions/Algebra.hpp @@ -77,8 +77,8 @@ using Translation2 = Eigen::Translation; using Translation3 = Eigen::Translation; // linear (rotation) matrices -using RotationMatrix2 = ActsMatrix<2, 2>; -using RotationMatrix3 = ActsMatrix<3, 3>; +using RotationMatrix2 = SquareMatrix2; +using RotationMatrix3 = SquareMatrix3; // pure rotation defined by a rotation angle around a rotation axis using AngleAxis3 = Eigen::AngleAxis; diff --git a/Core/include/Acts/Definitions/Units.hpp b/Core/include/Acts/Definitions/Units.hpp index 65d7cee775d..a65e6945cfd 100644 --- a/Core/include/Acts/Definitions/Units.hpp +++ b/Core/include/Acts/Definitions/Units.hpp @@ -201,12 +201,12 @@ constexpr double mol = 1.0; namespace UnitLiterals { // define user literal functions for the given unit constant -#define ACTS_DEFINE_UNIT_LITERAL(name) \ - constexpr double operator"" _##name(long double x) { \ - return ::Acts::UnitConstants::name * x; \ - } \ - constexpr double operator"" _##name(unsigned long long x) { \ - return ::Acts::UnitConstants::name * x; \ +#define ACTS_DEFINE_UNIT_LITERAL(name) \ + constexpr double operator""_##name(long double x) { \ + return ::Acts::UnitConstants::name * x; \ + } \ + constexpr double operator""_##name(unsigned long long x) { \ + return ::Acts::UnitConstants::name * x; \ } ACTS_DEFINE_UNIT_LITERAL(fm) ACTS_DEFINE_UNIT_LITERAL(pm) diff --git a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp index 22567d8adf5..bd2d2063831 100644 --- a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp @@ -123,10 +123,10 @@ class GenericBoundTrackParameters { /// Parameters vector. const ParametersVector& parameters() const { return m_params; } /// Vector of spatial impact parameters (i.e., d0 and z0) - ActsVector<2> spatialImpactParameters() const { return m_params.head<2>(); } + Vector2 spatialImpactParameters() const { return m_params.head<2>(); } /// Vector of spatial and temporal impact parameters (i.e., d0, z0, and t) - ActsVector<3> impactParameters() const { - ActsVector<3> ip; + Vector3 impactParameters() const { + Vector3 ip; ip.template head<2>() = m_params.template head<2>(); ip(2) = m_params(eBoundTime); return ip; diff --git a/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp b/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp index e7c6a6d3fdf..876a799cb9d 100644 --- a/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp +++ b/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp @@ -56,7 +56,7 @@ concept CommonMultiTrajectoryBackend = { cv.template calibrated_impl<2>(istate) - } -> std::same_as>>; + } -> std::same_as>; { cv.template calibratedCovariance_impl<2>(istate) @@ -86,7 +86,7 @@ concept ConstMultiTrajectoryBackend = { v.template calibrated_impl<2>(istate) - } -> std::same_as>>; + } -> std::same_as>; { v.template calibratedCovariance_impl<2>(istate) @@ -107,7 +107,7 @@ concept MutableMultiTrajectoryBackend = { v.template calibrated_impl<2>(istate) - } -> std::same_as>>; + } -> std::same_as>; { v.template calibratedCovariance_impl<2>(istate) diff --git a/Core/include/Acts/EventData/TrackStateProxyConcept.hpp b/Core/include/Acts/EventData/TrackStateProxyConcept.hpp index 4b8a713f864..047a04c3c2d 100644 --- a/Core/include/Acts/EventData/TrackStateProxyConcept.hpp +++ b/Core/include/Acts/EventData/TrackStateProxyConcept.hpp @@ -28,10 +28,10 @@ using Covariance = Eigen::Map; using ConstParameters = Eigen::Map; using ConstCovariance = Eigen::Map; -using Measurement = Eigen::Map>; +using Measurement = Eigen::Map; using MeasurementCovariance = Eigen::Map>; -using ConstMeasurement = Eigen::Map>; +using ConstMeasurement = Eigen::Map; using ConstMeasurementCovariance = Eigen::Map>; using DynamicMeasurement = diff --git a/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp b/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp index 598eef039c8..1668642e867 100644 --- a/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp +++ b/Core/include/Acts/EventData/detail/MultiTrajectoryTestsCommon.hpp @@ -1235,7 +1235,7 @@ class MultiTrajectoryTestsCommon { auto [par2, cov2] = generateBoundParametersCovariance(rng, {}); ts.allocateCalibrated(3); - BOOST_CHECK_EQUAL(ts.template calibrated<3>(), ActsVector<3>::Zero()); + BOOST_CHECK_EQUAL(ts.template calibrated<3>(), Vector3::Zero()); BOOST_CHECK_EQUAL(ts.template calibratedCovariance<3>(), ActsSquareMatrix<3>::Zero()); diff --git a/Core/include/Acts/EventData/detail/TestSourceLink.hpp b/Core/include/Acts/EventData/detail/TestSourceLink.hpp index 9a6350e7df4..72f6bbba126 100644 --- a/Core/include/Acts/EventData/detail/TestSourceLink.hpp +++ b/Core/include/Acts/EventData/detail/TestSourceLink.hpp @@ -41,7 +41,7 @@ struct TestSourceLink final { std::size_t sourceId = 0u; // use eBoundSize to indicate unused indices std::array indices = {eBoundSize, eBoundSize}; - Acts::ActsVector<2> parameters; + Acts::Vector2 parameters; Acts::ActsSquareMatrix<2> covariance; /// Construct a source link for a 1d measurement. @@ -52,10 +52,10 @@ struct TestSourceLink final { sourceId(sid), indices{idx, eBoundSize}, parameters(val, 0), - covariance(Acts::ActsVector<2>(var, 0).asDiagonal()) {} + covariance(Acts::Vector2(var, 0).asDiagonal()) {} /// Construct a source link for a 2d measurement. TestSourceLink(BoundIndices idx0, BoundIndices idx1, - const Acts::ActsVector<2>& params, + const Acts::Vector2& params, const Acts::ActsSquareMatrix<2>& cov, GeometryIdentifier gid = GeometryIdentifier(), std::size_t sid = 0u) diff --git a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp index fb9d6ca15a7..5d7278219da 100644 --- a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include namespace Acts { @@ -47,8 +46,6 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { eSize }; - CutoutCylinderVolumeBounds() = delete; - /// Constructor from defining parameters /// /// @param rmin Minimum radius at the "choke points" @@ -73,8 +70,6 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { buildSurfaceBounds(); } - ~CutoutCylinderVolumeBounds() override = default; - VolumeBounds::BoundsType type() const final { return VolumeBounds::eCutoutCylinder; } @@ -151,24 +146,4 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { void checkConsistency() noexcept(false); }; -inline std::vector CutoutCylinderVolumeBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void CutoutCylinderVolumeBounds::checkConsistency() noexcept(false) { - if (get(eMinR) < 0. || get(eMedR) <= 0. || get(eMaxR) <= 0. || - get(eMinR) >= get(eMedR) || get(eMinR) >= get(eMaxR) || - get(eMedR) >= get(eMaxR)) { - throw std::invalid_argument( - "CutoutCylinderVolumeBounds: invalid radial input."); - } - if (get(eHalfLengthZ) <= 0 || get(eHalfLengthZcutout) <= 0. || - get(eHalfLengthZcutout) > get(eHalfLengthZ)) { - throw std::invalid_argument( - "CutoutCylinderVolumeBounds: invalid longitudinal input."); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Geometry/IConfinedTrackingVolumeBuilder.hpp b/Core/include/Acts/Geometry/IConfinedTrackingVolumeBuilder.hpp index c37ea3e9eb5..19ccf7d0e2d 100644 --- a/Core/include/Acts/Geometry/IConfinedTrackingVolumeBuilder.hpp +++ b/Core/include/Acts/Geometry/IConfinedTrackingVolumeBuilder.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include #include diff --git a/Core/include/Acts/Geometry/ITrackingGeometryBuilder.hpp b/Core/include/Acts/Geometry/ITrackingGeometryBuilder.hpp index 2967d3fe12a..d1d23136a4d 100644 --- a/Core/include/Acts/Geometry/ITrackingGeometryBuilder.hpp +++ b/Core/include/Acts/Geometry/ITrackingGeometryBuilder.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Geometry/GeometryContext.hpp" #include diff --git a/Core/include/Acts/Geometry/ProtoLayer.hpp b/Core/include/Acts/Geometry/ProtoLayer.hpp index 1e5d95dc025..cf33f255e15 100644 --- a/Core/include/Acts/Geometry/ProtoLayer.hpp +++ b/Core/include/Acts/Geometry/ProtoLayer.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Geometry/Extent.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Surfaces/Surface.hpp" diff --git a/Core/include/Acts/MagneticField/BFieldMapUtils.hpp b/Core/include/Acts/MagneticField/BFieldMapUtils.hpp index 4aa1934699b..ff46acfa78e 100644 --- a/Core/include/Acts/MagneticField/BFieldMapUtils.hpp +++ b/Core/include/Acts/MagneticField/BFieldMapUtils.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Units.hpp" #include "Acts/MagneticField/InterpolatedBFieldMap.hpp" diff --git a/Core/include/Acts/MagneticField/ConstantBField.hpp b/Core/include/Acts/MagneticField/ConstantBField.hpp index 7586cbcbace..577e3b69fee 100644 --- a/Core/include/Acts/MagneticField/ConstantBField.hpp +++ b/Core/include/Acts/MagneticField/ConstantBField.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" @@ -44,14 +45,14 @@ class ConstantBField final : public MagneticFieldProvider { return Result::success(m_BField); } - /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,ActsMatrix<3,3>&,MagneticFieldProvider::Cache&) const + /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,SquareMatrix3&,MagneticFieldProvider::Cache&) const /// /// @note The @p position is ignored and only kept as argument to provide /// a consistent interface with other magnetic field services. /// @note currently the derivative is not calculated /// @todo return derivative Result getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& derivative, + const Vector3& position, SquareMatrix3& derivative, MagneticFieldProvider::Cache& cache) const override { (void)position; (void)derivative; diff --git a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp index 92cdc0090c7..6fda27d4e1f 100644 --- a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp +++ b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp @@ -308,13 +308,13 @@ class InterpolatedBFieldMap : public InterpolatedMagneticField { return Result::success((*lcache.fieldCell).getField(gridPosition)); } - /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,ActsMatrix<3,3>&,MagneticFieldProvider::Cache&) const + /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,SquareMatrix3&,MagneticFieldProvider::Cache&) const /// /// @note currently the derivative is not calculated /// @note Cache is not used currently /// @todo return derivative Result getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& derivative, + const Vector3& position, SquareMatrix3& derivative, MagneticFieldProvider::Cache& cache) const final { (void)derivative; return getField(position, cache); diff --git a/Core/include/Acts/MagneticField/MagneticFieldProvider.hpp b/Core/include/Acts/MagneticField/MagneticFieldProvider.hpp index 44596b73d6e..be162775d5b 100644 --- a/Core/include/Acts/MagneticField/MagneticFieldProvider.hpp +++ b/Core/include/Acts/MagneticField/MagneticFieldProvider.hpp @@ -50,7 +50,7 @@ class MagneticFieldProvider { /// @param [in,out] cache Field provider specific cache object /// @return magnetic field vector virtual Result getFieldGradient(const Vector3& position, - ActsMatrix<3, 3>& derivative, + SquareMatrix3& derivative, Cache& cache) const = 0; virtual ~MagneticFieldProvider(); diff --git a/Core/include/Acts/MagneticField/MultiRangeBField.hpp b/Core/include/Acts/MagneticField/MultiRangeBField.hpp index 60b90097161..fe54e790a2d 100644 --- a/Core/include/Acts/MagneticField/MultiRangeBField.hpp +++ b/Core/include/Acts/MagneticField/MultiRangeBField.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/MagneticFieldError.hpp" @@ -61,7 +62,7 @@ class MultiRangeBField final : public MagneticFieldProvider { /// /// @warning This is not currently implemented. Result getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& /*unused*/, + const Vector3& position, SquareMatrix3& /*unused*/, MagneticFieldProvider::Cache& cache) const override; }; } // namespace Acts diff --git a/Core/include/Acts/MagneticField/NullBField.hpp b/Core/include/Acts/MagneticField/NullBField.hpp index d3c24ee59f3..043dd9e8180 100644 --- a/Core/include/Acts/MagneticField/NullBField.hpp +++ b/Core/include/Acts/MagneticField/NullBField.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" @@ -36,14 +37,14 @@ class NullBField final : public MagneticFieldProvider { return Result::success(m_BField); } - /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,ActsMatrix<3,3>&,MagneticFieldProvider::Cache&) const + /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,SquareMatrix3&,MagneticFieldProvider::Cache&) const /// /// @note The @p position is ignored and only kept as argument to provide /// a consistent interface with other magnetic field services. /// @note currently the derivative is not calculated /// @todo return derivative Result getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& derivative, + const Vector3& position, SquareMatrix3& derivative, MagneticFieldProvider::Cache& cache) const override { (void)position; (void)derivative; diff --git a/Core/include/Acts/MagneticField/SolenoidBField.hpp b/Core/include/Acts/MagneticField/SolenoidBField.hpp index b2162203eec..cc2cf5c447a 100644 --- a/Core/include/Acts/MagneticField/SolenoidBField.hpp +++ b/Core/include/Acts/MagneticField/SolenoidBField.hpp @@ -111,12 +111,12 @@ class SolenoidBField final : public MagneticFieldProvider { Result getField(const Vector3& position, MagneticFieldProvider::Cache& cache) const override; - /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,ActsMatrix<3,3>&,MagneticFieldProvider::Cache&) const + /// @copydoc MagneticFieldProvider::getFieldGradient(const Vector3&,SquareMatrix3&,MagneticFieldProvider::Cache&) const /// /// @note currently the derivative is not calculated /// @todo return derivative Result getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& derivative, + const Vector3& position, SquareMatrix3& derivative, MagneticFieldProvider::Cache& cache) const override; private: diff --git a/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp b/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp index cb7939534f5..c48bd9bbcc2 100644 --- a/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp +++ b/Core/include/Acts/Propagator/EigenStepperDefaultExtension.hpp @@ -175,10 +175,10 @@ struct EigenStepperDefaultExtension { auto dGdT = D.block<3, 3>(4, 4); auto dGdL = D.block<3, 1>(4, 7); - ActsMatrix<3, 3> dk1dT = ActsMatrix<3, 3>::Zero(); - ActsMatrix<3, 3> dk2dT = ActsMatrix<3, 3>::Identity(); - ActsMatrix<3, 3> dk3dT = ActsMatrix<3, 3>::Identity(); - ActsMatrix<3, 3> dk4dT = ActsMatrix<3, 3>::Identity(); + SquareMatrix3 dk1dT = SquareMatrix3::Zero(); + SquareMatrix3 dk2dT = SquareMatrix3::Identity(); + SquareMatrix3 dk3dT = SquareMatrix3::Identity(); + SquareMatrix3 dk4dT = SquareMatrix3::Identity(); Vector3 dk1dL = Vector3::Zero(); Vector3 dk2dL = Vector3::Zero(); diff --git a/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp b/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp index a3d88ea1997..935e747f3aa 100644 --- a/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp +++ b/Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp @@ -263,10 +263,10 @@ struct EigenStepperDenseExtension { auto dGdT = D.block<3, 3>(4, 4); auto dGdL = D.block<3, 1>(4, 7); - ActsMatrix<3, 3> dk1dT = ActsMatrix<3, 3>::Zero(); - ActsMatrix<3, 3> dk2dT = ActsMatrix<3, 3>::Identity(); - ActsMatrix<3, 3> dk3dT = ActsMatrix<3, 3>::Identity(); - ActsMatrix<3, 3> dk4dT = ActsMatrix<3, 3>::Identity(); + SquareMatrix3 dk1dT = SquareMatrix3::Zero(); + SquareMatrix3 dk2dT = SquareMatrix3::Identity(); + SquareMatrix3 dk3dT = SquareMatrix3::Identity(); + SquareMatrix3 dk4dT = SquareMatrix3::Identity(); Vector3 dk1dL = Vector3::Zero(); Vector3 dk2dL = Vector3::Zero(); diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.hpp b/Core/include/Acts/Seeding/HoughTransformUtils.hpp index 4fcece48034..db3f94b94c7 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.hpp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.hpp @@ -9,6 +9,7 @@ /// This file implements the tools for a hough transform. #pragma once + #include "Acts/Utilities/Delegate.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Logger.hpp" diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 942c20dc764..4e56b56dac7 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -10,18 +10,14 @@ #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" -#include "Acts/Utilities/detail/periodic.hpp" #include #include -#include #include #include -#include #include namespace Acts { @@ -49,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 @@ -74,7 +68,7 @@ class AnnulusBounds : public DiscBounds { AnnulusBounds(const AnnulusBounds& source) = default; - SurfaceBounds::BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eAnnulus; } /// Return the bound values as dynamically sized vector /// @@ -102,24 +96,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 @@ -150,10 +149,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; @@ -202,72 +201,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 { - 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/include/Acts/Surfaces/BoundaryTolerance.hpp b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp index 603b8a2abe9..5dfc7ad6552 100644 --- a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp +++ b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp @@ -10,11 +10,8 @@ #include "Acts/Definitions/Algebra.hpp" -#include -#include #include #include -#include namespace Acts { @@ -70,7 +67,12 @@ class BoundaryTolerance { AbsoluteBound() = default; AbsoluteBound(double tolerance0_, double tolerance1_) - : tolerance0(tolerance0_), tolerance1(tolerance1_) {} + : tolerance0(tolerance0_), tolerance1(tolerance1_) { + if (tolerance0 < 0 || tolerance1 < 0) { + throw std::invalid_argument( + "AbsoluteBound: Tolerance must be non-negative"); + } + } }; /// Absolute tolerance in Cartesian coordinates @@ -80,7 +82,16 @@ class BoundaryTolerance { AbsoluteCartesian() = default; AbsoluteCartesian(double tolerance0_, double tolerance1_) - : tolerance0(tolerance0_), tolerance1(tolerance1_) {} + : tolerance0(tolerance0_), tolerance1(tolerance1_) { + if (tolerance0 < 0 || tolerance1 < 0) { + throw std::invalid_argument( + "AbsoluteCartesian: Tolerance must be non-negative"); + } + if ((tolerance0 == 0) != (tolerance1 == 0)) { + throw std::invalid_argument( + "AbsoluteCartesian: Both tolerances must be zero or non-zero"); + } + } }; /// Absolute tolerance in Euclidean distance @@ -101,6 +112,12 @@ class BoundaryTolerance { : maxChi2(maxChi2_), weight(weight_) {} }; + enum class ToleranceMode { + Extend, // Extend the boundary + None, // No tolerance + Shrink // Shrink the boundary + }; + /// Underlying variant type using Variant = std::variant; @@ -135,7 +152,7 @@ class BoundaryTolerance { bool hasChi2Bound() const; /// Check if any tolerance is set. - bool hasTolerance() const; + ToleranceMode toleranceMode() const; /// Get the tolerance as absolute bound. AbsoluteBound asAbsoluteBound(bool isCartesian = false) const; diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index d0d684016a8..7d852f2df87 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -9,17 +9,14 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#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 { @@ -34,7 +31,6 @@ namespace Acts { /// /// @image html ConeBounds.gif /// - class ConeBounds : public SurfaceBounds { public: enum BoundValues : int { @@ -46,8 +42,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 /// @@ -77,9 +71,7 @@ class ConeBounds : public SurfaceBounds { /// @param values The parameter array ConeBounds(const std::array& values) noexcept(false); - ~ConeBounds() override = default; - - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eCone; } /// Return the bound values as dynamically sized vector /// @@ -105,10 +97,10 @@ class ConeBounds : public SurfaceBounds { /// /// @param z is the z value for which r is requested /// @return is the r value associated with z - double r(double z) const; + double r(double z) const { return std::abs(z * m_tanAlpha); } /// Return tangent of alpha (pre-computed) - double tanAlpha() const; + double tanAlpha() const { return m_tanAlpha; } /// Access to the bound values /// @param bValue the class nested enum for the array access @@ -124,38 +116,10 @@ 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; }; -inline double ConeBounds::r(double z) const { - return std::abs(z * m_tanAlpha); -} - -inline double ConeBounds::tanAlpha() const { - return m_tanAlpha; -} - -inline std::vector ConeBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void ConeBounds::checkConsistency() noexcept(false) { - if (get(eAlpha) < 0. || get(eAlpha) >= std::numbers::pi) { - throw std::invalid_argument("ConeBounds: invalid open angle."); - } - if (get(eMinZ) > get(eMaxZ) || - std::abs(get(eMinZ) - get(eMaxZ)) < s_epsilon) { - throw std::invalid_argument("ConeBounds: invalid z range setup."); - } - if (get(eHalfPhiSector) < 0. || abs(eHalfPhiSector) > std::numbers::pi) { - throw std::invalid_argument("ConeBounds: invalid phi sector setup."); - } - if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { - throw std::invalid_argument("ConeBounds: invalid phi positioning."); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/ConeSurface.hpp b/Core/include/Acts/Surfaces/ConeSurface.hpp index 2f88bfe9532..34ebaf49694 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; @@ -85,9 +82,6 @@ class ConeSurface : public RegularSurface { const Transform3& shift); public: - ~ConeSurface() override = default; - ConeSurface() = delete; - /// Assignment operator /// /// @param other is the source surface for the assignment diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index e802056e7fd..afb5bb406f9 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 @@ -82,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. @@ -100,9 +95,7 @@ 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; + BoundsType type() const final { return SurfaceBounds::eConvexPolygon; } /// Return whether a local 2D point lies inside of the bounds defined by this /// object. @@ -146,12 +139,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. @@ -159,7 +146,7 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// Return the bounds type of this bounds object. /// @return The bounds type - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eConvexPolygon; } /// 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 9f1a61955ae..8201a9dedd6 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -6,13 +6,9 @@ // 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/Utilities/ThrowAssert.hpp" -#include -#include - template requires std::same_as void Acts::ConvexPolygonBoundsBase::convex_impl( @@ -96,11 +92,6 @@ Acts::ConvexPolygonBounds::ConvexPolygonBounds( checkConsistency(); } -template -Acts::SurfaceBounds::BoundsType Acts::ConvexPolygonBounds::type() const { - return SurfaceBounds::eConvexPolygon; -} - 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 d144c8b995b..10fab504635 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 { @@ -60,8 +57,6 @@ class CylinderBounds : public SurfaceBounds { eSize = 6 }; - CylinderBounds() = delete; - /// Constructor - full cylinder /// /// @param r The radius of the cylinder @@ -88,9 +83,7 @@ class CylinderBounds : public SurfaceBounds { checkConsistency(); } - ~CylinderBounds() override = default; - - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eCylinder; } /// Return the bound values as dynamically sized vector /// @@ -112,7 +105,7 @@ class CylinderBounds : public SurfaceBounds { double get(BoundValues bValue) const { return m_values[bValue]; } /// Returns true for full phi coverage - bool coversFullAzimuth() const; + bool coversFullAzimuth() const { return m_closed; } /// Create the bow/circle vertices on either side of the cylinder /// @@ -145,17 +138,7 @@ class CylinderBounds : public SurfaceBounds { Vector2 shifted(const Vector2& lposition) const; /// Return the jacobian into the polar coordinate - ActsMatrix<2, 2> jacobian() const; + SquareMatrix2 jacobian() const; }; -inline std::vector CylinderBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline bool CylinderBounds::coversFullAzimuth() const { - return m_closed; -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index 971ff7039f7..2f64852dbee 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 @@ -90,9 +87,6 @@ class CylinderSurface : public RegularSurface { const Transform3& shift); public: - ~CylinderSurface() override = default; - CylinderSurface() = delete; - /// Assignment operator /// /// @param other is the source cylinder for the copy diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index 7497bd22309..096efc2dd27 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,9 +16,7 @@ #include #include -#include #include -#include #include namespace Acts { @@ -39,8 +36,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,9 +66,7 @@ class DiamondBounds : public PlanarBounds { Vector2{*std::max_element(values.begin(), values.begin() + 2), values[eHalfLengthYpos]}) {} - ~DiamondBounds() override = default; - - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eDiamond; } /// Return the bound values as dynamically sized vector /// @@ -119,20 +112,4 @@ class DiamondBounds : public PlanarBounds { void checkConsistency() noexcept(false); }; -inline std::vector DiamondBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void DiamondBounds::checkConsistency() noexcept(false) { - if (std::ranges::any_of(m_values, [](auto v) { return v <= 0.; })) { - throw std::invalid_argument("DiamondBounds: negative half length."); - } - if (get(eHalfLengthXnegY) > get(eHalfLengthXzeroY) || - get(eHalfLengthXposY) > get(eHalfLengthXzeroY)) { - throw std::invalid_argument("DiamondBounds: not a diamond shape."); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/DiscSurface.hpp b/Core/include/Acts/Surfaces/DiscSurface.hpp index 6a3144a00aa..01e6bbd297c 100644 --- a/Core/include/Acts/Surfaces/DiscSurface.hpp +++ b/Core/include/Acts/Surfaces/DiscSurface.hpp @@ -15,15 +15,12 @@ #include "Acts/Geometry/Polyhedron.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" -#include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceConcept.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Result.hpp" -#include -#include #include #include #include @@ -109,9 +106,6 @@ class DiscSurface : public RegularSurface { const Transform3& shift); public: - ~DiscSurface() override = default; - DiscSurface() = delete; - /// Assignment operator /// /// @param other The source sourface for the assignment diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index 32c63c2aef6..57ffd86586a 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -7,19 +7,17 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #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 -#include #include namespace Acts { @@ -29,7 +27,7 @@ namespace Acts { /// Class to describe the bounds for a planar DiscSurface. /// By providing an argument for hphisec, the bounds can /// be restricted to a phi-range around the center position. - +/// class DiscTrapezoidBounds : public DiscBounds { public: enum BoundValues : int { @@ -42,8 +40,6 @@ class DiscTrapezoidBounds : public DiscBounds { eSize = 6 }; - DiscTrapezoidBounds() = delete; - /// Constructor for a symmetric Trapezoid giving min X length, max X length, /// Rmin and R max /// @param halfXminR half length in X at min radius @@ -64,9 +60,7 @@ class DiscTrapezoidBounds : public DiscBounds { checkConsistency(); } - ~DiscTrapezoidBounds() override = default; - - SurfaceBounds::BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eDiscTrapezoid; } /// Return the bound values as dynamically sized vector /// @@ -91,35 +85,57 @@ class DiscTrapezoidBounds : public DiscBounds { double get(BoundValues bValue) const { return m_values[bValue]; } /// 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); } /// This method returns the center radius - double rCenter() const; + double rCenter() const { + double rmin = get(eMinR); + double rmax = get(eMaxR); + double hxmin = get(eHalfLengthXminR); + double hxmax = get(eHalfLengthXmaxR); + auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin); + auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax); + return 0.5 * (hmin + hmax); + } /// This method returns the stereo angle - double stereo() const; + double stereo() const { return get(eStereo); } /// This method returns the halfPhiSector which is covered by the disc - double halfPhiSector() const; + double halfPhiSector() const { + auto minHalfPhi = std::asin(get(eHalfLengthXminR) / get(eMinR)); + auto maxHalfPhi = std::asin(get(eHalfLengthXmaxR) / get(eMaxR)); + return std::max(minHalfPhi, maxHalfPhi); + } /// This method returns the half length in Y (this is Rmax -Rmin) - double halfLengthY() const; + double halfLengthY() const { + double rmin = get(eMinR); + double rmax = get(eMaxR); + double hxmin = get(eHalfLengthXminR); + double hxmax = get(eHalfLengthXmaxR); + auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin); + auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax); + return 0.5 * (hmax - hmin); + } /// Returns true for full phi coverage - obviously false here - bool coversFullAzimuth() const final; + bool coversFullAzimuth() const final { return false; } /// 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 phi for binning - double binningValuePhi() const final; + double binningValuePhi() const final { return get(eAveragePhi); } /// This method returns the xy coordinates of the four corners of the /// bounds in module coorindates (in xy) @@ -150,81 +166,7 @@ class DiscTrapezoidBounds : public DiscBounds { /// into its Cartesian representation /// /// @param lposition The local position in polar coordinates - ActsMatrix<2, 2> jacobianToLocalCartesian(const Vector2& lposition) const; + SquareMatrix2 jacobianToLocalCartesian(const Vector2& lposition) const; }; -inline double DiscTrapezoidBounds::rMin() const { - return get(eMinR); -} - -inline double DiscTrapezoidBounds::rMax() const { - return get(eMaxR); -} - -inline double DiscTrapezoidBounds::stereo() const { - return get(eStereo); -} - -inline double DiscTrapezoidBounds::halfPhiSector() const { - auto minHalfPhi = std::asin(get(eHalfLengthXminR) / get(eMinR)); - auto maxHalfPhi = std::asin(get(eHalfLengthXmaxR) / get(eMaxR)); - return std::max(minHalfPhi, maxHalfPhi); -} - -inline double DiscTrapezoidBounds::rCenter() const { - double rmin = get(eMinR); - double rmax = get(eMaxR); - double hxmin = get(eHalfLengthXminR); - double hxmax = get(eHalfLengthXmaxR); - auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin); - auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax); - return 0.5 * (hmin + hmax); -} - -inline double DiscTrapezoidBounds::halfLengthY() const { - double rmin = get(eMinR); - double rmax = get(eMaxR); - double hxmin = get(eHalfLengthXminR); - double hxmax = get(eHalfLengthXmaxR); - auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin); - auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax); - return 0.5 * (hmax - hmin); -} - -inline bool DiscTrapezoidBounds::coversFullAzimuth() const { - return false; -} - -inline bool DiscTrapezoidBounds::insideRadialBounds(double R, - double tolerance) const { - return (R + tolerance > get(eMinR) && R - tolerance < get(eMaxR)); -} - -inline double DiscTrapezoidBounds::binningValueR() const { - return 0.5 * (get(eMinR) + get(eMaxR)); -} - -inline double DiscTrapezoidBounds::binningValuePhi() const { - return get(eAveragePhi); -} - -inline std::vector DiscTrapezoidBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void DiscTrapezoidBounds::checkConsistency() noexcept(false) { - if (get(eMinR) < 0. || get(eMaxR) <= 0. || get(eMinR) > get(eMaxR)) { - throw std::invalid_argument("DiscTrapezoidBounds: invalid radial setup."); - } - if (get(eHalfLengthXminR) < 0. || get(eHalfLengthXmaxR) <= 0.) { - throw std::invalid_argument("DiscTrapezoidBounds: negative length given."); - } - if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { - throw std::invalid_argument( - "DiscTrapezoidBounds: invalid phi positioning."); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index ea90e3d2a88..007c0fd0aff 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -13,15 +13,10 @@ #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Utilities/detail/periodic.hpp" #include -#include -#include -#include #include #include -#include #include namespace Acts { @@ -47,8 +42,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,9 +66,7 @@ class EllipseBounds : public PlanarBounds { checkConsistency(); } - ~EllipseBounds() override = default; - - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eEllipse; } /// Return the bound values as dynamically sized vector /// @@ -86,6 +77,8 @@ class EllipseBounds : public PlanarBounds { /// 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 @@ -121,27 +114,4 @@ class EllipseBounds : public PlanarBounds { void checkConsistency() noexcept(false); }; -inline std::vector EllipseBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void EllipseBounds::checkConsistency() noexcept(false) { - if (get(eInnerRx) >= get(eOuterRx) || get(eInnerRx) < 0. || - get(eOuterRx) <= 0.) { - throw std::invalid_argument("EllipseBounds: invalid along x axis"); - } - if (get(eInnerRy) >= get(eOuterRy) || get(eInnerRy) < 0. || - get(eOuterRy) <= 0.) { - throw std::invalid_argument("EllipseBounds: invalid along y axis."); - } - if (get(eHalfPhiSector) < 0. || get(eHalfPhiSector) > std::numbers::pi) { - throw std::invalid_argument("EllipseBounds: invalid phi sector setup."); - } - if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { - throw std::invalid_argument("EllipseBounds: invalid phi positioning."); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 261f40e4729..e08ff779cbf 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -17,16 +17,10 @@ namespace Acts { /// /// templated boundless extension to forward the interface /// Returns all inside checks to true and can templated for all bounds - +/// class InfiniteBounds : public SurfaceBounds { public: - InfiniteBounds() = default; - - ~InfiniteBounds() override = default; - - SurfaceBounds::BoundsType type() const final { - return SurfaceBounds::eBoundless; - } + BoundsType type() const final { return SurfaceBounds::eBoundless; } std::vector values() const final { return {}; } diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index e3169d8a845..7a8d2af2468 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -14,7 +14,6 @@ #include #include -#include #include namespace Acts { @@ -26,8 +25,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. @@ -44,9 +41,7 @@ class LineBounds : public SurfaceBounds { checkConsistency(); } - ~LineBounds() override = default; - - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eLine; } /// Return the bound values as dynamically sized vector /// @@ -81,19 +76,4 @@ class LineBounds : public SurfaceBounds { void checkConsistency() noexcept(false); }; -inline std::vector LineBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void LineBounds::checkConsistency() noexcept(false) { - if (get(eR) < 0.) { - throw std::invalid_argument("LineBounds: zero radius."); - } - if (get(eHalfLengthZ) <= 0.) { - throw std::invalid_argument("LineBounds: zero/negative length."); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/LineSurface.hpp b/Core/include/Acts/Surfaces/LineSurface.hpp index 15af6aa6be8..79660e17dca 100644 --- a/Core/include/Acts/Surfaces/LineSurface.hpp +++ b/Core/include/Acts/Surfaces/LineSurface.hpp @@ -7,14 +7,13 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #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" -#include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/LineBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/BinningType.hpp" @@ -80,9 +79,6 @@ class LineSurface : public Surface { const Transform3& shift); public: - ~LineSurface() override = default; - LineSurface() = delete; - /// Assignment operator /// /// @param other is the source surface dor copying diff --git a/Core/include/Acts/Surfaces/PerigeeSurface.hpp b/Core/include/Acts/Surfaces/PerigeeSurface.hpp index 1d913ecc43e..660e0b3ad93 100644 --- a/Core/include/Acts/Surfaces/PerigeeSurface.hpp +++ b/Core/include/Acts/Surfaces/PerigeeSurface.hpp @@ -7,15 +7,14 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/Polyhedron.hpp" -#include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/LineSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceConcept.hpp" -#include #include #include @@ -56,12 +55,6 @@ class PerigeeSurface : public LineSurface { const Transform3& shift); public: - /// Destructor - defaulted - ~PerigeeSurface() override = default; - - /// Default Constructor - deleted - PerigeeSurface() = delete; - /// Assignment operator /// /// @param other is the source surface to be assigned 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 ef3e8996572..f10884e5b75 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -9,17 +9,13 @@ #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 #include namespace Acts { @@ -40,8 +36,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) @@ -62,9 +56,7 @@ class RadialBounds : public DiscBounds { checkConsistency(); } - ~RadialBounds() override = default; - - SurfaceBounds::BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eDisc; } /// Return the bound values as dynamically sized vector /// @@ -86,27 +78,31 @@ class RadialBounds : public DiscBounds { std::ostream& toStream(std::ostream& sl) const final; /// Return method for inner Radius - double rMin() const final; + double rMin() const final { return get(eMinR); } /// Return method for outer Radius - double rMax() const final; + double rMax() const final { return get(eMaxR); } /// Access to the bound values /// @param bValue the class nested enum for the array access double get(BoundValues bValue) const { return m_values[bValue]; } /// Returns true for full phi coverage - bool coversFullAzimuth() const final; + bool coversFullAzimuth() const final { + return (get(eHalfPhiSector) == std::numbers::pi); + } /// 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); } private: std::array m_values; @@ -134,46 +130,4 @@ class RadialBounds : public DiscBounds { std::vector vertices(unsigned int lseg) const final; }; -inline double RadialBounds::rMin() const { - return get(eMinR); -} - -inline double RadialBounds::rMax() const { - return get(eMaxR); -} - -inline bool RadialBounds::coversFullAzimuth() const { - return (get(eHalfPhiSector) == std::numbers::pi); -} - -inline bool RadialBounds::insideRadialBounds(double R, double tolerance) const { - return (R + tolerance > get(eMinR) && R - tolerance < get(eMaxR)); -} - -inline double RadialBounds::binningValueR() const { - return 0.5 * (get(eMinR) + get(eMaxR)); -} - -inline double RadialBounds::binningValuePhi() const { - return get(eAveragePhi); -} - -inline std::vector RadialBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - -inline void RadialBounds::checkConsistency() noexcept(false) { - if (get(eMinR) < 0. || get(eMaxR) <= 0. || get(eMinR) > get(eMaxR)) { - throw std::invalid_argument("RadialBounds: invalid radial setup"); - } - if (get(eHalfPhiSector) < 0. || get(eHalfPhiSector) > std::numbers::pi) { - throw std::invalid_argument("RadialBounds: invalid phi sector setup."); - } - if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { - throw std::invalid_argument("RadialBounds: invalid phi positioning."); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index aba1743fa74..87620dadab8 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -14,10 +14,7 @@ #include "Acts/Surfaces/SurfaceBounds.hpp" #include -#include #include -#include -#include #include namespace Acts { @@ -39,8 +36,6 @@ class RectangleBounds : public PlanarBounds { eSize = 4 }; - RectangleBounds() = delete; - /// Constructor with halflength in x and y - symmetric /// /// @param halfX halflength in X @@ -68,11 +63,11 @@ class RectangleBounds : public PlanarBounds { checkConsistency(); } - ~RectangleBounds() override = default; - - BoundsType type() const final; + BoundsType type() const final { return SurfaceBounds::eRectangle; } - std::vector values() const final; + std::vector values() const final { + return {m_min.x(), m_min.y(), m_max.x(), m_max.y()}; + } /// 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 @@ -106,18 +101,18 @@ class RectangleBounds : public PlanarBounds { double get(BoundValues bValue) const; /// Access to the half length in X - double halfLengthX() const; + double halfLengthX() const { return 0.5 * (m_max.x() - m_min.x()); } /// Access to the half length in Y - double halfLengthY() const; + double halfLengthY() const { return 0.5 * (m_max.y() - m_min.y()); } /// Get the min vertex defining the bounds /// @return The min vertex - const Vector2& min() const; + const Vector2& min() const { return m_min; } /// Get the max vertex defining the bounds /// @return The max vertex - const Vector2& max() const; + const Vector2& max() const { return m_max; } private: Vector2 m_min; @@ -128,53 +123,4 @@ class RectangleBounds : public PlanarBounds { void checkConsistency() noexcept(false); }; -inline SurfaceBounds::BoundsType RectangleBounds::type() const { - return SurfaceBounds::eRectangle; -} - -inline const Vector2& RectangleBounds::min() const { - return m_min; -} - -inline const Vector2& RectangleBounds::max() const { - return m_max; -} - -inline double RectangleBounds::halfLengthX() const { - return 0.5 * (m_max.x() - m_min.x()); -} - -inline double RectangleBounds::halfLengthY() const { - return 0.5 * (m_max.y() - m_min.y()); -} - -inline std::vector RectangleBounds::values() const { - return {m_min.x(), m_min.y(), m_max.x(), m_max.y()}; -} - -inline double RectangleBounds::get(BoundValues bValue) const { - switch (bValue) { - case eMinX: - return m_min.x(); - case eMinY: - return m_min.y(); - case eMaxX: - return m_max.x(); - case eMaxY: - return m_max.y(); - default: - assert(false && "Invalid BoundValue enum value"); - return std::numeric_limits::quiet_NaN(); - } -} - -inline void RectangleBounds::checkConsistency() noexcept(false) { - if (get(eMinX) > get(eMaxX)) { - throw std::invalid_argument("RectangleBounds: invalid local x setup"); - } - if (get(eMinY) > get(eMaxY)) { - throw std::invalid_argument("RectangleBounds: invalid local y setup"); - } -} - } // namespace Acts diff --git a/Core/include/Acts/Surfaces/RegularSurface.hpp b/Core/include/Acts/Surfaces/RegularSurface.hpp index f091c73b99a..48a35302f12 100644 --- a/Core/include/Acts/Surfaces/RegularSurface.hpp +++ b/Core/include/Acts/Surfaces/RegularSurface.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Tolerance.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/ThrowAssert.hpp" namespace Acts { @@ -116,4 +115,5 @@ class RegularSurface : public Surface { using Surface::isOnSurface; }; + } // namespace Acts diff --git a/Core/include/Acts/Surfaces/StrawSurface.hpp b/Core/include/Acts/Surfaces/StrawSurface.hpp index 706bb7d9823..f638723ce8f 100644 --- a/Core/include/Acts/Surfaces/StrawSurface.hpp +++ b/Core/include/Acts/Surfaces/StrawSurface.hpp @@ -15,7 +15,6 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceConcept.hpp" -#include #include #include @@ -75,19 +74,16 @@ class StrawSurface : public LineSurface { const Transform3& shift); public: - ~StrawSurface() override = default; - StrawSurface() = delete; - /// Assignment operator /// /// @param other is the source surface for copying StrawSurface& operator=(const StrawSurface& other); /// Return the surface type - SurfaceType type() const final; + SurfaceType type() const final { return Surface::Straw; } /// Return properly formatted class name for screen output */ - std::string name() const final; + std::string name() const final { return "Acts::StrawSurface"; } /// Return a Polyhedron for the surfaces /// @@ -101,14 +97,6 @@ class StrawSurface : public LineSurface { unsigned int quarterSegments) const final; }; -inline Surface::SurfaceType StrawSurface::type() const { - return Surface::Straw; -} - -inline std::string Acts::StrawSurface::name() const { - return "Acts::StrawSurface"; -} - static_assert(SurfaceConcept, "StrawSurface does not fulfill SurfaceConcept"); diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index 43d8161aa8c..6bd1c126a93 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 { diff --git a/Core/include/Acts/Surfaces/SurfaceArray.hpp b/Core/include/Acts/Surfaces/SurfaceArray.hpp index 94a571268d5..ee40434f102 100644 --- a/Core/include/Acts/Surfaces/SurfaceArray.hpp +++ b/Core/include/Acts/Surfaces/SurfaceArray.hpp @@ -7,10 +7,10 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Axis.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/IAxis.hpp" diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 62216f75c29..aae4e61e273 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" diff --git a/Core/include/Acts/Surfaces/SurfaceConcept.hpp b/Core/include/Acts/Surfaces/SurfaceConcept.hpp index 2abcda1d5d7..54c705d9bb9 100644 --- a/Core/include/Acts/Surfaces/SurfaceConcept.hpp +++ b/Core/include/Acts/Surfaces/SurfaceConcept.hpp @@ -119,4 +119,5 @@ concept RegularSurfaceConcept = { cs.isOnSurface(gctx, Vector3{}, tolerance) } -> std::same_as; }; + } // namespace Acts diff --git a/Core/include/Acts/Surfaces/SurfaceMergingException.hpp b/Core/include/Acts/Surfaces/SurfaceMergingException.hpp index f2ae605aab7..6887d7c08fc 100644 --- a/Core/include/Acts/Surfaces/SurfaceMergingException.hpp +++ b/Core/include/Acts/Surfaces/SurfaceMergingException.hpp @@ -32,4 +32,5 @@ class SurfaceMergingException : public std::exception { std::weak_ptr m_surfaceB; std::string m_message; }; + } // namespace Acts diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index 8ccd3a5c928..f8bfebe2971 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -7,18 +7,15 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #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 { @@ -40,8 +37,6 @@ class TrapezoidBounds : public PlanarBounds { eSize = 4 }; - TrapezoidBounds() = delete; - /// Constructor for symmetric Trapezoid /// /// @param halfXnegY minimal half length X, definition at negative Y @@ -56,9 +51,7 @@ 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; + BoundsType type() const final { return SurfaceBounds::eTrapezoid; } std::vector values() const final; diff --git a/Core/include/Acts/Surfaces/detail/AlignmentHelper.hpp b/Core/include/Acts/Surfaces/detail/AlignmentHelper.hpp index 5d4ef72b8bd..3c46793fa56 100644 --- a/Core/include/Acts/Surfaces/detail/AlignmentHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/AlignmentHelper.hpp @@ -11,8 +11,6 @@ #include "Acts/Definitions/Algebra.hpp" #include -#include -#include namespace Acts::detail { diff --git a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp b/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp index 898fe5541ae..86b61770ae7 100644 --- a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp @@ -8,6 +8,7 @@ #pragma once +#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include @@ -28,16 +29,22 @@ inline bool insideAlignedBox(const Vector2& lowerLeft, const BoundaryTolerance& tolerance, const Vector2& point, const std::optional& jacobianOpt) { + using enum BoundaryTolerance::ToleranceMode; + if (tolerance.isInfinite()) { return true; } - if (detail::VerticesHelper::isInsideRectangle(point, lowerLeft, upperRight)) { - return true; + BoundaryTolerance::ToleranceMode mode = tolerance.toleranceMode(); + bool insideRectangle = + detail::VerticesHelper::isInsideRectangle(point, lowerLeft, upperRight); + + if (mode == None) { + return insideRectangle; } - if (!tolerance.hasTolerance()) { - return false; + if (mode == Extend && insideRectangle) { + return true; } Vector2 closestPoint; @@ -63,7 +70,11 @@ inline bool insideAlignedBox(const Vector2& lowerLeft, Vector2 distance = closestPoint - point; - return tolerance.isTolerated(distance, jacobianOpt); + if (mode == Extend) { + return tolerance.isTolerated(distance, jacobianOpt); + } else { + return tolerance.isTolerated(distance, jacobianOpt) && insideRectangle; + } } /// Check if a point is inside a polygon. @@ -78,23 +89,27 @@ inline bool insidePolygon(std::span vertices, const BoundaryTolerance& tolerance, const Vector2& point, const std::optional& jacobianOpt) { + using enum BoundaryTolerance::ToleranceMode; 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; - } + BoundaryTolerance::ToleranceMode mode = tolerance.toleranceMode(); + bool insidePolygon = detail::VerticesHelper::isInsidePolygon(point, vertices); - if (!tolerance.hasTolerance()) { + if (mode == None) { + // If the point falls inside the polygon, the check always succeeds // 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; + return insidePolygon; + } + + if (mode == Extend && insidePolygon) { + return true; } // TODO: When tolerance is not 0, we could also avoid this computation in @@ -111,7 +126,12 @@ inline bool insidePolygon(std::span vertices, Vector2 distance = closestPoint - point; - return tolerance.isTolerated(distance, jacobianOpt); + if (mode == Extend) { + return tolerance.isTolerated(distance, jacobianOpt); + } else { + // @TODO: Check sign + return tolerance.isTolerated(-distance, jacobianOpt) && insidePolygon; + } } } // namespace Acts::detail diff --git a/Core/include/Acts/Surfaces/detail/MergeHelper.hpp b/Core/include/Acts/Surfaces/detail/MergeHelper.hpp index ed396c9e6ad..5bd44108249 100644 --- a/Core/include/Acts/Surfaces/detail/MergeHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/MergeHelper.hpp @@ -8,13 +8,8 @@ #pragma once -#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Definitions/Units.hpp" #include "Acts/Utilities/Logger.hpp" -#include "Acts/Utilities/detail/periodic.hpp" - -#include namespace Acts::detail { diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index 1ab019b59ce..e2ffcf9bc11 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -689,8 +689,12 @@ class CombinatorialKalmanFilter { materialInteractor(navigator.currentSurface(state.navigation), state, stepper, navigator, MaterialUpdateStage::PostUpdate); + // Set path limit based on loop protection detail::setupLoopProtection(state, stepper, result.pathLimitReached, true, logger()); + + // Set path limit based on target surface + targetReached.checkAbort(state, stepper, navigator, logger()); } /// @brief CombinatorialKalmanFilter actor operation: diff --git a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp index 4efcd82e4c4..fcada49abc2 100644 --- a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp +++ b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp @@ -77,20 +77,6 @@ struct GaussianSumFitter { /// The actor type using GsfActor = detail::GsfActor; - /// This allows to break the propagation by setting the navigationBreak - /// TODO refactor once we can do this more elegantly - struct NavigationBreakAborter { - NavigationBreakAborter() = default; - - template - bool checkAbort(propagator_state_t& state, const stepper_t& /*stepper*/, - const navigator_t& navigator, - const Logger& /*logger*/) const { - return navigator.navigationBreak(state.navigation); - } - }; - /// @brief The fit function for the Direct navigator template @@ -105,7 +91,7 @@ struct GaussianSumFitter { // Initialize the forward propagation with the DirectNavigator auto fwdPropInitializer = [&sSequence, this](const auto& opts) { - using Actors = ActorList; + using Actors = ActorList; using PropagatorOptions = typename propagator_t::template Options; PropagatorOptions propOptions(opts.geoContext, opts.magFieldContext); @@ -151,8 +137,7 @@ struct GaussianSumFitter { // Initialize the forward propagation with the DirectNavigator auto fwdPropInitializer = [this](const auto& opts) { - using Actors = - ActorList; + using Actors = ActorList; using PropagatorOptions = typename propagator_t::template Options; PropagatorOptions propOptions(opts.geoContext, opts.magFieldContext); diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index 6d5ac68d8b9..3c5d602acdb 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -317,13 +317,20 @@ struct GsfActor { applyMultipleScattering(state, stepper, navigator, MaterialUpdateStage::PostUpdate); } + } - // Break the navigation if we found all measurements + template + bool checkAbort(propagator_state_t& /*state*/, const stepper_t& /*stepper*/, + const navigator_t& /*navigator*/, const result_type& result, + const Logger& /*logger*/) const { if (m_cfg.numberMeasurements && result.measurementStates == m_cfg.numberMeasurements) { ACTS_VERBOSE("Stop navigation because all measurements are found"); - navigator.navigationBreak(state.navigation, true); + return true; } + + return false; } template #include #include diff --git a/Core/include/Acts/Utilities/HashedString.hpp b/Core/include/Acts/Utilities/HashedString.hpp index 88b50a34d05..308c0482ba9 100644 --- a/Core/include/Acts/Utilities/HashedString.hpp +++ b/Core/include/Acts/Utilities/HashedString.hpp @@ -46,7 +46,7 @@ constexpr HashedString hashStringDynamic(std::string_view s) { } namespace HashedStringLiteral { -constexpr HashedString operator"" _hash(char const* s, std::size_t count) { +constexpr HashedString operator""_hash(char const* s, std::size_t count) { return detail::fnv1a_32(s, count); } 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/include/Acts/Utilities/VectorHelpers.hpp b/Core/include/Acts/Utilities/VectorHelpers.hpp index bec3e874cf9..e2c78619a3f 100644 --- a/Core/include/Acts/Utilities/VectorHelpers.hpp +++ b/Core/include/Acts/Utilities/VectorHelpers.hpp @@ -178,8 +178,8 @@ inline double cast(const Vector3& position, BinningValue bval) { /// @param [in] m Matrix that will be used for cross products /// @param [in] v Vector for cross products /// @return Constructed matrix -inline ActsMatrix<3, 3> cross(const ActsMatrix<3, 3>& m, const Vector3& v) { - ActsMatrix<3, 3> r; +inline SquareMatrix3 cross(const SquareMatrix3& m, const Vector3& v) { + SquareMatrix3 r; r.col(0) = m.col(0).cross(v); r.col(1) = m.col(1).cross(v); r.col(2) = m.col(2).cross(v); diff --git a/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp b/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp index c208a4a1d98..745dd0d1f83 100644 --- a/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp +++ b/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp @@ -11,6 +11,7 @@ /////////////////////////////////////////////////////////////////// #pragma once + #include #include diff --git a/Core/include/Acts/Vertexing/AdaptiveGridTrackDensity.hpp b/Core/include/Acts/Vertexing/AdaptiveGridTrackDensity.hpp index a5e276674eb..0a5b6de8077 100644 --- a/Core/include/Acts/Vertexing/AdaptiveGridTrackDensity.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveGridTrackDensity.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/Utilities/Result.hpp" diff --git a/Core/include/Acts/Vertexing/GaussianGridTrackDensity.hpp b/Core/include/Acts/Vertexing/GaussianGridTrackDensity.hpp index 0a4a19d3165..55b1aefe83e 100644 --- a/Core/include/Acts/Vertexing/GaussianGridTrackDensity.hpp +++ b/Core/include/Acts/Vertexing/GaussianGridTrackDensity.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/Utilities/Result.hpp" diff --git a/Core/src/Geometry/ConeVolumeBounds.cpp b/Core/src/Geometry/ConeVolumeBounds.cpp index ebc1262c1b8..425166abcd0 100644 --- a/Core/src/Geometry/ConeVolumeBounds.cpp +++ b/Core/src/Geometry/ConeVolumeBounds.cpp @@ -26,10 +26,10 @@ #include #include #include -#include #include namespace Acts { + ConeVolumeBounds::ConeVolumeBounds(double innerAlpha, double innerOffsetZ, double outerAlpha, double outerOffsetZ, double halflengthZ, double averagePhi, @@ -92,6 +92,10 @@ ConeVolumeBounds::ConeVolumeBounds(double cylinderR, double alpha, checkConsistency(); } +std::vector ConeVolumeBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + std::vector Acts::ConeVolumeBounds::orientedSurfaces( const Transform3& transform) const { std::vector oSurfaces; @@ -334,10 +338,4 @@ double ConeVolumeBounds::outerTanAlpha() const { return m_outerTanAlpha; } -std::vector ConeVolumeBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - } // namespace Acts diff --git a/Core/src/Geometry/CuboidVolumeBounds.cpp b/Core/src/Geometry/CuboidVolumeBounds.cpp index be2443c9691..a8b1729c74a 100644 --- a/Core/src/Geometry/CuboidVolumeBounds.cpp +++ b/Core/src/Geometry/CuboidVolumeBounds.cpp @@ -30,6 +30,10 @@ CuboidVolumeBounds::CuboidVolumeBounds(const std::array& values) buildSurfaceBounds(); } +std::vector CuboidVolumeBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + std::vector Acts::CuboidVolumeBounds::orientedSurfaces( const Transform3& transform) const { std::vector oSurfaces; @@ -119,12 +123,6 @@ bool CuboidVolumeBounds::inside(const Vector3& pos, double tol) const { std::abs(pos.z()) <= get(eHalfLengthZ) + tol); } -std::vector CuboidVolumeBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - void CuboidVolumeBounds::checkConsistency() noexcept(false) { if (get(eHalfLengthX) <= 0 || get(eHalfLengthY) <= 0 || get(eHalfLengthZ) <= 0.) { diff --git a/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp b/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp index 9d70f49b4b9..62033200b58 100644 --- a/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp +++ b/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp @@ -23,11 +23,30 @@ #include #include -#include +#include #include -bool Acts::CutoutCylinderVolumeBounds::inside(const Acts::Vector3& gpos, - double tol) const { +namespace Acts { + +std::vector CutoutCylinderVolumeBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + +void CutoutCylinderVolumeBounds::checkConsistency() noexcept(false) { + if (get(eMinR) < 0. || get(eMedR) <= 0. || get(eMaxR) <= 0. || + get(eMinR) >= get(eMedR) || get(eMinR) >= get(eMaxR) || + get(eMedR) >= get(eMaxR)) { + throw std::invalid_argument( + "CutoutCylinderVolumeBounds: invalid radial input."); + } + if (get(eHalfLengthZ) <= 0 || get(eHalfLengthZcutout) <= 0. || + get(eHalfLengthZcutout) > get(eHalfLengthZ)) { + throw std::invalid_argument( + "CutoutCylinderVolumeBounds: invalid longitudinal input."); + } +} + +bool CutoutCylinderVolumeBounds::inside(const Vector3& gpos, double tol) const { // first check whether we are in the outer envelope at all (ignore r_med) using VectorHelpers::perp; using VectorHelpers::phi; @@ -48,8 +67,7 @@ bool Acts::CutoutCylinderVolumeBounds::inside(const Acts::Vector3& gpos, return !insideRInner || !insideZInner; // we are not, inside bounds } -std::vector -Acts::CutoutCylinderVolumeBounds::orientedSurfaces( +std::vector CutoutCylinderVolumeBounds::orientedSurfaces( const Transform3& transform) const { std::vector oSurfaces; @@ -122,9 +140,9 @@ Acts::CutoutCylinderVolumeBounds::orientedSurfaces( return oSurfaces; } -Acts::Volume::BoundingBox Acts::CutoutCylinderVolumeBounds::boundingBox( - const Acts::Transform3* trf, const Acts::Vector3& envelope, - const Acts::Volume* entity) const { +Volume::BoundingBox CutoutCylinderVolumeBounds::boundingBox( + const Transform3* trf, const Vector3& envelope, + const Volume* entity) const { Vector3 vmin, vmax; // no phi sector is possible, so this is just the outer size of @@ -133,21 +151,20 @@ Acts::Volume::BoundingBox Acts::CutoutCylinderVolumeBounds::boundingBox( vmax = {get(eMaxR), get(eMaxR), get(eHalfLengthZ)}; vmin = {-get(eMaxR), -get(eMaxR), -get(eHalfLengthZ)}; - Acts::Volume::BoundingBox box(entity, vmin - envelope, vmax + envelope); + Volume::BoundingBox box(entity, vmin - envelope, vmax + envelope); // transform at the very end, if required return trf == nullptr ? box : box.transformed(*trf); } -std::ostream& Acts::CutoutCylinderVolumeBounds::toStream( - std::ostream& sl) const { - sl << "Acts::CutoutCylinderVolumeBounds(\n"; +std::ostream& CutoutCylinderVolumeBounds::toStream(std::ostream& sl) const { + sl << "CutoutCylinderVolumeBounds(\n"; sl << "rmin = " << get(eMinR) << " rmed = " << get(eMedR) << " rmax = " << get(eMaxR) << "\n"; sl << "dz1 = " << get(eHalfLengthZ) << " dz2 = " << get(eHalfLengthZcutout); return sl; } -void Acts::CutoutCylinderVolumeBounds::buildSurfaceBounds() { +void CutoutCylinderVolumeBounds::buildSurfaceBounds() { if (get(eMinR) > s_epsilon) { double hlChoke = (get(eHalfLengthZ) - get(eHalfLengthZcutout)) * 0.5; m_innerCylinderBounds = @@ -164,3 +181,5 @@ void Acts::CutoutCylinderVolumeBounds::buildSurfaceBounds() { m_outerDiscBounds = std::make_shared(get(eMinR), get(eMaxR)); } + +} // namespace Acts diff --git a/Core/src/Geometry/CylinderVolumeBounds.cpp b/Core/src/Geometry/CylinderVolumeBounds.cpp index 1e3bba1d67f..00a4c71f882 100644 --- a/Core/src/Geometry/CylinderVolumeBounds.cpp +++ b/Core/src/Geometry/CylinderVolumeBounds.cpp @@ -19,6 +19,7 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/BoundingBox.hpp" +#include "Acts/Utilities/detail/periodic.hpp" #include #include @@ -251,9 +252,7 @@ double CylinderVolumeBounds::binningBorder(BinningValue bValue) const { } std::vector CylinderVolumeBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; + return {m_values.begin(), m_values.end()}; } void CylinderVolumeBounds::checkConsistency() { diff --git a/Core/src/Geometry/TrapezoidVolumeBounds.cpp b/Core/src/Geometry/TrapezoidVolumeBounds.cpp index f03af8c85c0..2034ce6f302 100644 --- a/Core/src/Geometry/TrapezoidVolumeBounds.cpp +++ b/Core/src/Geometry/TrapezoidVolumeBounds.cpp @@ -54,6 +54,10 @@ TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, double haley, buildSurfaceBounds(); } +std::vector TrapezoidVolumeBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + std::vector TrapezoidVolumeBounds::orientedSurfaces( const Transform3& transform) const { std::vector oSurfaces; @@ -198,12 +202,6 @@ Volume::BoundingBox TrapezoidVolumeBounds::boundingBox( return {entity, vmin - envelope, vmax + envelope}; } -std::vector TrapezoidVolumeBounds::values() const { - std::vector valvector; - valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); - return valvector; -} - void TrapezoidVolumeBounds::checkConsistency() noexcept(false) { if (get(eHalfLengthXnegY) < 0. || get(eHalfLengthXposY) < 0.) { throw std::invalid_argument( diff --git a/Core/src/MagneticField/MultiRangeBField.cpp b/Core/src/MagneticField/MultiRangeBField.cpp index 8899b50d802..f1553413dd2 100644 --- a/Core/src/MagneticField/MultiRangeBField.cpp +++ b/Core/src/MagneticField/MultiRangeBField.cpp @@ -71,7 +71,7 @@ Result MultiRangeBField::getField( } Result MultiRangeBField::getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& /*unused*/, + const Vector3& position, SquareMatrix3& /*unused*/, MagneticFieldProvider::Cache& cache) const { return getField(position, cache); } diff --git a/Core/src/MagneticField/SolenoidBField.cpp b/Core/src/MagneticField/SolenoidBField.cpp index 44cb12d3403..27548fea7c2 100644 --- a/Core/src/MagneticField/SolenoidBField.cpp +++ b/Core/src/MagneticField/SolenoidBField.cpp @@ -58,7 +58,7 @@ Acts::Vector2 Acts::SolenoidBField::getField(const Vector2& position) const { } Acts::Result Acts::SolenoidBField::getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& /*derivative*/, + const Vector3& position, SquareMatrix3& /*derivative*/, MagneticFieldProvider::Cache& /*cache*/) const { return Result::success(getField(position)); } diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 593184816ac..956a644ba5f 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -8,7 +8,6 @@ #include "Acts/Surfaces/AnnulusBounds.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" @@ -21,8 +20,30 @@ #include #include -Acts::AnnulusBounds::AnnulusBounds( - const std::array& values) noexcept(false) +namespace Acts { + +namespace { + +Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p, + const SquareMatrix2& weight) { + // 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::clamp(u, 0., 1.) * n + a; +} + +double squaredNorm(const Vector2& v, const SquareMatrix2& weight) { + return (v.transpose() * weight * v).value(); +} + +} // 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))); @@ -68,17 +89,13 @@ Acts::AnnulusBounds::AnnulusBounds( // 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)}; @@ -95,14 +112,33 @@ Acts::AnnulusBounds::AnnulusBounds( m_inRightModulePC = stripXYToModulePC(m_inRightStripXY); } -std::vector Acts::AnnulusBounds::corners() const { +std::vector AnnulusBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + +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."); + } +} + +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 +150,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,20 +164,20 @@ 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 { +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]; + double phiLoc = locpo_rotated[1]; + double rLoc = locpo_rotated[0]; if (phiLoc < (get(eMinPhiRel) - tolPhi) || phiLoc > (get(eMaxPhiRel) + tolPhi)) { @@ -151,18 +187,16 @@ bool Acts::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; @@ -171,9 +205,9 @@ bool Acts::AnnulusBounds::inside(const Vector2& lposition, double tolR, return true; } -bool Acts::AnnulusBounds::inside( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +bool AnnulusBounds::inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const { + using enum BoundaryTolerance::ToleranceMode; if (boundaryTolerance.isInfinite()) { return true; } @@ -188,187 +222,230 @@ bool Acts::AnnulusBounds::inside( absoluteBound->tolerance1); } - // first check if inside. We don't need to look into the covariance if inside - if (inside(lposition, 0., 0.)) { - return true; - } + bool insideStrict = inside(lposition, 0., 0.); - if (!boundaryTolerance.hasChi2Bound()) { - throw std::logic_error("not implemented"); + BoundaryTolerance::ToleranceMode mode = boundaryTolerance.toleranceMode(); + if (mode == None) { + // first check if inside if we're in None tolerance mode. We don't need to + // look into the covariance if inside + return insideStrict; } - const auto& boundaryToleranceChi2 = boundaryTolerance.asChi2Bound(); + if (mode == Extend && insideStrict) { + return true; + } // locpo is PC in STRIP SYSTEM // we need to rotate the locpo Vector2 locpo_rotated = m_rotationStripPC * lposition; - // 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 + // 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[eBoundLoc1]; - double r_strip = locpo_rotated[eBoundLoc0]; - double O_x = m_shiftXY[eBoundLoc0]; - double O_y = m_shiftXY[eBoundLoc1]; - - // For a transformation from cartesian into polar coordinates - // - // [ _________ ] - // [ / 2 2 ] - // [ \/ x + y ] - // [ r' ] [ ] - // v = [ ] = [ / y \] - // [phi'] [2*atan|----------------|] - // [ | _________|] - // [ | / 2 2 |] - // [ \x + \/ x + y /] - // - // Where x, y are polar coordinates that can be rotated by dPhi - // - // [x] [O_x + r*cos(dPhi - phi)] - // [ ] = [ ] - // [y] [O_y - r*sin(dPhi - phi)] - // - // The general jacobian is: - // - // [d d ] - // [--(f_x) --(f_x)] - // [dx dy ] - // Jgen = [ ] - // [d d ] - // [--(f_y) --(f_y)] - // [dx dy ] - // - // which means in this case: - // - // [ d d ] - // [ ----------(rMod) ---------(rMod) ] - // [ dr_{strip} dphiStrip ] - // J = [ ] - // [ d d ] - // [----------(phiMod) ---------(phiMod)] - // [dr_{strip} dphiStrip ] - // - // Performing the derivative one gets: - // - // [B*O_x + C*O_y + rStrip rStrip*(B*O_y + O_x*sin(dPhi - phiStrip))] - // [---------------------- -----------------------------------------] - // [ ___ ___ ] - // [ \/ A \/ A ] - // J = [ ] - // [ -(B*O_y - C*O_x) rStrip*(B*O_x + C*O_y + rStrip) ] - // [ ----------------- ------------------------------- ] - // [ A A ] - // - // where - // 2 2 - // A = O_x + 2*O_x*rStrip*cos(dPhi - phiStrip) + O_y - // 2 - // - 2*O_y*rStrip*sin(dPhi - phiStrip) + rStrip - // B = cos(dPhi - phiStrip) - // C = -sin(dPhi - phiStrip) - - double cosDPhiPhiStrip = std::cos(dphi - phi_strip); - double sinDPhiPhiStrip = std::sin(dphi - phi_strip); - - double A = O_x * O_x + 2 * O_x * r_strip * cosDPhiPhiStrip + O_y * O_y - - 2 * O_y * r_strip * sinDPhiPhiStrip + r_strip * r_strip; - double sqrtA = std::sqrt(A); - - double B = cosDPhiPhiStrip; - double C = -sinDPhiPhiStrip; - ActsMatrix<2, 2> 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; - - // Mahalanobis distance uses inverse covariance as weights - const auto& weightStripPC = boundaryToleranceChi2.weight; - auto weightModulePC = jacobianStripPCToModulePC.transpose() * weightStripPC * - jacobianStripPCToModulePC; - - double minDist = std::numeric_limits::max(); - - 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, - locpo_rotated, weightStripPC); - currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); - minDist = currentDist; - - currentClosest = closestOnSegment(m_inRightStripPC, m_outRightStripPC, - locpo_rotated, weightStripPC); - currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); - if (currentDist < minDist) { - minDist = currentDist; - } + double phi_strip = locpo_rotated[1]; + double r_strip = locpo_rotated[0]; + double O_x = m_shiftXY[0]; + double O_y = m_shiftXY[1]; - // 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); - - // 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); - if (currentDist < minDist) { + auto closestPointDistanceBound = [&](const SquareMatrix2& weight) { + // For a transformation from cartesian into polar coordinates + // + // [ _________ ] + // [ / 2 2 ] + // [ \/ x + y ] + // [ r' ] [ ] + // v = [ ] = [ / y \] + // [phi'] [2*atan|----------------|] + // [ | _________|] + // [ | / 2 2 |] + // [ \x + \/ x + y /] + // + // Where x, y are polar coordinates that can be rotated by dPhi + // + // [x] [O_x + r*cos(dPhi - phi)] + // [ ] = [ ] + // [y] [O_y - r*sin(dPhi - phi)] + // + // The general jacobian is: + // + // [d d ] + // [--(f_x) --(f_x)] + // [dx dy ] + // Jgen = [ ] + // [d d ] + // [--(f_y) --(f_y)] + // [dx dy ] + // + // which means in this case: + // + // [ d d ] + // [ ----------(rMod) ---------(rMod) ] + // [ dr_{strip} dphiStrip ] + // J = [ ] + // [ d d ] + // [----------(phiMod) ---------(phiMod)] + // [dr_{strip} dphiStrip ] + // + // Performing the derivative one gets: + // + // [B*O_x + C*O_y + rStrip rStrip*(B*O_y + O_x*sin(dPhi - phiStrip))] + // [---------------------- -----------------------------------------] + // [ ___ ___ ] + // [ \/ A \/ A ] + // J = [ ] + // [ -(B*O_y - C*O_x) rStrip*(B*O_x + C*O_y + rStrip) ] + // [ ----------------- ------------------------------- ] + // [ A A ] + // + // where + // 2 2 + // A = O_x + 2*O_x*rStrip*cos(dPhi - phiStrip) + O_y + // 2 + // - 2*O_y*rStrip*sin(dPhi - phiStrip) + rStrip + // B = cos(dPhi - phiStrip) + // C = -sin(dPhi - phiStrip) + + double cosDPhiPhiStrip = std::cos(dphi - phi_strip); + double sinDPhiPhiStrip = std::sin(dphi - phi_strip); + + double A = O_x * O_x + 2 * O_x * r_strip * cosDPhiPhiStrip + O_y * O_y - + 2 * O_y * r_strip * sinDPhiPhiStrip + r_strip * r_strip; + double sqrtA = std::sqrt(A); + + 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; + + // Mahalanobis distance uses inverse covariance as weights + const auto& weightStripPC = weight; + auto weightModulePC = jacobianStripPCToModulePC.transpose() * + weightStripPC * jacobianStripPCToModulePC; + + double minDist = std::numeric_limits::max(); + Vector2 delta; + + 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, + locpo_rotated, weightStripPC); + currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); minDist = currentDist; - } + delta = locpo_rotated - currentClosest; + currentClosest = closestOnSegment(m_inRightStripPC, m_outRightStripPC, + locpo_rotated, weightStripPC); + currentDist = squaredNorm(locpo_rotated - currentClosest, weightStripPC); + if (currentDist < minDist) { + minDist = currentDist; + delta = locpo_rotated - currentClosest; + } - currentClosest = closestOnSegment(m_outLeftModulePC, m_outRightModulePC, - locpoModulePC, weightModulePC); - currentDist = squaredNorm(locpoModulePC - currentClosest, weightModulePC); - if (currentDist < minDist) { - 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); + + // 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); + if (currentDist < minDist) { + minDist = currentDist; + delta = jacobianStripPCToModulePC.inverse() * + (currentClosest - locpoModulePC); + } + + currentClosest = closestOnSegment(m_outLeftModulePC, m_outRightModulePC, + locpoModulePC, weightModulePC); + currentDist = squaredNorm(locpoModulePC - currentClosest, weightModulePC); + if (currentDist < minDist) { + minDist = currentDist; + delta = jacobianStripPCToModulePC.inverse() * + (currentClosest - locpoModulePC); + } + + return std::tuple{delta, minDist}; + }; + + if (boundaryTolerance.hasChi2Bound()) { + const auto& boundaryToleranceChi2 = boundaryTolerance.asChi2Bound(); + + // Calculate minDist based on weight from the boundary tolerance object. + // That weight matrix is in STRIP PC + auto [delta, minDist] = + closestPointDistanceBound(boundaryToleranceChi2.weight); + + // compare resulting Mahalanobis distance to configured "number of sigmas" + // we square it b/c we never took the square root of the distance + if (mode == Extend) { + return minDist < + boundaryToleranceChi2.maxChi2 * boundaryToleranceChi2.maxChi2; + } else if (mode == Shrink) { + return minDist > boundaryToleranceChi2.maxChi2 * + boundaryToleranceChi2.maxChi2 && + insideStrict; + } + } else if (boundaryTolerance.hasAbsoluteEuclidean()) { + const auto& boundaryToleranceAbsoluteEuclidean = + boundaryTolerance.asAbsoluteEuclidean(); + + SquareMatrix2 jacobianPCToXY; + jacobianPCToXY(0, 0) = std::cos(phi_strip); + jacobianPCToXY(0, 1) = -r_strip * std::sin(phi_strip); + jacobianPCToXY(1, 0) = std::sin(phi_strip); + jacobianPCToXY(1, 1) = r_strip * std::cos(phi_strip); + + // This is J.T * J but we can also calculate it directly + SquareMatrix2 weightStripPC; + weightStripPC(0, 0) = 1; + weightStripPC(0, 1) = 0; + weightStripPC(1, 0) = 0; + weightStripPC(1, 1) = r_strip * r_strip; + + auto [delta, minDist] = closestPointDistanceBound(weightStripPC); + + Vector2 cartesianDistance = jacobianPCToXY * delta; + + if (mode == Extend) { + return cartesianDistance.squaredNorm() < + boundaryToleranceAbsoluteEuclidean.tolerance * + boundaryToleranceAbsoluteEuclidean.tolerance; + } else if (mode == Shrink) { + return cartesianDistance.squaredNorm() > + boundaryToleranceAbsoluteEuclidean.tolerance * + boundaryToleranceAbsoluteEuclidean.tolerance && + insideStrict; + } } - // 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; + throw std::logic_error("not implemented"); } -Acts::Vector2 Acts::AnnulusBounds::stripXYToModulePC( - const Vector2& vStripXY) const { +Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { Vector2 vecModuleXY = vStripXY + m_shiftXY; return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)}; } -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; -} - -double Acts::AnnulusBounds::squaredNorm(const Vector2& v, - const SquareMatrix2& weight) const { - return (v.transpose() * weight * v).value(); -} - -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) = "; @@ -379,3 +456,5 @@ std::ostream& Acts::AnnulusBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/BoundaryTolerance.cpp b/Core/src/Surfaces/BoundaryTolerance.cpp index b5077fa4ec4..971a026d7de 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 @@ -61,38 +60,59 @@ bool BoundaryTolerance::hasChi2Bound() const { return holdsVariant(); } -bool BoundaryTolerance::hasTolerance() const { +BoundaryTolerance::ToleranceMode BoundaryTolerance::toleranceMode() const { + using enum ToleranceMode; if (isInfinite()) { - return true; + return Extend; } if (isNone()) { - return false; + return None; } if (const auto* absoluteBound = getVariantPtr(); absoluteBound != nullptr) { - return absoluteBound->tolerance0 != 0. || absoluteBound->tolerance1 != 0.; + if (absoluteBound->tolerance0 == 0. && absoluteBound->tolerance1 == 0.) { + return None; + } + + return Extend; } if (const auto* absoluteCartesian = getVariantPtr(); absoluteCartesian != nullptr) { - return absoluteCartesian->tolerance0 != 0. || - absoluteCartesian->tolerance1 != 0.; + if (absoluteCartesian->tolerance0 == 0. && + absoluteCartesian->tolerance1 == 0.) { + return None; + } + + return Extend; } if (const auto* absoluteEuclidean = getVariantPtr(); absoluteEuclidean != nullptr) { - return absoluteEuclidean->tolerance != 0.; + if (absoluteEuclidean->tolerance == 0.) { + return None; + } else if (absoluteEuclidean->tolerance > 0.) { + return Extend; + } else { + return Shrink; + } } if (const auto* chi2Bound = getVariantPtr(); chi2Bound != nullptr) { - return chi2Bound->maxChi2 != 0.; + if (chi2Bound->maxChi2 == 0.) { + return None; + } else if (chi2Bound->maxChi2 >= 0.) { + return Extend; + } else { + return Shrink; + } } assert(false && "Unsupported tolerance type"); - return false; + return None; } BoundaryTolerance::AbsoluteBound BoundaryTolerance::asAbsoluteBound( @@ -149,9 +169,13 @@ bool BoundaryTolerance::isTolerated( if (const auto* chi2Bound = getVariantPtr(); chi2Bound != nullptr) { - double chi2 = distance.transpose() * chi2Bound->weight * distance; // Mahalanobis distances mean is 2 in 2-dim. cut is 1-d sigma. - return chi2 <= 2 * chi2Bound->maxChi2; + double chi2 = distance.transpose() * chi2Bound->weight * distance; + if (chi2Bound->maxChi2 < 0) { + return chi2 > 2 * std::abs(chi2Bound->maxChi2); + } else { + return chi2 <= 2 * chi2Bound->maxChi2; + } } bool isCartesian = !jacobianOpt.has_value(); @@ -171,7 +195,11 @@ bool BoundaryTolerance::isTolerated( if (const auto* absoluteEuclidean = getVariantPtr(); absoluteEuclidean != nullptr) { - return cartesianDistance.norm() <= absoluteEuclidean->tolerance; + if (absoluteEuclidean->tolerance < 0) { + return cartesianDistance.norm() > std::abs(absoluteEuclidean->tolerance); + } else { + return cartesianDistance.norm() <= absoluteEuclidean->tolerance; + } } throw std::logic_error("Unsupported tolerance type"); diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 5dce8995326..31f9da55b59 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -8,9 +8,9 @@ #include "Acts/Surfaces/ConeBounds.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Utilities/detail/periodic.hpp" #include #include @@ -18,55 +18,69 @@ #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 { - return SurfaceBounds::eCone; +std::vector ConeBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + +void ConeBounds::checkConsistency() noexcept(false) { + if (get(eAlpha) < 0. || get(eAlpha) >= std::numbers::pi) { + throw std::invalid_argument("ConeBounds: invalid open angle."); + } + if (get(eMinZ) > get(eMaxZ) || + std::abs(get(eMinZ) - get(eMaxZ)) < s_epsilon) { + throw std::invalid_argument("ConeBounds: invalid z range setup."); + } + if (get(eHalfPhiSector) < 0. || std::abs(eHalfPhiSector) > std::numbers::pi) { + throw std::invalid_argument("ConeBounds: invalid phi sector setup."); + } + if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { + throw std::invalid_argument("ConeBounds: invalid phi positioning."); + } } -/// 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 + auto x = r(lposition[1]); // cone radius at the local position Vector2 shifted; - shifted[eBoundLoc1] = lposition[eBoundLoc1]; - shifted[eBoundLoc0] = - std::isnormal(x) - ? (x * radian_sym((lposition[eBoundLoc0] / x) - get(eAveragePhi))) - : lposition[eBoundLoc0]; + shifted[1] = lposition[1]; + shifted[0] = std::isnormal(x) + ? (x * radian_sym((lposition[0] / x) - get(eAveragePhi))) + : lposition[0]; return shifted; } -bool Acts::ConeBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { - auto rphiHalf = r(lposition[eBoundLoc1]) * get(eHalfPhiSector); +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& 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) " @@ -76,3 +90,5 @@ std::ostream& Acts::ConeBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index 5dddd1527bf..bb8f8ed4cf4 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" @@ -27,47 +26,47 @@ #include #include -using Acts::VectorHelpers::perp; -using Acts::VectorHelpers::phi; +namespace Acts { -Acts::ConeSurface::ConeSurface(const ConeSurface& other) +using VectorHelpers::perp; +using VectorHelpers::phi; + +ConeSurface::ConeSurface(const ConeSurface& other) : GeometryObject(), RegularSurface(other), m_bounds(other.m_bounds) {} -Acts::ConeSurface::ConeSurface(const GeometryContext& gctx, - const ConeSurface& other, - const Transform3& shift) +ConeSurface::ConeSurface(const GeometryContext& gctx, const ConeSurface& other, + const Transform3& shift) : GeometryObject(), RegularSurface(gctx, other, shift), m_bounds(other.m_bounds) {} -Acts::ConeSurface::ConeSurface(const Transform3& transform, double alpha, - bool symmetric) +ConeSurface::ConeSurface(const Transform3& transform, double alpha, + bool symmetric) : GeometryObject(), RegularSurface(transform), m_bounds(std::make_shared(alpha, symmetric)) {} -Acts::ConeSurface::ConeSurface(const Transform3& transform, double alpha, - double zmin, double zmax, double halfPhi) +ConeSurface::ConeSurface(const Transform3& transform, double alpha, double zmin, + double zmax, double halfPhi) : GeometryObject(), RegularSurface(transform), m_bounds(std::make_shared(alpha, zmin, zmax, halfPhi)) { } -Acts::ConeSurface::ConeSurface(const Transform3& transform, - std::shared_ptr cbounds) +ConeSurface::ConeSurface(const Transform3& transform, + std::shared_ptr cbounds) : GeometryObject(), RegularSurface(transform), m_bounds(std::move(cbounds)) { throw_assert(m_bounds, "ConeBounds must not be nullptr"); } -Acts::Vector3 Acts::ConeSurface::binningPosition( - const GeometryContext& gctx, Acts::BinningValue bValue) const { +Vector3 ConeSurface::binningPosition(const GeometryContext& gctx, + BinningValue bValue) const { const Vector3& sfCenter = center(gctx); // special binning type for R-type methods - if (bValue == Acts::BinningValue::binR || - bValue == Acts::BinningValue::binRPhi) { + if (bValue == BinningValue::binR || bValue == BinningValue::binRPhi) { return Vector3(sfCenter.x() + bounds().r(sfCenter.z()), sfCenter.y(), sfCenter.z()); } @@ -78,11 +77,11 @@ Acts::Vector3 Acts::ConeSurface::binningPosition( return sfCenter; } -Acts::Surface::SurfaceType Acts::ConeSurface::type() const { +Surface::SurfaceType ConeSurface::type() const { return Surface::Cone; } -Acts::ConeSurface& Acts::ConeSurface::operator=(const ConeSurface& other) { +ConeSurface& ConeSurface::operator=(const ConeSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; @@ -90,12 +89,11 @@ Acts::ConeSurface& Acts::ConeSurface::operator=(const ConeSurface& other) { return *this; } -Acts::Vector3 Acts::ConeSurface::rotSymmetryAxis( - const GeometryContext& gctx) const { +Vector3 ConeSurface::rotSymmetryAxis(const GeometryContext& gctx) const { return transform(gctx).matrix().block<3, 1>(0, 2); } -Acts::RotationMatrix3 Acts::ConeSurface::referenceFrame( +RotationMatrix3 ConeSurface::referenceFrame( const GeometryContext& gctx, const Vector3& position, const Vector3& /*direction*/) const { RotationMatrix3 mFrame; @@ -105,7 +103,7 @@ Acts::RotationMatrix3 Acts::ConeSurface::referenceFrame( // measured z is the position transverse normalized Vector3 measDepth = Vector3(position.x(), position.y(), 0.).normalized(); // measured X is what comoes out of it - Acts::Vector3 measX(measY.cross(measDepth).normalized()); + Vector3 measX(measY.cross(measDepth).normalized()); // the columnes mFrame.col(0) = measX; mFrame.col(1) = measY; @@ -116,30 +114,30 @@ Acts::RotationMatrix3 Acts::ConeSurface::referenceFrame( return mFrame; } -Acts::Vector3 Acts::ConeSurface::localToGlobal(const GeometryContext& gctx, - const Vector2& lposition) const { +Vector3 ConeSurface::localToGlobal(const GeometryContext& gctx, + const Vector2& lposition) const { // create the position in the local 3d frame - double r = lposition[Acts::eBoundLoc1] * bounds().tanAlpha(); - double phi = lposition[Acts::eBoundLoc0] / r; - Vector3 loc3Dframe(r * cos(phi), r * sin(phi), lposition[Acts::eBoundLoc1]); + double r = lposition[1] * bounds().tanAlpha(); + double phi = lposition[0] / r; + Vector3 loc3Dframe(r * cos(phi), r * sin(phi), lposition[1]); return transform(gctx) * loc3Dframe; } -Acts::Result Acts::ConeSurface::globalToLocal( - const GeometryContext& gctx, const Vector3& position, - double tolerance) const { +Result ConeSurface::globalToLocal(const GeometryContext& gctx, + const Vector3& position, + double tolerance) const { Vector3 loc3Dframe = transform(gctx).inverse() * position; double r = loc3Dframe.z() * bounds().tanAlpha(); if (std::abs(perp(loc3Dframe) - r) > tolerance) { return Result::failure(SurfaceError::GlobalPositionNotOnSurface); } - return Result::success( + return Result::success( Vector2(r * atan2(loc3Dframe.y(), loc3Dframe.x()), loc3Dframe.z())); } -double Acts::ConeSurface::pathCorrection(const GeometryContext& gctx, - const Vector3& position, - const Vector3& direction) const { +double ConeSurface::pathCorrection(const GeometryContext& gctx, + const Vector3& position, + const Vector3& direction) const { // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha) Vector3 posLocal = transform(gctx).inverse() * position; double phi = VectorHelpers::phi(posLocal); @@ -153,24 +151,23 @@ double Acts::ConeSurface::pathCorrection(const GeometryContext& gctx, return std::abs(1. / cAlpha); } -std::string Acts::ConeSurface::name() const { +std::string ConeSurface::name() const { return "Acts::ConeSurface"; } -Acts::Vector3 Acts::ConeSurface::normal(const GeometryContext& gctx, - const Acts::Vector2& lposition) const { +Vector3 ConeSurface::normal(const GeometryContext& gctx, + const Vector2& lposition) const { // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha) - double phi = lposition[Acts::eBoundLoc0] / - (bounds().r(lposition[Acts::eBoundLoc1])), - sgn = lposition[Acts::eBoundLoc1] > 0 ? -1. : +1.; + double phi = lposition[0] / (bounds().r(lposition[1])), + sgn = lposition[1] > 0 ? -1. : +1.; double cosAlpha = std::cos(bounds().get(ConeBounds::eAlpha)); double sinAlpha = std::sin(bounds().get(ConeBounds::eAlpha)); Vector3 localNormal(cos(phi) * cosAlpha, sin(phi) * cosAlpha, sgn * sinAlpha); return Vector3(transform(gctx).linear() * localNormal); } -Acts::Vector3 Acts::ConeSurface::normal(const GeometryContext& gctx, - const Acts::Vector3& position) const { +Vector3 ConeSurface::normal(const GeometryContext& gctx, + const Vector3& position) const { // get it into the cylinder frame if needed // @todo respect opening angle Vector3 pos3D = transform(gctx).inverse() * position; @@ -178,12 +175,12 @@ Acts::Vector3 Acts::ConeSurface::normal(const GeometryContext& gctx, return pos3D.normalized(); } -const Acts::ConeBounds& Acts::ConeSurface::bounds() const { +const ConeBounds& ConeSurface::bounds() const { // is safe because no constructor w/o bounds exists return (*m_bounds.get()); } -Acts::Polyhedron Acts::ConeSurface::polyhedronRepresentation( +Polyhedron ConeSurface::polyhedronRepresentation( const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector vertices; @@ -258,7 +255,7 @@ Acts::Polyhedron Acts::ConeSurface::polyhedronRepresentation( return Polyhedron(vertices, faces, triangularMesh, false); } -Acts::detail::RealQuadraticEquation Acts::ConeSurface::intersectionSolver( +detail::RealQuadraticEquation ConeSurface::intersectionSolver( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { // Transform into the local frame @@ -281,7 +278,7 @@ Acts::detail::RealQuadraticEquation Acts::ConeSurface::intersectionSolver( return detail::RealQuadraticEquation(A, B, C); } -Acts::SurfaceMultiIntersection Acts::ConeSurface::intersect( +SurfaceMultiIntersection ConeSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, double tolerance) const { @@ -325,7 +322,7 @@ Acts::SurfaceMultiIntersection Acts::ConeSurface::intersect( return {{second, first}, this}; } -Acts::AlignmentToPathMatrix Acts::ConeSurface::alignmentToPathDerivative( +AlignmentToPathMatrix ConeSurface::alignmentToPathDerivative( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -377,7 +374,7 @@ Acts::AlignmentToPathMatrix Acts::ConeSurface::alignmentToPathDerivative( return alignToPath; } -Acts::ActsMatrix<2, 3> Acts::ConeSurface::localCartesianToBoundLocalDerivative( +ActsMatrix<2, 3> ConeSurface::localCartesianToBoundLocalDerivative( const GeometryContext& gctx, const Vector3& position) const { using VectorHelpers::perp; using VectorHelpers::phi; @@ -397,3 +394,5 @@ Acts::ActsMatrix<2, 3> Acts::ConeSurface::localCartesianToBoundLocalDerivative( return loc3DToLocBound; } + +} // namespace Acts diff --git a/Core/src/Surfaces/ConvexPolygonBounds.cpp b/Core/src/Surfaces/ConvexPolygonBounds.cpp index f6b08624308..d48dfaf7030 100644 --- a/Core/src/Surfaces/ConvexPolygonBounds.cpp +++ b/Core/src/Surfaces/ConvexPolygonBounds.cpp @@ -12,11 +12,12 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" -#include #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++) { @@ -30,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()); @@ -39,35 +40,32 @@ 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 { - return SurfaceBounds::eConvexPolygon; -} - -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/CurvilinearSurface.cpp b/Core/src/Surfaces/CurvilinearSurface.cpp index c320177de57..899eee5f6f4 100644 --- a/Core/src/Surfaces/CurvilinearSurface.cpp +++ b/Core/src/Surfaces/CurvilinearSurface.cpp @@ -11,7 +11,6 @@ #include "Acts/Definitions/Tolerance.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Utilities/JacobianHelpers.hpp" -#include "Acts/Utilities/VectorHelpers.hpp" #include #include @@ -25,10 +24,10 @@ bool CurvilinearSurface::isStandardRepresentation() const { } RotationMatrix3 CurvilinearSurface::referenceFrame() const { - /// the right-handed coordinate system is defined as - /// T = normal - /// U = Z x T if T not parallel to Z otherwise U = X x T - /// V = T x U + // the right-handed coordinate system is defined as + // T = normal + // U = Z x T if T not parallel to Z otherwise U = X x T + // V = T x U Vector3 T = m_direction.normalized(); Vector3 U = (isStandardRepresentation() ? Vector3::UnitZ() : Vector3::UnitX()) .cross(T) diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index c538b5c170b..ab5fce5e296 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -8,11 +8,11 @@ #include "Acts/Surfaces/CylinderBounds.hpp" -#include "Acts/Definitions/TrackParametrization.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" #include #include @@ -21,32 +21,31 @@ #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; + +std::vector CylinderBounds::values() const { + return {m_values.begin(), m_values.end()}; } -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]}; +Vector2 CylinderBounds::shifted(const Vector2& lposition) const { + return {detail::radian_sym((lposition[0] / get(eR)) - get(eAveragePhi)), + lposition[1]}; } -Acts::ActsMatrix<2, 2> Acts::CylinderBounds::jacobian() const { - ActsMatrix<2, 2> j; - j(0, eBoundLoc0) = 1 / get(eR); - j(0, eBoundLoc1) = 0; - j(1, eBoundLoc0) = 0; - j(1, eBoundLoc1) = 1; +SquareMatrix2 CylinderBounds::jacobian() const { + SquareMatrix2 j; + j(0, 0) = 1 / get(eR); + j(0, 1) = 0; + j(1, 0) = 0; + j(1, 1) = 1; return j; } -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); @@ -93,7 +92,7 @@ bool Acts::CylinderBounds::inside( jacobian()); } -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, " @@ -105,7 +104,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; @@ -120,7 +119,7 @@ std::vector Acts::CylinderBounds::circleVertices( // Write the two bows/circles on either side std::vector sides = {-1, 1}; for (auto& side : sides) { - /// Helper method to create the segment + // Helper method to create the segment auto svertices = detail::VerticesHelper::segmentVertices( {get(eR), get(eR)}, avgPhi - halfPhi, avgPhi + halfPhi, phiRef, quarterSegments, Vector3(0., 0., side * get(eHalfLengthZ)), transform); @@ -152,7 +151,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"); @@ -175,3 +174,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/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index 23bb74e49f8..7990b4fd8d2 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 + // 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 { +std::string CylinderSurface::name() const { return "Acts::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[0] / 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 diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index aa913404c0f..78ff02c8c4a 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -15,14 +15,26 @@ #include #include #include +#include -Acts::SurfaceBounds::BoundsType Acts::DiamondBounds::type() const { - return SurfaceBounds::eDiamond; +namespace Acts { + +std::vector DiamondBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + +void DiamondBounds::checkConsistency() noexcept(false) { + if (std::ranges::any_of(m_values, [](auto v) { return v <= 0.; })) { + throw std::invalid_argument("DiamondBounds: negative half length."); + } + if (get(eHalfLengthXnegY) > get(eHalfLengthXzeroY) || + get(eHalfLengthXposY) > get(eHalfLengthXzeroY)) { + throw std::invalid_argument("DiamondBounds: not a diamond shape."); + } } -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); @@ -37,7 +49,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 @@ -50,11 +62,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, " @@ -67,3 +79,5 @@ std::ostream& Acts::DiamondBounds::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..8981bb24c5e 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -26,90 +26,90 @@ #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/JacobianHelpers.hpp" #include "Acts/Utilities/ThrowAssert.hpp" +#include "Acts/Utilities/detail/periodic.hpp" #include #include #include #include -using Acts::VectorHelpers::perp; -using Acts::VectorHelpers::phi; +namespace Acts { -Acts::DiscSurface::DiscSurface(const DiscSurface& other) +using VectorHelpers::perp; +using VectorHelpers::phi; + +DiscSurface::DiscSurface(const DiscSurface& other) : GeometryObject(), RegularSurface(other), m_bounds(other.m_bounds) {} -Acts::DiscSurface::DiscSurface(const GeometryContext& gctx, - const DiscSurface& other, - const Transform3& shift) +DiscSurface::DiscSurface(const GeometryContext& gctx, const DiscSurface& other, + const Transform3& shift) : GeometryObject(), RegularSurface(gctx, other, shift), m_bounds(other.m_bounds) {} -Acts::DiscSurface::DiscSurface(const Transform3& transform, double rmin, - double rmax, double hphisec) +DiscSurface::DiscSurface(const Transform3& transform, double rmin, double rmax, + double hphisec) : GeometryObject(), RegularSurface(transform), m_bounds(std::make_shared(rmin, rmax, hphisec)) {} -Acts::DiscSurface::DiscSurface(const Transform3& transform, double minhalfx, - double maxhalfx, double minR, double maxR, - double avephi, double stereo) +DiscSurface::DiscSurface(const Transform3& transform, double minhalfx, + double maxhalfx, double minR, double maxR, + double avephi, double stereo) : GeometryObject(), RegularSurface(transform), m_bounds(std::make_shared( minhalfx, maxhalfx, minR, maxR, avephi, stereo)) {} -Acts::DiscSurface::DiscSurface(const Transform3& transform, - std::shared_ptr dbounds) +DiscSurface::DiscSurface(const Transform3& transform, + std::shared_ptr dbounds) : GeometryObject(), RegularSurface(transform), m_bounds(std::move(dbounds)) {} -Acts::DiscSurface::DiscSurface(std::shared_ptr dbounds, - const DetectorElementBase& detelement) +DiscSurface::DiscSurface(std::shared_ptr dbounds, + const DetectorElementBase& detelement) : GeometryObject(), RegularSurface(detelement), m_bounds(std::move(dbounds)) { throw_assert(m_bounds, "nullptr as DiscBounds"); } -Acts::DiscSurface& Acts::DiscSurface::operator=(const DiscSurface& other) { +DiscSurface& DiscSurface::operator=(const DiscSurface& other) { if (this != &other) { - Acts::Surface::operator=(other); + Surface::operator=(other); m_bounds = other.m_bounds; } return *this; } -Acts::Surface::SurfaceType Acts::DiscSurface::type() const { +Surface::SurfaceType DiscSurface::type() const { return Surface::Disc; } -Acts::Vector3 Acts::DiscSurface::localToGlobal(const GeometryContext& gctx, - const Vector2& lposition) const { +Vector3 DiscSurface::localToGlobal(const GeometryContext& gctx, + const Vector2& lposition) const { // create the position in the local 3d frame - Vector3 loc3Dframe( - lposition[Acts::eBoundLoc0] * cos(lposition[Acts::eBoundLoc1]), - lposition[Acts::eBoundLoc0] * sin(lposition[Acts::eBoundLoc1]), 0.); + Vector3 loc3Dframe(lposition[0] * cos(lposition[1]), + lposition[0] * sin(lposition[1]), 0.); // transform to globalframe return transform(gctx) * loc3Dframe; } -Acts::Result Acts::DiscSurface::globalToLocal( - const GeometryContext& gctx, const Vector3& position, - double tolerance) const { +Result DiscSurface::globalToLocal(const GeometryContext& gctx, + const Vector3& position, + double tolerance) const { // transport it to the globalframe Vector3 loc3Dframe = (transform(gctx).inverse()) * position; if (std::abs(loc3Dframe.z()) > std::abs(tolerance)) { return Result::failure(SurfaceError::GlobalPositionNotOnSurface); } - return Result::success({perp(loc3Dframe), phi(loc3Dframe)}); + return Result::success({perp(loc3Dframe), phi(loc3Dframe)}); } -Acts::Vector2 Acts::DiscSurface::localPolarToLocalCartesian( - const Vector2& locpol) const { +Vector2 DiscSurface::localPolarToLocalCartesian(const Vector2& locpol) const { const DiscTrapezoidBounds* dtbo = - dynamic_cast(&(bounds())); + dynamic_cast(&(bounds())); if (dtbo != nullptr) { double rMedium = dtbo->rCenter(); double phi = dtbo->get(DiscTrapezoidBounds::eAveragePhi); @@ -117,43 +117,40 @@ Acts::Vector2 Acts::DiscSurface::localPolarToLocalCartesian( Vector2 polarCenter(rMedium, phi); Vector2 cartCenter = localPolarToCartesian(polarCenter); Vector2 cartPos = localPolarToCartesian(locpol); - Vector2 Pos = cartPos - cartCenter; + Vector2 pos = cartPos - cartCenter; - Acts::Vector2 locPos( - Pos[Acts::eBoundLoc0] * sin(phi) - Pos[Acts::eBoundLoc1] * cos(phi), - Pos[Acts::eBoundLoc1] * sin(phi) + Pos[Acts::eBoundLoc0] * cos(phi)); - return Vector2(locPos[Acts::eBoundLoc0], locPos[Acts::eBoundLoc1]); + Vector2 locPos(pos[0] * sin(phi) - pos[1] * cos(phi), + pos[1] * sin(phi) + pos[0] * cos(phi)); + return Vector2(locPos[0], locPos[1]); } - return Vector2(locpol[Acts::eBoundLoc0] * cos(locpol[Acts::eBoundLoc1]), - locpol[Acts::eBoundLoc0] * sin(locpol[Acts::eBoundLoc1])); + return Vector2(locpol[0] * cos(locpol[1]), locpol[0] * sin(locpol[1])); } -Acts::Vector3 Acts::DiscSurface::localCartesianToGlobal( - const GeometryContext& gctx, const Vector2& lposition) const { - Vector3 loc3Dframe(lposition[Acts::eBoundLoc0], lposition[Acts::eBoundLoc1], - 0.); +Vector3 DiscSurface::localCartesianToGlobal(const GeometryContext& gctx, + const Vector2& lposition) const { + Vector3 loc3Dframe(lposition[0], lposition[1], 0.); return transform(gctx) * loc3Dframe; } -Acts::Vector2 Acts::DiscSurface::globalToLocalCartesian( - const GeometryContext& gctx, const Vector3& position, - double /*direction*/) const { +Vector2 DiscSurface::globalToLocalCartesian(const GeometryContext& gctx, + const Vector3& position, + double /*direction*/) const { Vector3 loc3Dframe = (transform(gctx).inverse()) * position; return Vector2(loc3Dframe.x(), loc3Dframe.y()); } -std::string Acts::DiscSurface::name() const { +std::string DiscSurface::name() const { return "Acts::DiscSurface"; } -const Acts::SurfaceBounds& Acts::DiscSurface::bounds() const { +const SurfaceBounds& DiscSurface::bounds() const { if (m_bounds) { return (*(m_bounds.get())); } return s_noBounds; } -Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( +Polyhedron DiscSurface::polyhedronRepresentation( const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector vertices; @@ -194,19 +191,15 @@ Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( throw std::domain_error("Polyhedron repr of boundless surface not possible."); } -Acts::Vector2 Acts::DiscSurface::localPolarToCartesian( - const Vector2& lpolar) const { - return Vector2(lpolar[eBoundLoc0] * cos(lpolar[eBoundLoc1]), - lpolar[eBoundLoc0] * sin(lpolar[eBoundLoc1])); +Vector2 DiscSurface::localPolarToCartesian(const Vector2& lpolar) const { + return Vector2(lpolar[0] * cos(lpolar[1]), lpolar[0] * sin(lpolar[1])); } -Acts::Vector2 Acts::DiscSurface::localCartesianToPolar( - const Vector2& lcart) const { - return Vector2(lcart.norm(), - std::atan2(lcart[eBoundLoc1], lcart[eBoundLoc0])); +Vector2 DiscSurface::localCartesianToPolar(const Vector2& lcart) const { + return Vector2(lcart.norm(), std::atan2(lcart[1], lcart[0])); } -Acts::BoundToFreeMatrix Acts::DiscSurface::boundToFreeJacobian( +BoundToFreeMatrix DiscSurface::boundToFreeJacobian( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -239,7 +232,7 @@ Acts::BoundToFreeMatrix Acts::DiscSurface::boundToFreeJacobian( return jacToGlobal; } -Acts::FreeToBoundMatrix Acts::DiscSurface::freeToBoundJacobian( +FreeToBoundMatrix DiscSurface::freeToBoundJacobian( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { using VectorHelpers::perp; @@ -275,7 +268,7 @@ Acts::FreeToBoundMatrix Acts::DiscSurface::freeToBoundJacobian( return jacToLocal; } -Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( +SurfaceMultiIntersection DiscSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, double tolerance) const { @@ -310,7 +303,7 @@ Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( this}; } -Acts::ActsMatrix<2, 3> Acts::DiscSurface::localCartesianToBoundLocalDerivative( +ActsMatrix<2, 3> DiscSurface::localCartesianToBoundLocalDerivative( const GeometryContext& gctx, const Vector3& position) const { using VectorHelpers::perp; using VectorHelpers::phi; @@ -328,24 +321,24 @@ Acts::ActsMatrix<2, 3> Acts::DiscSurface::localCartesianToBoundLocalDerivative( return loc3DToLocBound; } -Acts::Vector3 Acts::DiscSurface::normal(const GeometryContext& gctx, - const Vector2& /*lposition*/) const { +Vector3 DiscSurface::normal(const GeometryContext& gctx, + const Vector2& /*lposition*/) const { return normal(gctx); } -Acts::Vector3 Acts::DiscSurface::normal(const GeometryContext& gctx, - const Vector3& /*position*/) const { +Vector3 DiscSurface::normal(const GeometryContext& gctx, + const Vector3& /*position*/) const { return normal(gctx); } -Acts::Vector3 Acts::DiscSurface::normal(const GeometryContext& gctx) const { +Vector3 DiscSurface::normal(const GeometryContext& gctx) const { // fast access via transform matrix (and not rotation()) const auto& tMatrix = transform(gctx).matrix(); return Vector3(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } -Acts::Vector3 Acts::DiscSurface::binningPosition(const GeometryContext& gctx, - BinningValue bValue) const { +Vector3 DiscSurface::binningPosition(const GeometryContext& gctx, + BinningValue bValue) const { if (bValue == BinningValue::binR || bValue == BinningValue::binPhi) { double r = m_bounds->binningValueR(); double phi = m_bounds->binningValuePhi(); @@ -354,8 +347,8 @@ Acts::Vector3 Acts::DiscSurface::binningPosition(const GeometryContext& gctx, return center(gctx); } -double Acts::DiscSurface::binningPositionValue(const GeometryContext& gctx, - BinningValue bValue) const { +double DiscSurface::binningPositionValue(const GeometryContext& gctx, + BinningValue bValue) const { if (bValue == BinningValue::binR) { return VectorHelpers::perp(binningPosition(gctx, bValue)); } @@ -366,18 +359,17 @@ double Acts::DiscSurface::binningPositionValue(const GeometryContext& gctx, return GeometryObject::binningPositionValue(gctx, bValue); } -double Acts::DiscSurface::pathCorrection(const GeometryContext& gctx, - const Vector3& /*position*/, - const Vector3& direction) const { - /// we can ignore the global position here +double DiscSurface::pathCorrection(const GeometryContext& gctx, + const Vector3& /*position*/, + const Vector3& direction) const { + // we can ignore the global position here return 1. / std::abs(normal(gctx).dot(direction)); } -std::pair, bool> -Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, - bool externalRotation, - const Logger& logger) const { - using namespace Acts::UnitLiterals; +std::pair, bool> DiscSurface::mergedWith( + const DiscSurface& other, BinningValue direction, bool externalRotation, + const Logger& logger) const { + using namespace UnitLiterals; ACTS_VERBOSE("Merging disc surfaces in " << direction << " direction"); @@ -451,7 +443,7 @@ Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, << otherAvgPhi / 1_degree << " +- " << otherHlPhi / 1_degree); - if (direction == Acts::BinningValue::binR) { + if (direction == BinningValue::binR) { if (std::abs(otherLocal.linear().col(eY)[eX]) >= tolerance && (!bounds->coversFullAzimuth() || !otherBounds->coversFullAzimuth())) { throw SurfaceMergingException(getSharedPtr(), other.getSharedPtr(), @@ -491,7 +483,7 @@ Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, return {Surface::makeShared(*m_transform, newBounds), minR > otherMinR}; - } else if (direction == Acts::BinningValue::binPhi) { + } else if (direction == BinningValue::binPhi) { if (std::abs(maxR - otherMaxR) > tolerance || std::abs(minR - otherMinR) > tolerance) { ACTS_ERROR("DiscSurface::merge: surfaces don't have same r bounds"); @@ -548,3 +540,5 @@ Acts::DiscSurface::mergedWith(const DiscSurface& other, BinningValue direction, "DiscSurface::merge: invalid direction " + binningValueName(direction)); } } + +} // namespace Acts diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index ed02bac17de..d96b2ea645e 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -8,52 +8,63 @@ #include "Acts/Surfaces/DiscTrapezoidBounds.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Utilities/detail/periodic.hpp" #include #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; +std::vector DiscTrapezoidBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + +void DiscTrapezoidBounds::checkConsistency() noexcept(false) { + if (get(eMinR) < 0. || get(eMaxR) <= 0. || get(eMinR) > get(eMaxR)) { + throw std::invalid_argument("DiscTrapezoidBounds: invalid radial setup."); + } + if (get(eHalfLengthXminR) < 0. || get(eHalfLengthXmaxR) <= 0.) { + throw std::invalid_argument("DiscTrapezoidBounds: negative length given."); + } + if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { + throw std::invalid_argument( + "DiscTrapezoidBounds: invalid phi positioning."); + } } -Acts::Vector2 Acts::DiscTrapezoidBounds::toLocalCartesian( - const Acts::Vector2& lposition) const { - return {lposition[eBoundLoc0] * - std::sin(lposition[eBoundLoc1] - get(eAveragePhi)), - lposition[eBoundLoc0] * - std::cos(lposition[eBoundLoc1] - get(eAveragePhi))}; +Vector2 DiscTrapezoidBounds::toLocalCartesian(const Vector2& lposition) const { + return {lposition[0] * std::sin(lposition[1] - get(eAveragePhi)), + lposition[0] * std::cos(lposition[1] - 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]); +SquareMatrix2 DiscTrapezoidBounds::jacobianToLocalCartesian( + const Vector2& lposition) const { + SquareMatrix2 jacobian; + jacobian(0, 0) = std::sin(lposition[1] - get(eAveragePhi)); + jacobian(1, 0) = std::cos(lposition[1] - get(eAveragePhi)); + jacobian(0, 1) = lposition[0] * std::cos(lposition[1]); + jacobian(1, 1) = lposition[0] * -std::sin(lposition[1]); return jacobian; } -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}, @@ -63,7 +74,7 @@ bool Acts::DiscTrapezoidBounds::inside( toLocalCartesian(lposition), jacobian); } -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()); @@ -76,8 +87,7 @@ std::vector Acts::DiscTrapezoidBounds::vertices( halfY * cAxis - get(eHalfLengthXmaxR) * nAxis}; } -// 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, " @@ -91,3 +101,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 485f36736d8..531e1ce7d28 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -8,31 +8,44 @@ #include "Acts/Surfaces/EllipseBounds.hpp" -#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 "Acts/Utilities/detail/periodic.hpp" #include #include #include -#include -using Acts::VectorHelpers::perp; -using Acts::VectorHelpers::phi; +namespace Acts { -Acts::SurfaceBounds::BoundsType Acts::EllipseBounds::type() const { - return SurfaceBounds::eEllipse; +using VectorHelpers::perp; +using VectorHelpers::phi; + +std::vector EllipseBounds::values() const { + return {m_values.begin(), m_values.end()}; } -static inline double square(double x) { - return x * x; +void EllipseBounds::checkConsistency() noexcept(false) { + if (get(eInnerRx) >= get(eOuterRx) || get(eInnerRx) < 0. || + get(eOuterRx) <= 0.) { + throw std::invalid_argument("EllipseBounds: invalid along x axis"); + } + if (get(eInnerRy) >= get(eOuterRy) || get(eInnerRy) < 0. || + get(eOuterRy) <= 0.) { + throw std::invalid_argument("EllipseBounds: invalid along y axis."); + } + if (get(eHalfPhiSector) < 0. || get(eHalfPhiSector) > std::numbers::pi) { + throw std::invalid_argument("EllipseBounds: invalid phi sector setup."); + } + if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { + throw std::invalid_argument("EllipseBounds: invalid phi positioning."); + } } -/// @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; } @@ -47,32 +60,29 @@ bool Acts::EllipseBounds::inside( double phiHalf = get(eHalfPhiSector) + tol1; 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)))); - bool insideOuter = - (square(lposition[Acts::eBoundLoc0] / (get(eInnerRy) + tol0)) + - square(lposition[Acts::eBoundLoc1] / (get(eOuterRy) + tol0))) < 1; + 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 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, " @@ -83,3 +93,5 @@ std::ostream& Acts::EllipseBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/IntersectionHelper2D.cpp b/Core/src/Surfaces/IntersectionHelper2D.cpp index 458a54a2262..c3cd0cdf8b2 100644 --- a/Core/src/Surfaces/IntersectionHelper2D.cpp +++ b/Core/src/Surfaces/IntersectionHelper2D.cpp @@ -14,9 +14,13 @@ #include -Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectSegment( - const Vector2& s0, const Vector2& s1, const Vector2& origin, - const Vector2& dir, bool boundCheck) { +namespace Acts::detail { + +Intersection2D IntersectionHelper2D::intersectSegment(const Vector2& s0, + const Vector2& s1, + const Vector2& origin, + const Vector2& dir, + bool boundCheck) { using Line = Eigen::ParametrizedLine; using Plane = Eigen::Hyperplane; @@ -40,13 +44,11 @@ Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectSegment( return Intersection2D(intersection, d, status); } -std::array -Acts::detail::IntersectionHelper2D::intersectEllipse(double Rx, double Ry, - const Vector2& origin, - const Vector2& dir) { +std::array IntersectionHelper2D::intersectEllipse( + double Rx, double Ry, const Vector2& origin, const Vector2& dir) { auto createSolution = [&](const Vector2& sol, - const Vector2& alt) -> std::array { + const Vector2& alt) -> std::array { Vector2 toSolD(sol - origin); Vector2 toAltD(alt - origin); @@ -98,7 +100,7 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(double Rx, double Ry, double alpha = 1. / (Rx * Rx) + k * k / Ry2; double beta = 2. * k * d / Ry2; double gamma = d * d / Ry2 - 1; - Acts::detail::RealQuadraticEquation solver(alpha, beta, gamma); + RealQuadraticEquation solver(alpha, beta, gamma); if (solver.solutions == 1) { double x = solver.first; Vector2 sol(x, k * x + d); @@ -116,13 +118,13 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(double Rx, double Ry, return {Intersection2D::invalid(), Intersection2D::invalid()}; } -Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectCircleSegment( +Intersection2D IntersectionHelper2D::intersectCircleSegment( double R, double phiMin, double phiMax, const Vector2& origin, const Vector2& dir) { auto intersections = intersectCircle(R, origin, dir); for (const auto& candidate : intersections) { if (candidate.pathLength() > 0.) { - double phi = Acts::VectorHelpers::phi(candidate.position()); + double phi = VectorHelpers::phi(candidate.position()); if (phi > phiMin && phi < phiMax) { return candidate; } @@ -130,3 +132,5 @@ Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectCircleSegment( } return Intersection2D::invalid(); } + +} // namespace Acts::detail diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index bdb0673a010..9511722d002 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -14,13 +14,23 @@ #include #include -Acts::SurfaceBounds::BoundsType Acts::LineBounds::type() const { - return SurfaceBounds::eLine; +namespace Acts { + +std::vector LineBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + +void LineBounds::checkConsistency() noexcept(false) { + if (get(eR) < 0.) { + throw std::invalid_argument("LineBounds: zero radius."); + } + if (get(eHalfLengthZ) <= 0.) { + throw std::invalid_argument("LineBounds: zero/negative length."); + } } -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), @@ -28,8 +38,7 @@ 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) = "; @@ -38,3 +47,5 @@ std::ostream& Acts::LineBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp index 166a36bf630..68957d5824b 100644 --- a/Core/src/Surfaces/LineSurface.cpp +++ b/Core/src/Surfaces/LineSurface.cpp @@ -15,46 +15,39 @@ #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Surfaces/SurfaceError.hpp" #include "Acts/Surfaces/detail/AlignmentHelper.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Intersection.hpp" -#include "Acts/Utilities/JacobianHelpers.hpp" #include "Acts/Utilities/ThrowAssert.hpp" -#include #include #include -#include #include namespace Acts { -class DetectorElementBase; -} // namespace Acts -Acts::LineSurface::LineSurface(const Transform3& transform, double radius, - double halez) +LineSurface::LineSurface(const Transform3& transform, double radius, + double halez) : GeometryObject(), Surface(transform), m_bounds(std::make_shared(radius, halez)) {} -Acts::LineSurface::LineSurface(const Transform3& transform, - std::shared_ptr lbounds) +LineSurface::LineSurface(const Transform3& transform, + std::shared_ptr lbounds) : GeometryObject(), Surface(transform), m_bounds(std::move(lbounds)) {} -Acts::LineSurface::LineSurface(std::shared_ptr lbounds, - const DetectorElementBase& detelement) +LineSurface::LineSurface(std::shared_ptr lbounds, + const DetectorElementBase& detelement) : GeometryObject(), Surface(detelement), m_bounds(std::move(lbounds)) { throw_assert(m_bounds, "LineBounds must not be nullptr"); } -Acts::LineSurface::LineSurface(const LineSurface& other) +LineSurface::LineSurface(const LineSurface& other) : GeometryObject(), Surface(other), m_bounds(other.m_bounds) {} -Acts::LineSurface::LineSurface(const GeometryContext& gctx, - const LineSurface& other, - const Transform3& shift) +LineSurface::LineSurface(const GeometryContext& gctx, const LineSurface& other, + const Transform3& shift) : GeometryObject(), Surface(gctx, other, shift), m_bounds(other.m_bounds) {} -Acts::LineSurface& Acts::LineSurface::operator=(const LineSurface& other) { +LineSurface& LineSurface::operator=(const LineSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; @@ -62,23 +55,22 @@ Acts::LineSurface& Acts::LineSurface::operator=(const LineSurface& other) { return *this; } -Acts::Vector3 Acts::LineSurface::localToGlobal(const GeometryContext& gctx, - const Vector2& lposition, - const Vector3& direction) const { +Vector3 LineSurface::localToGlobal(const GeometryContext& gctx, + const Vector2& lposition, + const Vector3& direction) const { Vector3 unitZ0 = lineDirection(gctx); // get the vector perpendicular to the momentum direction and the straw axis Vector3 radiusAxisGlobal = unitZ0.cross(direction); - Vector3 locZinGlobal = - transform(gctx) * Vector3(0., 0., lposition[eBoundLoc1]); - // add eBoundLoc0 * radiusAxis - return Vector3(locZinGlobal + - lposition[eBoundLoc0] * radiusAxisGlobal.normalized()); + Vector3 locZinGlobal = transform(gctx) * Vector3(0., 0., lposition[1]); + // add loc0 * radiusAxis + return Vector3(locZinGlobal + lposition[0] * radiusAxisGlobal.normalized()); } -Acts::Result Acts::LineSurface::globalToLocal( - const GeometryContext& gctx, const Vector3& position, - const Vector3& direction, double tolerance) const { +Result LineSurface::globalToLocal(const GeometryContext& gctx, + const Vector3& position, + const Vector3& direction, + double tolerance) const { using VectorHelpers::perp; // Bring the global position into the local frame. First remove the @@ -102,13 +94,13 @@ Acts::Result Acts::LineSurface::globalToLocal( return Result::success(localXY); } -std::string Acts::LineSurface::name() const { +std::string LineSurface::name() const { return "Acts::LineSurface"; } -Acts::RotationMatrix3 Acts::LineSurface::referenceFrame( - const GeometryContext& gctx, const Vector3& /*position*/, - const Vector3& direction) const { +RotationMatrix3 LineSurface::referenceFrame(const GeometryContext& gctx, + const Vector3& /*position*/, + const Vector3& direction) const { Vector3 unitZ0 = lineDirection(gctx); Vector3 unitD0 = unitZ0.cross(direction).normalized(); Vector3 unitDistance = unitD0.cross(unitZ0); @@ -121,32 +113,31 @@ Acts::RotationMatrix3 Acts::LineSurface::referenceFrame( return mFrame; } -double Acts::LineSurface::pathCorrection(const GeometryContext& /*gctx*/, - const Vector3& /*pos*/, - const Vector3& /*mom*/) const { +double LineSurface::pathCorrection(const GeometryContext& /*gctx*/, + const Vector3& /*pos*/, + const Vector3& /*mom*/) const { return 1.; } -Acts::Vector3 Acts::LineSurface::binningPosition( - const GeometryContext& gctx, BinningValue /*bValue*/) const { +Vector3 LineSurface::binningPosition(const GeometryContext& gctx, + BinningValue /*bValue*/) const { return center(gctx); } -Acts::Vector3 Acts::LineSurface::normal(const GeometryContext& gctx, - const Vector3& pos, - const Vector3& direction) const { +Vector3 LineSurface::normal(const GeometryContext& gctx, const Vector3& pos, + const Vector3& direction) const { auto ref = referenceFrame(gctx, pos, direction); return ref.col(2); } -const Acts::SurfaceBounds& Acts::LineSurface::bounds() const { +const SurfaceBounds& LineSurface::bounds() const { if (m_bounds) { return (*m_bounds.get()); } return s_noBounds; } -Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( +SurfaceMultiIntersection LineSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, double tolerance) const { @@ -192,7 +183,7 @@ Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( return {{Intersection3D(result, u, status), Intersection3D::invalid()}, this}; } -Acts::BoundToFreeMatrix Acts::LineSurface::boundToFreeJacobian( +BoundToFreeMatrix LineSurface::boundToFreeJacobian( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -229,7 +220,7 @@ Acts::BoundToFreeMatrix Acts::LineSurface::boundToFreeJacobian( return jacToGlobal; } -Acts::FreeToPathMatrix Acts::LineSurface::freeToPathDerivative( +FreeToPathMatrix LineSurface::freeToPathDerivative( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -258,7 +249,7 @@ Acts::FreeToPathMatrix Acts::LineSurface::freeToPathDerivative( return freeToPath; } -Acts::AlignmentToPathMatrix Acts::LineSurface::alignmentToPathDerivative( +AlignmentToPathMatrix LineSurface::alignmentToPathDerivative( const GeometryContext& gctx, const Vector3& position, const Vector3& direction) const { assert(isOnSurface(gctx, position, direction, BoundaryTolerance::Infinite())); @@ -288,7 +279,7 @@ Acts::AlignmentToPathMatrix Acts::LineSurface::alignmentToPathDerivative( return alignToPath; } -Acts::ActsMatrix<2, 3> Acts::LineSurface::localCartesianToBoundLocalDerivative( +ActsMatrix<2, 3> LineSurface::localCartesianToBoundLocalDerivative( const GeometryContext& gctx, const Vector3& position) const { // calculate the transformation to local coordinates Vector3 localPosition = transform(gctx).inverse() * position; @@ -300,7 +291,8 @@ Acts::ActsMatrix<2, 3> Acts::LineSurface::localCartesianToBoundLocalDerivative( return loc3DToLocBound; } -Acts::Vector3 Acts::LineSurface::lineDirection( - const GeometryContext& gctx) const { +Vector3 LineSurface::lineDirection(const GeometryContext& gctx) const { return transform(gctx).linear().col(2); } + +} // namespace Acts diff --git a/Core/src/Surfaces/PerigeeSurface.cpp b/Core/src/Surfaces/PerigeeSurface.cpp index 777d061b2b1..1d6a357db29 100644 --- a/Core/src/Surfaces/PerigeeSurface.cpp +++ b/Core/src/Surfaces/PerigeeSurface.cpp @@ -15,38 +15,39 @@ #include #include -Acts::PerigeeSurface::PerigeeSurface(const Vector3& gp) +namespace Acts { + +PerigeeSurface::PerigeeSurface(const Vector3& gp) : LineSurface(Transform3(Translation3(gp.x(), gp.y(), gp.z())), nullptr) {} -Acts::PerigeeSurface::PerigeeSurface(const Transform3& transform) +PerigeeSurface::PerigeeSurface(const Transform3& transform) : GeometryObject(), LineSurface(transform) {} -Acts::PerigeeSurface::PerigeeSurface(const PerigeeSurface& other) +PerigeeSurface::PerigeeSurface(const PerigeeSurface& other) : GeometryObject(), LineSurface(other) {} -Acts::PerigeeSurface::PerigeeSurface(const GeometryContext& gctx, - const PerigeeSurface& other, - const Transform3& shift) +PerigeeSurface::PerigeeSurface(const GeometryContext& gctx, + const PerigeeSurface& other, + const Transform3& shift) : GeometryObject(), LineSurface(gctx, other, shift) {} -Acts::PerigeeSurface& Acts::PerigeeSurface::operator=( - const PerigeeSurface& other) { +PerigeeSurface& PerigeeSurface::operator=(const PerigeeSurface& other) { if (this != &other) { LineSurface::operator=(other); } return *this; } -Acts::Surface::SurfaceType Acts::PerigeeSurface::type() const { +Surface::SurfaceType PerigeeSurface::type() const { return Surface::Perigee; } -std::string Acts::PerigeeSurface::name() const { +std::string PerigeeSurface::name() const { return "Acts::PerigeeSurface"; } -std::ostream& Acts::PerigeeSurface::toStreamImpl(const GeometryContext& gctx, - std::ostream& sl) const { +std::ostream& PerigeeSurface::toStreamImpl(const GeometryContext& gctx, + std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::PerigeeSurface:" << std::endl; @@ -57,7 +58,7 @@ std::ostream& Acts::PerigeeSurface::toStreamImpl(const GeometryContext& gctx, return sl; } -Acts::Polyhedron Acts::PerigeeSurface::polyhedronRepresentation( +Polyhedron PerigeeSurface::polyhedronRepresentation( const GeometryContext& gctx, unsigned int /*quarterSegments*/) const { // Prepare vertices and faces std::vector vertices; @@ -77,3 +78,5 @@ Acts::Polyhedron Acts::PerigeeSurface::polyhedronRepresentation( return Polyhedron(vertices, faces, triangularMesh); } + +} // namespace Acts diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index b4ebb77956c..aebc75315ef 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -8,7 +8,6 @@ #include "Acts/Surfaces/PlaneSurface.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Geometry/GeometryObject.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/CurvilinearSurface.hpp" @@ -28,28 +27,30 @@ #include #include -Acts::PlaneSurface::PlaneSurface(const PlaneSurface& other) +namespace Acts { + +PlaneSurface::PlaneSurface(const PlaneSurface& other) : GeometryObject(), RegularSurface(other), m_bounds(other.m_bounds) {} -Acts::PlaneSurface::PlaneSurface(const GeometryContext& gctx, - const PlaneSurface& other, - const Transform3& transform) +PlaneSurface::PlaneSurface(const GeometryContext& gctx, + const PlaneSurface& other, + const Transform3& transform) : GeometryObject(), RegularSurface(gctx, other, transform), m_bounds(other.m_bounds) {} -Acts::PlaneSurface::PlaneSurface(std::shared_ptr pbounds, - const Acts::DetectorElementBase& detelement) +PlaneSurface::PlaneSurface(std::shared_ptr pbounds, + const DetectorElementBase& detelement) : RegularSurface(detelement), m_bounds(std::move(pbounds)) { - /// surfaces representing a detector element must have bounds + // surfaces representing a detector element must have bounds throw_assert(m_bounds, "PlaneBounds must not be nullptr"); } -Acts::PlaneSurface::PlaneSurface(const Transform3& transform, - std::shared_ptr pbounds) +PlaneSurface::PlaneSurface(const Transform3& transform, + std::shared_ptr pbounds) : RegularSurface(transform), m_bounds(std::move(pbounds)) {} -Acts::PlaneSurface& Acts::PlaneSurface::operator=(const PlaneSurface& other) { +PlaneSurface& PlaneSurface::operator=(const PlaneSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; @@ -57,19 +58,18 @@ Acts::PlaneSurface& Acts::PlaneSurface::operator=(const PlaneSurface& other) { return *this; } -Acts::Surface::SurfaceType Acts::PlaneSurface::type() const { +Surface::SurfaceType PlaneSurface::type() const { return Surface::Plane; } -Acts::Vector3 Acts::PlaneSurface::localToGlobal( - const GeometryContext& gctx, const Vector2& lposition) const { - return transform(gctx) * - Vector3(lposition[Acts::eBoundLoc0], lposition[Acts::eBoundLoc1], 0.); +Vector3 PlaneSurface::localToGlobal(const GeometryContext& gctx, + const Vector2& lposition) const { + return transform(gctx) * Vector3(lposition[0], lposition[1], 0.); } -Acts::Result Acts::PlaneSurface::globalToLocal( - const GeometryContext& gctx, const Vector3& position, - double tolerance) const { +Result PlaneSurface::globalToLocal(const GeometryContext& gctx, + const Vector3& position, + double tolerance) const { Vector3 loc3Dframe = transform(gctx).inverse() * position; if (std::abs(loc3Dframe.z()) > std::abs(tolerance)) { return Result::failure(SurfaceError::GlobalPositionNotOnSurface); @@ -77,18 +77,18 @@ Acts::Result Acts::PlaneSurface::globalToLocal( return Result::success({loc3Dframe.x(), loc3Dframe.y()}); } -std::string Acts::PlaneSurface::name() const { +std::string PlaneSurface::name() const { return "Acts::PlaneSurface"; } -const Acts::SurfaceBounds& Acts::PlaneSurface::bounds() const { +const SurfaceBounds& PlaneSurface::bounds() const { if (m_bounds) { return (*m_bounds.get()); } return s_noBounds; } -Acts::Polyhedron Acts::PlaneSurface::polyhedronRepresentation( +Polyhedron PlaneSurface::polyhedronRepresentation( const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector vertices; @@ -131,33 +131,33 @@ Acts::Polyhedron Acts::PlaneSurface::polyhedronRepresentation( "Polyhedron representation of boundless surface not possible."); } -Acts::Vector3 Acts::PlaneSurface::normal(const GeometryContext& gctx, - const Vector2& /*lpos*/) const { +Vector3 PlaneSurface::normal(const GeometryContext& gctx, + const Vector2& /*lpos*/) const { return normal(gctx); } -Acts::Vector3 Acts::PlaneSurface::normal(const GeometryContext& gctx, - const Vector3& /*pos*/) const { +Vector3 PlaneSurface::normal(const GeometryContext& gctx, + const Vector3& /*pos*/) const { return normal(gctx); } -Acts::Vector3 Acts::PlaneSurface::normal(const GeometryContext& gctx) const { +Vector3 PlaneSurface::normal(const GeometryContext& gctx) const { return transform(gctx).linear().col(2); } -Acts::Vector3 Acts::PlaneSurface::binningPosition( - const GeometryContext& gctx, BinningValue /*bValue*/) const { +Vector3 PlaneSurface::binningPosition(const GeometryContext& gctx, + BinningValue /*bValue*/) const { return center(gctx); } -double Acts::PlaneSurface::pathCorrection(const GeometryContext& gctx, - const Vector3& /*position*/, - const Vector3& direction) const { +double PlaneSurface::pathCorrection(const GeometryContext& gctx, + const Vector3& /*position*/, + const Vector3& direction) const { // We can ignore the global position here return 1. / std::abs(normal(gctx).dot(direction)); } -Acts::SurfaceMultiIntersection Acts::PlaneSurface::intersect( +SurfaceMultiIntersection PlaneSurface::intersect( const GeometryContext& gctx, const Vector3& position, const Vector3& direction, const BoundaryTolerance& boundaryTolerance, double tolerance) const { @@ -184,8 +184,10 @@ Acts::SurfaceMultiIntersection Acts::PlaneSurface::intersect( this}; } -Acts::ActsMatrix<2, 3> Acts::PlaneSurface::localCartesianToBoundLocalDerivative( +ActsMatrix<2, 3> PlaneSurface::localCartesianToBoundLocalDerivative( const GeometryContext& /*gctx*/, const Vector3& /*position*/) const { const ActsMatrix<2, 3> loc3DToLocBound = ActsMatrix<2, 3>::Identity(); return loc3DToLocBound; } + +} // namespace Acts diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 03a32ef2a34..41bd184be9a 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -8,7 +8,6 @@ #include "Acts/Surfaces/RadialBounds.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" @@ -16,36 +15,47 @@ #include #include +#include -Acts::SurfaceBounds::BoundsType Acts::RadialBounds::type() const { - return SurfaceBounds::eDisc; +namespace Acts { + +std::vector RadialBounds::values() const { + return {m_values.begin(), m_values.end()}; +} + +void RadialBounds::checkConsistency() noexcept(false) { + if (get(eMinR) < 0. || get(eMaxR) <= 0. || get(eMinR) > get(eMaxR)) { + throw std::invalid_argument("RadialBounds: invalid radial setup"); + } + if (get(eHalfPhiSector) < 0. || get(eHalfPhiSector) > std::numbers::pi) { + throw std::invalid_argument("RadialBounds: invalid phi sector setup."); + } + if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) { + throw std::invalid_argument("RadialBounds: invalid phi positioning."); + } } -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] = - detail::radian_sym(lposition[eBoundLoc1] - get(eAveragePhi)); + tmp[0] = lposition[0]; + tmp[1] = detail::radian_sym(lposition[1] - get(eAveragePhi)); return tmp; } -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, " @@ -55,3 +65,5 @@ std::ostream& Acts::RadialBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index 21c8daec4e9..98bdedd930d 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -12,26 +12,51 @@ #include #include +#include -bool Acts::RectangleBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { +namespace Acts { + +double RectangleBounds::get(BoundValues bValue) const { + switch (bValue) { + case eMinX: + return m_min.x(); + case eMinY: + return m_min.y(); + case eMaxX: + return m_max.x(); + case eMaxY: + return m_max.y(); + default: + assert(false && "Invalid BoundValue enum value"); + return std::numeric_limits::quiet_NaN(); + } +} + +void RectangleBounds::checkConsistency() noexcept(false) { + if (get(eMinX) > get(eMaxX)) { + throw std::invalid_argument("RectangleBounds: invalid local x setup"); + } + if (get(eMinY) > get(eMaxY)) { + throw std::invalid_argument("RectangleBounds: invalid local y setup"); + } +} + +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) = " @@ -42,3 +67,5 @@ std::ostream& Acts::RectangleBounds::toStream(std::ostream& sl) const { sl << std::setprecision(-1); return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/StrawSurface.cpp b/Core/src/Surfaces/StrawSurface.cpp index b6e241af858..8a004b31354 100644 --- a/Core/src/Surfaces/StrawSurface.cpp +++ b/Core/src/Surfaces/StrawSurface.cpp @@ -14,33 +14,32 @@ #include "Acts/Surfaces/detail/FacesHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" -#include #include #include #include -Acts::StrawSurface::StrawSurface(const Transform3& transform, double radius, - double halez) +namespace Acts { + +StrawSurface::StrawSurface(const Transform3& transform, double radius, + double halez) : GeometryObject(), LineSurface(transform, radius, halez) {} -Acts::StrawSurface::StrawSurface(const Transform3& transform, - std::shared_ptr lbounds) +StrawSurface::StrawSurface(const Transform3& transform, + std::shared_ptr lbounds) : GeometryObject(), LineSurface(transform, std::move(lbounds)) {} -Acts::StrawSurface::StrawSurface( - const std::shared_ptr& lbounds, - const DetectorElementBase& detelement) +StrawSurface::StrawSurface(const std::shared_ptr& lbounds, + const DetectorElementBase& detelement) : GeometryObject(), LineSurface(lbounds, detelement) {} -Acts::StrawSurface::StrawSurface(const Acts::StrawSurface& other) +StrawSurface::StrawSurface(const StrawSurface& other) : GeometryObject(), LineSurface(other) {} -Acts::StrawSurface::StrawSurface(const GeometryContext& gctx, - const StrawSurface& other, - const Transform3& shift) +StrawSurface::StrawSurface(const GeometryContext& gctx, + const StrawSurface& other, const Transform3& shift) : GeometryObject(), LineSurface(gctx, other, shift) {} -Acts::StrawSurface& Acts::StrawSurface::operator=(const StrawSurface& other) { +StrawSurface& StrawSurface::operator=(const StrawSurface& other) { if (this != &other) { LineSurface::operator=(other); m_bounds = other.m_bounds; @@ -48,7 +47,7 @@ Acts::StrawSurface& Acts::StrawSurface::operator=(const StrawSurface& other) { return *this; } -Acts::Polyhedron Acts::StrawSurface::polyhedronRepresentation( +Polyhedron StrawSurface::polyhedronRepresentation( const GeometryContext& gctx, unsigned int quarterSegments) const { // Prepare vertices and faces std::vector vertices; @@ -62,7 +61,7 @@ Acts::Polyhedron Acts::StrawSurface::polyhedronRepresentation( // Write the two bows/circles on either side std::vector sides = {-1, 1}; for (auto& side : sides) { - /// Helper method to create the segment + // Helper method to create the segment auto svertices = detail::VerticesHelper::segmentVertices( {r, r}, -std::numbers::pi, std::numbers::pi, {}, quarterSegments, Vector3(0., 0., side * m_bounds->get(LineBounds::eHalfLengthZ)), @@ -86,3 +85,5 @@ Acts::Polyhedron Acts::StrawSurface::polyhedronRepresentation( return Polyhedron(vertices, faces, triangularMesh, false); } + +} // namespace Acts diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 0fbfe6bc982..5394587eeae 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; @@ -204,19 +203,18 @@ bool Acts::Surface::operator==(const Surface& other) const { return true; } -// 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 +227,39 @@ 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( - const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +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 +278,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 +300,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 +317,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/Core/src/Surfaces/SurfaceArray.cpp b/Core/src/Surfaces/SurfaceArray.cpp index 2606c13a702..619b432d7a9 100644 --- a/Core/src/Surfaces/SurfaceArray.cpp +++ b/Core/src/Surfaces/SurfaceArray.cpp @@ -11,31 +11,31 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/SurfaceArrayCreator.hpp" #include "Acts/Utilities/Helpers.hpp" -#include "Acts/Utilities/ThrowAssert.hpp" #include +namespace Acts { + // implementation for pure virtual destructor of ISurfaceGridLookup -Acts::SurfaceArray::ISurfaceGridLookup::~ISurfaceGridLookup() = default; +SurfaceArray::ISurfaceGridLookup::~ISurfaceGridLookup() = default; -Acts::SurfaceArray::SurfaceArray( - std::unique_ptr gridLookup, - std::vector> surfaces, - const Transform3& transform) +SurfaceArray::SurfaceArray(std::unique_ptr gridLookup, + std::vector> surfaces, + const Transform3& transform) : p_gridLookup(std::move(gridLookup)), m_surfaces(std::move(surfaces)), m_surfacesRawPointers(unpack_shared_vector(m_surfaces)), m_transform(transform) {} -Acts::SurfaceArray::SurfaceArray(std::shared_ptr srf) +SurfaceArray::SurfaceArray(std::shared_ptr srf) : p_gridLookup( static_cast(new SingleElementLookup(srf.get()))), m_surfaces({std::move(srf)}) { m_surfacesRawPointers.push_back(m_surfaces.at(0).get()); } -std::ostream& Acts::SurfaceArray::toStream(const GeometryContext& /*gctx*/, - std::ostream& sl) const { +std::ostream& SurfaceArray::toStream(const GeometryContext& /*gctx*/, + std::ostream& sl) const { sl << std::fixed << std::setprecision(4); sl << "SurfaceArray:" << std::endl; sl << " - no surfaces: " << m_surfaces.size() << std::endl; @@ -75,3 +75,5 @@ std::ostream& Acts::SurfaceArray::toStream(const GeometryContext& /*gctx*/, } return sl; } + +} // namespace Acts diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 3450e8cea97..73b082cefec 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" @@ -16,25 +15,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( @@ -44,15 +35,12 @@ Acts::TrapezoidBounds::TrapezoidBounds( checkConsistency(); } -Acts::TrapezoidBounds::~TrapezoidBounds() = default; - -Acts::SurfaceBounds::BoundsType Acts::TrapezoidBounds::type() const { - return SurfaceBounds::eTrapezoid; +std::vector TrapezoidBounds::values() const { + return {m_values.begin(), m_values.end()}; } -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; } @@ -62,7 +50,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]; @@ -95,14 +83,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; @@ -110,11 +98,11 @@ 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) = " @@ -124,13 +112,7 @@ std::ostream& Acts::TrapezoidBounds::toStream(std::ostream& sl) const { return sl; } -std::vector Acts::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.) { @@ -138,7 +120,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"); } @@ -146,3 +128,5 @@ void Acts::TrapezoidBounds::checkConsistency() noexcept(false) { throw std::invalid_argument("TrapezoidBounds: invalid local y setup"); } } + +} // namespace Acts diff --git a/Core/src/Surfaces/detail/AlignmentHelper.cpp b/Core/src/Surfaces/detail/AlignmentHelper.cpp index b5308d60c84..4f9c53a56ce 100644 --- a/Core/src/Surfaces/detail/AlignmentHelper.cpp +++ b/Core/src/Surfaces/detail/AlignmentHelper.cpp @@ -8,11 +8,11 @@ #include "Acts/Surfaces/detail/AlignmentHelper.hpp" -#include -#include #include -Acts::detail::RotationToAxes Acts::detail::rotationToLocalAxesDerivative( +namespace Acts { + +detail::RotationToAxes detail::rotationToLocalAxesDerivative( const RotationMatrix3& compositeRotation, const RotationMatrix3& relRotation) { // Suppose the local axes of the composite have small rotation first around @@ -90,3 +90,5 @@ Acts::detail::RotationToAxes Acts::detail::rotationToLocalAxesDerivative( return {std::move(rotToLocalXAxis), std::move(rotToLocalYAxis), std::move(rotToLocalZAxis)}; } + +} // namespace Acts diff --git a/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp b/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp index 4ceab6d594b..757fbaf5d0d 100644 --- a/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp +++ b/Core/src/Surfaces/detail/AnnulusBoundsHelper.cpp @@ -11,13 +11,13 @@ #include "Acts/Surfaces/AnnulusBounds.hpp" #include "Acts/Utilities/VectorHelpers.hpp" -#include #include -std::tuple, Acts::Transform3> -Acts::detail::AnnulusBoundsHelper::create(const Transform3& transform, - double rMin, double rMax, - std::vector vertices) { +namespace Acts::detail { + +std::tuple, Transform3> +AnnulusBoundsHelper::create(const Transform3& transform, double rMin, + double rMax, std::vector vertices) { using Line2D = Eigen::Hyperplane; // Construct the bound lines @@ -65,3 +65,5 @@ Acts::detail::AnnulusBoundsHelper::create(const Transform3& transform, return {annulusBounds, boundsTransform}; } + +} // namespace Acts::detail diff --git a/Core/src/Surfaces/detail/MergeHelper.cpp b/Core/src/Surfaces/detail/MergeHelper.cpp index ca394efd4e8..49fcd8a7fac 100644 --- a/Core/src/Surfaces/detail/MergeHelper.cpp +++ b/Core/src/Surfaces/detail/MergeHelper.cpp @@ -8,6 +8,9 @@ #include "Acts/Surfaces/detail/MergeHelper.hpp" +#include "Acts/Definitions/Units.hpp" +#include "Acts/Utilities/detail/periodic.hpp" + #include namespace Acts::detail { @@ -16,7 +19,7 @@ std::tuple mergedPhiSector(double hlPhi1, double avgPhi1, double hlPhi2, double avgPhi2, const Logger& logger, double tolerance) { - using namespace Acts::UnitLiterals; + using namespace UnitLiterals; if (std::abs(hlPhi1 - std::numbers::pi / 2.) < tolerance && std::abs(hlPhi2 - std::numbers::pi / 2.) < tolerance) { diff --git a/Core/src/Surfaces/detail/VerticesHelper.cpp b/Core/src/Surfaces/detail/VerticesHelper.cpp index 98a00deb142..14b7cdad222 100644 --- a/Core/src/Surfaces/detail/VerticesHelper.cpp +++ b/Core/src/Surfaces/detail/VerticesHelper.cpp @@ -13,7 +13,9 @@ #include #include -std::vector Acts::detail::VerticesHelper::phiSegments( +namespace Acts { + +std::vector detail::VerticesHelper::phiSegments( double phiMin, double phiMax, const std::vector& phiRefs, unsigned int quarterSegments) { // Check that the phi range is valid @@ -67,7 +69,7 @@ std::vector Acts::detail::VerticesHelper::phiSegments( return phiSegments; } -std::vector Acts::detail::VerticesHelper::ellipsoidVertices( +std::vector detail::VerticesHelper::ellipsoidVertices( double innerRx, double innerRy, double outerRx, double outerRy, double avgPhi, double halfPhi, unsigned int quarterSegments) { // List of vertices counter-clockwise starting at smallest phi w.r.t center, @@ -111,15 +113,15 @@ std::vector Acts::detail::VerticesHelper::ellipsoidVertices( return rvertices; } -std::vector Acts::detail::VerticesHelper::circularVertices( +std::vector detail::VerticesHelper::circularVertices( double innerR, double outerR, double avgPhi, double halfPhi, unsigned int quarterSegments) { return ellipsoidVertices(innerR, innerR, outerR, outerR, avgPhi, halfPhi, quarterSegments); } -bool Acts::detail::VerticesHelper::onHyperPlane( - const std::vector& vertices, double tolerance) { +bool detail::VerticesHelper::onHyperPlane(const std::vector& vertices, + double tolerance) { // Obvious always on one surface if (vertices.size() < 4) { return true; @@ -134,3 +136,5 @@ bool Acts::detail::VerticesHelper::onHyperPlane( } return true; } + +} // namespace Acts diff --git a/Core/src/Utilities/SpacePointUtility.cpp b/Core/src/Utilities/SpacePointUtility.cpp index 6f662fe20bd..3da404653ca 100644 --- a/Core/src/Utilities/SpacePointUtility.cpp +++ b/Core/src/Utilities/SpacePointUtility.cpp @@ -82,10 +82,9 @@ SpacePointUtility::globalCoords( jacXyzToRhoZ(0, ePos1) = scale * y; jacXyzToRhoZ(1, ePos2) = 1; // compute Jacobian from local coordinates to rho/z - ActsMatrix<2, 2> jac = - jacXyzToRhoZ * rotLocalToGlobal.block<3, 2>(ePos0, ePos0); + SquareMatrix2 jac = jacXyzToRhoZ * rotLocalToGlobal.block<3, 2>(ePos0, ePos0); // compute rho/z variance - ActsVector<2> var = (jac * localCov * jac.transpose()).diagonal(); + Vector2 var = (jac * localCov * jac.transpose()).diagonal(); auto gcov = Vector2(var[0], var[1]); @@ -145,10 +144,9 @@ Vector2 SpacePointUtility::rhoZCovariance(const GeometryContext& gctx, jacXyzToRhoZ(0, ePos1) = scale * y; jacXyzToRhoZ(1, ePos2) = 1; // compute Jacobian from local coordinates to rho/z - ActsMatrix<2, 2> jac = - jacXyzToRhoZ * rotLocalToGlobal.block<3, 2>(ePos0, ePos0); + SquareMatrix2 jac = jacXyzToRhoZ * rotLocalToGlobal.block<3, 2>(ePos0, ePos0); // compute rho/z variance - ActsVector<2> var = (jac * localCov * jac.transpose()).diagonal(); + Vector2 var = (jac * localCov * jac.transpose()).diagonal(); auto gcov = Vector2(var[0], var[1]); diff --git a/Core/src/Vertexing/AdaptiveGridTrackDensity.cpp b/Core/src/Vertexing/AdaptiveGridTrackDensity.cpp index 31daae4b039..81ff9712c2e 100644 --- a/Core/src/Vertexing/AdaptiveGridTrackDensity.cpp +++ b/Core/src/Vertexing/AdaptiveGridTrackDensity.cpp @@ -181,7 +181,7 @@ AdaptiveGridTrackDensity::getMaxZTPositionAndWidth( AdaptiveGridTrackDensity::DensityMap AdaptiveGridTrackDensity::addTrack( const BoundTrackParameters& trk, DensityMap& mainDensityMap) const { - ActsVector<3> impactParams = trk.impactParameters(); + Vector3 impactParams = trk.impactParameters(); ActsSquareMatrix<3> cov = trk.impactParameterCovariance().value(); std::uint32_t spatialTrkGridSize = diff --git a/Core/src/Vertexing/AdaptiveMultiVertexFitter.cpp b/Core/src/Vertexing/AdaptiveMultiVertexFitter.cpp index 8cb6e6d8e93..589a1637cbf 100644 --- a/Core/src/Vertexing/AdaptiveMultiVertexFitter.cpp +++ b/Core/src/Vertexing/AdaptiveMultiVertexFitter.cpp @@ -44,8 +44,8 @@ Acts::Result Acts::AdaptiveMultiVertexFitter::fit( // and the linearization point of the tracks. If it is too large, // we relinearize the tracks and recalculate their 3D impact // parameters. - ActsVector<2> xyDiff = vtxInfo.oldPosition.template head<2>() - - vtxInfo.linPoint.template head<2>(); + Vector2 xyDiff = vtxInfo.oldPosition.template head<2>() - + vtxInfo.linPoint.template head<2>(); if (xyDiff.norm() > m_cfg.maxDistToLinPoint) { // Set flag for relinearization vtxInfo.relinearize = true; diff --git a/Examples/Algorithms/Fatras/include/ActsExamples/Fatras/FatrasSimulation.hpp b/Examples/Algorithms/Fatras/include/ActsExamples/Fatras/FatrasSimulation.hpp index 75395218a9e..8e3d891d3b5 100644 --- a/Examples/Algorithms/Fatras/include/ActsExamples/Fatras/FatrasSimulation.hpp +++ b/Examples/Algorithms/Fatras/include/ActsExamples/Fatras/FatrasSimulation.hpp @@ -18,7 +18,6 @@ #include "ActsExamples/Framework/ProcessCode.hpp" #include "ActsExamples/Framework/RandomNumbers.hpp" #include "ActsExamples/MagneticField/MagneticField.hpp" -#include "ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp" #include #include @@ -48,8 +47,6 @@ class FatrasSimulation final : public IAlgorithm { /// The simulated hits output collection. std::string outputSimHits; /// Parametrisation of nuclear interaction - std::string imputParametrisationNuclearInteraction = - "nuclearInteractionParameters"; /// Random number service. std::shared_ptr randomNumbers; /// The tracking geometry that should be used. diff --git a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp index aa799319e29..d6b8781170a 100644 --- a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp +++ b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp @@ -72,7 +72,7 @@ class ScalableBField final : public Acts::MagneticFieldProvider { /// @note currently the derivative is not calculated /// @todo return derivative Acts::Result getFieldGradient( - const Acts::Vector3& /*position*/, Acts::ActsMatrix<3, 3>& /*derivative*/, + const Acts::Vector3& /*position*/, Acts::SquareMatrix3& /*derivative*/, MagneticFieldProvider::Cache& gCache) const override { Cache& cache = gCache.as(); return Acts::Result::success(m_BField * cache.scalor); diff --git a/Examples/Io/Root/src/VertexNTupleWriter.cpp b/Examples/Io/Root/src/VertexNTupleWriter.cpp index 6304af1cb8d..affd046b564 100644 --- a/Examples/Io/Root/src/VertexNTupleWriter.cpp +++ b/Examples/Io/Root/src/VertexNTupleWriter.cpp @@ -836,7 +836,7 @@ ProcessCode VertexNTupleWriter::writeT( if (paramsAtVtx.has_value()) { Acts::Vector3 recoMom = paramsAtVtx->parameters().segment(Acts::eBoundPhi, 3); - const Acts::ActsMatrix<3, 3>& momCov = + const Acts::SquareMatrix3& momCov = paramsAtVtx->covariance()->template block<3, 3>(Acts::eBoundPhi, Acts::eBoundPhi); innerRecoPhi.push_back(recoMom[0]); @@ -889,7 +889,7 @@ ProcessCode VertexNTupleWriter::writeT( if (paramsAtVtxFitted.has_value()) { Acts::Vector3 recoMomFitted = paramsAtVtxFitted->parameters().segment(Acts::eBoundPhi, 3); - const Acts::ActsMatrix<3, 3>& momCovFitted = + const Acts::SquareMatrix3& momCovFitted = paramsAtVtxFitted->covariance()->block<3, 3>(Acts::eBoundPhi, Acts::eBoundPhi); innerRecoPhiFitted.push_back(recoMomFitted[0]); diff --git a/Examples/Python/src/ExampleAlgorithms.cpp b/Examples/Python/src/ExampleAlgorithms.cpp index 411973d147e..863059d78b3 100644 --- a/Examples/Python/src/ExampleAlgorithms.cpp +++ b/Examples/Python/src/ExampleAlgorithms.cpp @@ -35,11 +35,10 @@ void addExampleAlgorithms(Context& ctx) { ACTS_PYTHON_DECLARE_ALGORITHM( ActsExamples::FatrasSimulation, mex, "FatrasSimulation", inputParticles, - outputParticles, outputSimHits, imputParametrisationNuclearInteraction, - randomNumbers, trackingGeometry, magneticField, pMin, emScattering, - emEnergyLossIonisation, emEnergyLossRadiation, emPhotonConversion, - generateHitsOnSensitive, generateHitsOnMaterial, generateHitsOnPassive, - averageHitsPerParticle); + outputParticles, outputSimHits, randomNumbers, trackingGeometry, + magneticField, pMin, emScattering, emEnergyLossIonisation, + emEnergyLossRadiation, emPhotonConversion, generateHitsOnSensitive, + generateHitsOnMaterial, generateHitsOnPassive, averageHitsPerParticle); ACTS_PYTHON_DECLARE_ALGORITHM(ActsExamples::ParticlesPrinter, mex, "ParticlesPrinter", inputParticles); diff --git a/Fatras/CMakeLists.txt b/Fatras/CMakeLists.txt index 4e998b1ea17..bdb54e93a7f 100644 --- a/Fatras/CMakeLists.txt +++ b/Fatras/CMakeLists.txt @@ -10,7 +10,6 @@ add_library( src/EventData/ProcessType.cpp src/Kernel/SimulationError.cpp src/Physics/BetheHeitler.cpp - src/Physics/NuclearInteraction/NuclearInteraction.cpp src/Physics/PhotonConversion.cpp src/Physics/StandardInteractions.cpp src/Utilities/LandauDistribution.cpp diff --git a/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp b/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp deleted file mode 100644 index d0a0d84c36c..00000000000 --- a/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp +++ /dev/null @@ -1,540 +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/Definitions/Algebra.hpp" -#include "Acts/Definitions/Common.hpp" -#include "Acts/Definitions/PdgParticle.hpp" -#include "Acts/Material/MaterialSlab.hpp" -#include "Acts/Utilities/UnitVectors.hpp" -#include "Acts/Utilities/VectorHelpers.hpp" -#include "ActsFatras/EventData/Barcode.hpp" -#include "ActsFatras/EventData/Particle.hpp" -#include "ActsFatras/EventData/ProcessType.hpp" -#include "ActsFatras/Physics/NuclearInteraction/NuclearInteractionParameters.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ActsFatras { - -/// This class provides a parametrised nuclear interaction. The thereby -/// required parametrisation needs to be set and is not provided by default. -/// -/// @note This class differs between two different processes labelled as nuclear -/// interaction. Either the initial particle survives (soft) or it gets -/// destroyed (hard) by this process. -struct NuclearInteraction { - /// The storage of the parameterisation - detail::MultiParticleNuclearInteractionParametrisation - multiParticleParameterisation; - /// The number of trials to match momenta and invariant masses - //~ unsigned int nMatchingTrials = std::numeric_limits::max(); - unsigned int nMatchingTrials = 100; - unsigned int nMatchingTrialsTotal = 1000; - - /// This method evaluates the nuclear interaction length L0. - /// - /// @tparam generator_t The random number generator type - /// @param [in, out] generator The random number generator - /// @param [in] particle The ingoing particle - /// - /// @return valid X0 limit and no limit on L0 - template - std::pair generatePathLimits(generator_t& generator, - const Particle& particle) const { - // Fast exit: No parameterisation provided - if (multiParticleParameterisation.empty()) { - return {std::numeric_limits::infinity(), - std::numeric_limits::infinity()}; - } - // Find the parametrisation that corresponds to the particle type - for (const auto& particleParametrisation : multiParticleParameterisation) { - if (particleParametrisation.first == particle.pdg()) { - std::uniform_real_distribution uniformDistribution{0., 1.}; - - // Get the parameters - const detail::NuclearInteractionParametrisation& - singleParticleParametrisation = particleParametrisation.second; - const detail::NuclearInteractionParameters& parametrisation = - findParameters(uniformDistribution(generator), - singleParticleParametrisation, - particle.absoluteMomentum()); - - // Set the L0 limit if not done already - const auto& distribution = - parametrisation.nuclearInteractionProbability; - return {std::numeric_limits::infinity(), - sampleContinuousValues(uniformDistribution(generator), - distribution)}; - } - } - return {std::numeric_limits::infinity(), - std::numeric_limits::infinity()}; - } - - /// This method performs a nuclear interaction. - /// - /// @tparam generator_t The random number generator type - /// @param [in, out] generator The random number generator - /// @param [in, out] particle The ingoing particle - /// @param [out] generated Additional generated particles - /// - /// @return True if the particle was killed, false otherwise - template - bool run(generator_t& generator, Particle& particle, - std::vector& generated) const { - // Fast exit: No paramtrization provided - if (multiParticleParameterisation.empty()) { - return false; - } - - // Find the parametrisation that corresponds to the particle type - for (const auto& particleParametrisation : multiParticleParameterisation) { - if (particleParametrisation.first == particle.pdg()) { - std::uniform_real_distribution uniformDistribution{0., 1.}; - - // Get the parameters - const detail::NuclearInteractionParametrisation& - singleParticleParametrisation = particleParametrisation.second; - const detail::NuclearInteractionParameters& parametrisation = - findParameters(uniformDistribution(generator), - singleParticleParametrisation, - particle.absoluteMomentum()); - - std::normal_distribution normalDistribution{0., 1.}; - // Dice the interaction type - const bool interactSoft = - softInteraction(normalDistribution(generator), - parametrisation.softInteractionProbability); - - // Get the final state multiplicity - const unsigned int multiplicity = finalStateMultiplicity( - uniformDistribution(generator), - interactSoft ? parametrisation.softMultiplicity - : parametrisation.hardMultiplicity); - - // Get the parameters for the kinematics - const std::vector& - parametrisationOfType = - interactSoft ? parametrisation.softKinematicParameters - : parametrisation.hardKinematicParameters; - const detail::NuclearInteractionParameters:: - ParametersWithFixedMultiplicity& parametrisationOfMultiplicity = - parametrisationOfType[multiplicity]; - if (!parametrisationOfMultiplicity.validParametrisation) { - return false; - } - - // Get the kinematics - const auto kinematics = sampleKinematics( - generator, parametrisationOfMultiplicity, parametrisation.momentum); - if (!kinematics.has_value()) { - return run(generator, particle, generated); - } - - // Get the particle types - const std::vector pdgIds = - samplePdgIds(generator, parametrisation.pdgMap, multiplicity, - particle.pdg(), interactSoft); - - // Construct the particles - const auto particles = convertParametersToParticles( - generator, pdgIds, kinematics->first, kinematics->second, particle, - parametrisation.momentum, interactSoft); - - // Kill the particle in a hard process - if (!interactSoft) { - particle.setAbsoluteMomentum(0); - } - - generated.insert(generated.end(), particles.begin(), particles.end()); - return !interactSoft; - } - } - // Fast exit if no parametrisation for the particle was provided - return false; - } - - private: - /// Retrieves the parametrisation for the particle - /// - /// @param [in] rnd A random number - /// @param [in] parametrisation The storage of parametrisations - /// @param [in] particleMomentum The particles momentum - /// - /// @return The parametrisation - const detail::NuclearInteractionParameters& findParameters( - double rnd, - const detail::NuclearInteractionParametrisation& parametrisation, - float particleMomentum) const; - - /// Estimates the interaction type - /// - /// @param [in] rnd Random number - /// @param [in] probability The probability for a soft interaction - /// - /// @return True if a soft interaction occurs - inline bool softInteraction(double rnd, float probability) const { - return rnd <= probability; - } - - /// Evaluates the multiplicity of the final state - /// - /// @param [in] rnd Random number - /// @param [in] distribution The multiplicity distribution - /// - /// @return The final state multiplicity - unsigned int finalStateMultiplicity( - double rnd, - const detail::NuclearInteractionParameters::CumulativeDistribution& - distribution) const; - - /// Evaluates the final state PDG IDs - /// - /// @tparam generator_t The random number generator type - /// @param [in, out] generator The random number generator - /// @param [in] pdgMap The branching probability map - /// @param [in] multiplicity The final state multiplicity - /// @param [in] particlePdg The PDG ID of the initial particle - /// @param [in] soft Treat it as soft or hard nuclear interaction - /// - /// @return Vector containing the PDG IDs - template - std::vector samplePdgIds( - generator_t& generator, - const detail::NuclearInteractionParameters::PdgMap& pdgMap, - unsigned int multiplicity, int particlePdg, bool soft) const; - - /// Evaluates the final state invariant masses - /// - /// @tparam generator_t The random number generator type - /// @param [in, out] generator The random number generator - /// @param [in] parametrisation Parametrisation of kinematic properties - /// - /// @return Vector containing the invariant masses - template - Acts::ActsDynamicVector sampleInvariantMasses( - generator_t& generator, - const detail::NuclearInteractionParameters:: - ParametersWithFixedMultiplicity& parametrisation) const; - - /// Evaluates the final state momenta - /// - /// @tparam generator_t The random number generator type - /// @param [in, out] generator The random number generator - /// @param [in] parametrisation Parametrisation of kinematic properties - /// @param [in] initialMomentum The initial momentum - /// - /// @return Vector containing the momenta - template - Acts::ActsDynamicVector sampleMomenta( - generator_t& generator, - const detail::NuclearInteractionParameters:: - ParametersWithFixedMultiplicity& parametrisation, - float initialMomentum) const; - - /// Tests whether the final state momenta and invariant masses are - /// matching to each other to allow the evaluation of particle directions. - /// - /// @param [in] momenta The final state momenta - /// @param [in] invariantMasses The final state invariant masses - /// @param [in] parametrizedMomentum The momentum of the parametrized particle - /// - /// @return Decision whether the parameters can be matched to each other or - /// not. - bool match(const Acts::ActsDynamicVector& momenta, - const Acts::ActsDynamicVector& invariantMasses, - float parametrizedMomentum) const; - - /// This method samples the kinematics of the final state particles - /// - /// @tparam generator_t The random number generator type - /// @param [in, out] generator The random number generator - /// @param [in] parameters The parametrisation - /// @param [in] momentum The momentum of the parametrisation - /// - /// @return The final state momenta and invariant masses - template - std::optional> - sampleKinematics(generator_t& generator, - const detail::NuclearInteractionParameters:: - ParametersWithFixedMultiplicity& parameters, - float momentum) const; - - /// Converts relative angles to absolute angles wrt the global - /// coordinate system. - /// @note It is assumed that the angles of the first particle are provided in - /// the context of the global coordinate system whereas the angles of the - /// second particle are provided relatively to the first particle. - /// - /// @param [in] phi1 The azimuthal angle of the first particle - /// @param [in] theta1 The polar angle of the first particle - /// @param [in] phi2 The azimuthal angle of the second particle - /// @param [in] theta2 The polar angle of the second particle - /// - /// @return Azimuthal and polar angle of the second particle in the global - /// coordinate system - std::pair globalAngle(double phi1, double theta1, float phi2, - float theta2) const; - - /// Converter from sampled numbers to a vector of particles - /// - /// @tparam generator_t The random number generator type - /// @param [in, out] generator The random number generator - /// @param [in] pdgId The PDG IDs - /// @param [in] momenta The momenta - /// @param [in] invariantMasses The invariant masses - /// @param [in] initialParticle The initial particle - /// @param [in] parametrizedMomentum Momentum of the parametrisation - /// @param [in] soft Treat it as soft or hard nuclear interaction - /// - /// @return Vector containing the final state particles - template - std::vector convertParametersToParticles( - generator_t& generator, const std::vector& pdgId, - const Acts::ActsDynamicVector& momenta, - const Acts::ActsDynamicVector& invariantMasses, Particle& initialParticle, - float parametrizedMomentum, bool soft) const; - - /// This function performs an inverse sampling to provide a discrete - /// value from a distribution. - /// - /// @param [in] rnd A random number in [0,1] - /// @param [in] distribution The distribution to sample from - /// - /// @return The sampled value - unsigned int sampleDiscreteValues( - double rnd, - const detail::NuclearInteractionParameters::CumulativeDistribution& - distribution) const; - - /// This function performs an inverse sampling to provide a continuous - /// value from a distribition. - /// - /// @param [in] rnd A random number in [0,1] - /// @param [in] distribution The distribution to sample from - /// @param [in] interpolate Flag to steer whether an interpolation between - /// neighbouring bins should be performed instead of a bin lookup - /// - /// @return The sampled value - double sampleContinuousValues( - double rnd, - const detail::NuclearInteractionParameters::CumulativeDistribution& - distribution, - bool interpolate = false) const; -}; - -template -std::vector NuclearInteraction::samplePdgIds( - generator_t& generator, - const detail::NuclearInteractionParameters::PdgMap& pdgMap, - unsigned int multiplicity, int particlePdg, bool soft) const { - // Fast exit in case of no final state particles - if (multiplicity == 0) { - return {}; - } - - // The final state PDG IDs - std::vector pdgIds; - pdgIds.reserve(multiplicity); - - std::uniform_real_distribution uniformDistribution{0., 1.}; - - // Find the producers probability distribution - auto citProducer = pdgMap.cbegin(); - while (citProducer->first != particlePdg && citProducer != pdgMap.end()) { - citProducer++; - } - - const std::vector>& mapInitial = citProducer->second; - // Set the first particle depending on the interaction type - if (soft) { - // Store the initial particle if the interaction is soft - pdgIds.push_back(particlePdg); - } else { - // Otherwise dice the particle - const float rndInitial = uniformDistribution(generator); - - pdgIds.push_back( - std::lower_bound(mapInitial.begin(), mapInitial.end(), rndInitial, - [](const std::pair& element, - float random) { return element.second < random; }) - ->first); - } - - // Set the remaining particles - for (unsigned int i = 1; i < multiplicity; i++) { - // Find the producers probability distribution from the last produced - // particle - citProducer = pdgMap.cbegin(); - while (citProducer->first != pdgIds[i - 1] && citProducer != pdgMap.end()) { - citProducer++; - } - - // Set the next particle - const std::vector>& map = citProducer->second; - const float rnd = uniformDistribution(generator); - pdgIds.push_back( - std::lower_bound(map.begin(), map.end(), rnd, - [](const std::pair& element, - float random) { return element.second < random; }) - ->first); - } - return pdgIds; -} - -template -Acts::ActsDynamicVector NuclearInteraction::sampleInvariantMasses( - generator_t& generator, - const detail::NuclearInteractionParameters::ParametersWithFixedMultiplicity& - parametrisation) const { - // The resulting vector - Acts::ActsDynamicVector parameters; - const unsigned int size = parametrisation.eigenvaluesInvariantMass.size(); - parameters.resize(size); - - // Sample in the eigenspace - for (unsigned int i = 0; i < size; i++) { - float variance = parametrisation.eigenvaluesInvariantMass[i]; - std::normal_distribution dist{parametrisation.meanInvariantMass[i], - std::sqrt(variance)}; - parameters[i] = dist(generator); - } - // Transform to multivariate normal distribution - parameters = parametrisation.eigenvectorsInvariantMass * parameters; - - // Perform the inverse sampling from the distributions - for (unsigned int i = 0; i < size; i++) { - const double cdf = (std::erff(parameters[i]) + 1) * 0.5; - parameters[i] = sampleContinuousValues( - cdf, parametrisation.invariantMassDistributions[i]); - } - return parameters; -} - -template -Acts::ActsDynamicVector NuclearInteraction::sampleMomenta( - generator_t& generator, - const detail::NuclearInteractionParameters::ParametersWithFixedMultiplicity& - parametrisation, - float initialMomentum) const { - // The resulting vector - Acts::ActsDynamicVector parameters; - const unsigned int size = parametrisation.eigenvaluesMomentum.size(); - parameters.resize(size); - - // Sample in the eigenspace - for (unsigned int i = 0; i < size; i++) { - float variance = parametrisation.eigenvaluesMomentum[i]; - std::normal_distribution dist{parametrisation.meanMomentum[i], - std::sqrt(variance)}; - parameters[i] = dist(generator); - } - - // Transform to multivariate normal distribution - parameters = parametrisation.eigenvectorsMomentum * parameters; - - // Perform the inverse sampling from the distributions - for (unsigned int i = 0; i < size; i++) { - const float cdf = (std::erff(parameters[i]) + 1) * 0.5; - parameters[i] = - sampleContinuousValues(cdf, parametrisation.momentumDistributions[i]); - } - - // Scale the momenta - Acts::ActsDynamicVector momenta = parameters.head(size - 1); - const float sum = momenta.sum(); - const float scale = parameters.template tail<1>()(0, 0) / sum; - momenta *= scale * initialMomentum; - return momenta; -} - -template -std::optional> -NuclearInteraction::sampleKinematics( - generator_t& generator, - const detail::NuclearInteractionParameters::ParametersWithFixedMultiplicity& - parameters, - float momentum) const { - unsigned int trials = 0; - Acts::ActsDynamicVector invariantMasses = - sampleInvariantMasses(generator, parameters); - Acts::ActsDynamicVector momenta = - sampleMomenta(generator, parameters, momentum); - // Repeat momentum evaluation until the parameters match - while (!match(momenta, invariantMasses, momentum)) { - if (trials == nMatchingTrialsTotal) { - return std::nullopt; - } - // Re-sample invariant masses if no fitting momenta were found - if (trials++ % nMatchingTrials == 0) { - invariantMasses = sampleInvariantMasses(generator, parameters); - } else { - momenta = sampleMomenta(generator, parameters, momentum); - } - } - return std::pair(momenta, invariantMasses); -} - -template -std::vector NuclearInteraction::convertParametersToParticles( - generator_t& generator, const std::vector& pdgId, - const Acts::ActsDynamicVector& momenta, - const Acts::ActsDynamicVector& invariantMasses, Particle& initialParticle, - float parametrizedMomentum, bool soft) const { - std::uniform_real_distribution uniformDistribution{0., 1.}; - const auto& initialDirection = initialParticle.direction(); - const double phi = Acts::VectorHelpers::phi(initialDirection); - const double theta = Acts::VectorHelpers::theta(initialDirection); - const unsigned int size = momenta.size(); - - std::vector result; - result.reserve(size); - - // Build the particles - for (unsigned int i = 0; i < size; i++) { - const float momentum = momenta[i]; - const float invariantMass = invariantMasses[i]; - const float p1p2 = 2. * momentum * parametrizedMomentum; - const float costheta = 1. - invariantMass * invariantMass / p1p2; - - const auto phiTheta = globalAngle( - phi, theta, uniformDistribution(generator) * 2. * std::numbers::pi, - std::acos(costheta)); - const auto direction = - Acts::makeDirectionFromPhiTheta(phiTheta.first, phiTheta.second); - - Particle p = Particle(initialParticle.particleId().makeDescendant(i), - static_cast(pdgId[i])); - p.setProcess(ProcessType::eNuclearInteraction) - .setPosition4(initialParticle.fourPosition()) - .setAbsoluteMomentum(momentum) - .setDirection(direction) - .setReferenceSurface(initialParticle.referenceSurface()); - - // Store the particle - if (i == 0 && soft) { - initialParticle = p; - } else { - result.push_back(std::move(p)); - } - } - - return result; -} -} // namespace ActsFatras diff --git a/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteractionParameters.hpp b/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteractionParameters.hpp deleted file mode 100644 index 617acd5ba94..00000000000 --- a/Fatras/include/ActsFatras/Physics/NuclearInteraction/NuclearInteractionParameters.hpp +++ /dev/null @@ -1,106 +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/Definitions/Common.hpp" - -#include - -namespace ActsFatras::detail { - -/// @brief Data storage of the parametrized nuclear interaction -struct NuclearInteractionParameters { - using CumulativeDistribution = - std::pair, std::vector>; - using Distributions = std::vector; - using PdgMap = - std::vector>>>; - - /// @brief Nested struct for the storage of the kinematic parametrisations for - /// a given final state multiplicity - struct ParametersWithFixedMultiplicity { - ParametersWithFixedMultiplicity() = default; - - ParametersWithFixedMultiplicity( - Distributions& momenta, Acts::ActsDynamicVector& eValMom, - Acts::ActsDynamicVector& eVecMom, Acts::ActsDynamicVector& meanMom, - Distributions& invariantMasses, Acts::ActsDynamicVector& eValIM, - Acts::ActsDynamicVector& eVecIM, Acts::ActsDynamicVector& meanIM) - : validParametrisation(true), - momentumDistributions(momenta), - eigenvaluesMomentum(eValMom), - meanMomentum(meanMom), - invariantMassDistributions(invariantMasses), - eigenvaluesInvariantMass(eValIM), - meanInvariantMass(meanIM) { - const unsigned int sizeMom = eigenvaluesMomentum.size(); - eigenvectorsMomentum.resize(sizeMom, sizeMom); - for (unsigned int i = 0; i < sizeMom; i++) { - for (unsigned int j = 0; j < sizeMom; j++) { - eigenvectorsMomentum(i, j) = eVecMom[i * sizeMom + j]; - } - } - - const unsigned int sizeInvMass = eigenvaluesInvariantMass.size(); - eigenvectorsInvariantMass.resize(sizeInvMass, sizeInvMass); - for (unsigned int i = 0; i < sizeInvMass; i++) { - for (unsigned int j = 0; j < sizeInvMass; j++) { - eigenvectorsInvariantMass(i, j) = eVecIM[i * sizeInvMass + j]; - } - } - } - - bool validParametrisation = false; - - /// Momentum parameters - /// Generation-wise distributions - Distributions momentumDistributions; - /// Eigenvalues - Acts::ActsDynamicVector eigenvaluesMomentum; - /// Eigenvectors - Acts::ActsDynamicMatrix eigenvectorsMomentum; - /// Mean in eigenspace - Acts::ActsDynamicVector meanMomentum; - - /// Invariant mass parameters - /// Generation-wise distributions - Distributions invariantMassDistributions; - /// Eigenvalues - Acts::ActsDynamicVector eigenvaluesInvariantMass; - /// Eigenvectors - Acts::ActsDynamicMatrix eigenvectorsInvariantMass; - /// Mean in eigenspace - Acts::ActsDynamicVector meanInvariantMass; - }; - - /// Initial momentum - float momentum = 0; - /// Probability for soft nuclear interacion - float softInteractionProbability = 0; - /// PDG ID based branching probabilities - PdgMap pdgMap; - /// Probability for nuclear interaction - CumulativeDistribution nuclearInteractionProbability; - /// Multiplicity in soft interactions - CumulativeDistribution softMultiplicity; - /// Multiplicity in hard interactions - CumulativeDistribution hardMultiplicity; - /// Kinematic distributions in soft interactions - std::vector softKinematicParameters; - /// Kinematic distributions in hard interactions - std::vector hardKinematicParameters; -}; - -/// Parametrisation of a single particle -using NuclearInteractionParametrisation = - std::vector>; -/// Parametrisation of multiple particles -using MultiParticleNuclearInteractionParametrisation = - std::vector>; -} // namespace ActsFatras::detail diff --git a/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp b/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp deleted file mode 100644 index ad1e0bbb6a6..00000000000 --- a/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp +++ /dev/null @@ -1,165 +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/. - -#include "ActsFatras/Physics/NuclearInteraction/NuclearInteraction.hpp" - -#include -#include -#include -#include -#include -#include - -namespace ActsFatras { - -const detail::NuclearInteractionParameters& NuclearInteraction::findParameters( - double rnd, - const detail::NuclearInteractionParametrisation& parametrisation, - float particleMomentum) const { - // Return lowest/highest if momentum outside the boundary - if (particleMomentum <= parametrisation.front().first) { - return parametrisation.front().second; - } - if (particleMomentum >= parametrisation.back().first) { - return parametrisation.back().second; - } - - // Find the two neighbouring parametrisations - const auto lowerBound = std::lower_bound( - parametrisation.begin(), parametrisation.end(), particleMomentum, - [](const std::pair& - params, - const float mom) { return params.first < mom; }); - const float momentumUpperNeighbour = lowerBound->first; - const float momentumLowerNeighbour = std::prev(lowerBound, 1)->first; - - // Pick one randomly - const float weight = (momentumUpperNeighbour - particleMomentum) / - (momentumUpperNeighbour - momentumLowerNeighbour); - return (rnd < weight) ? std::prev(lowerBound, 1)->second : lowerBound->second; -} // namespace ActsFatras - -unsigned int NuclearInteraction::sampleDiscreteValues( - double rnd, - const detail::NuclearInteractionParameters::CumulativeDistribution& - distribution) const { - // Fast exit - if (distribution.second.empty()) { - return 0; - } - - // Find the bin - const std::uint32_t int_rnd = static_cast( - std::numeric_limits::max() * rnd); - const auto it = std::upper_bound(distribution.second.begin(), - distribution.second.end(), int_rnd); - std::size_t iBin = std::min( - static_cast(std::distance(distribution.second.begin(), it)), - distribution.second.size() - 1); - - // Return the corresponding bin - return static_cast(distribution.first[iBin]); -} - -double NuclearInteraction::sampleContinuousValues( - double rnd, - const detail::NuclearInteractionParameters::CumulativeDistribution& - distribution, - bool interpolate) const { - // Fast exit - if (distribution.second.empty()) { - return std::numeric_limits::infinity(); - } - - // Find the bin - const std::uint32_t int_rnd = static_cast( - std::numeric_limits::max() * rnd); - // Fast exit for non-normalised CDFs like interaction probability - if (int_rnd > distribution.second.back()) { - return std::numeric_limits::infinity(); - } - const auto it = std::upper_bound(distribution.second.begin(), - distribution.second.end(), int_rnd); - std::size_t iBin = std::min( - static_cast(std::distance(distribution.second.begin(), it)), - distribution.second.size() - 1); - - if (interpolate) { - // Interpolate between neighbouring bins and return a diced intermediate - // value - const std::uint32_t basecont = - (iBin > 0 ? distribution.second[iBin - 1] : 0); - const std::uint32_t dcont = distribution.second[iBin] - basecont; - return distribution.first[iBin] + - (distribution.first[iBin + 1] - distribution.first[iBin]) * - (dcont > 0 ? (int_rnd - basecont) / dcont : 0.5); - } else { - return distribution.first[iBin]; - } -} - -unsigned int NuclearInteraction::finalStateMultiplicity( - double rnd, - const detail::NuclearInteractionParameters::CumulativeDistribution& - distribution) const { - return sampleDiscreteValues(rnd, distribution); -} - -std::pair NuclearInteraction::globalAngle(double phi1, - double theta1, - float phi2, - float theta2) const { - // Rotation around the global y-axis - Acts::SquareMatrix3 rotY = Acts::SquareMatrix3::Zero(); - rotY(0, 0) = std::cos(theta1); - rotY(0, 2) = std::sin(theta1); - rotY(1, 1) = 1.; - rotY(2, 0) = -std::sin(theta1); - rotY(2, 2) = std::cos(theta1); - - // Rotation around the global z-axis - Acts::SquareMatrix3 rotZ = Acts::SquareMatrix3::Zero(); - rotZ(0, 0) = std::cos(phi1); - rotZ(0, 1) = -std::sin(phi1); - rotZ(1, 0) = std::sin(phi1); - rotZ(1, 1) = std::cos(phi1); - rotZ(2, 2) = 1.; - - // Rotate the direction vector of the second particle - const Acts::Vector3 vector2(std::sin(theta2) * std::cos(phi2), - std::sin(theta2) * std::sin(phi2), - std::cos(theta2)); - const Acts::Vector3 vectorSum = rotZ * rotY * vector2; - - // Calculate the global angles - const float theta = std::acos(vectorSum.z() / vectorSum.norm()); - const float phi = std::atan2(vectorSum.y(), vectorSum.x()); - - return {phi, theta}; -} - -bool NuclearInteraction::match(const Acts::ActsDynamicVector& momenta, - const Acts::ActsDynamicVector& invariantMasses, - float parametrizedMomentum) const { - const unsigned int size = momenta.size(); - for (unsigned int i = 0; i < size; i++) { - // Calculate the invariant masses - const float momentum = momenta[i]; - const float invariantMass = invariantMasses[i]; - const float p1p2 = 2. * momentum * parametrizedMomentum; - const float costheta = 1. - invariantMass * invariantMass / p1p2; - - // Abort if an angle cannot be calculated - if (std::abs(costheta) > 1) { - return false; - } - } - return true; -} -} // namespace ActsFatras diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp index 6f7b8077348..38cca4855bc 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp @@ -31,7 +31,7 @@ class DD4hepFieldAdapter : public Acts::MagneticFieldProvider { MagneticFieldProvider::Cache& cache) const override; Result getFieldGradient( - const Vector3& position, ActsMatrix<3, 3>& derivative, + const Vector3& position, SquareMatrix3& derivative, MagneticFieldProvider::Cache& cache) const override; private: diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepVolumeBuilder.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepVolumeBuilder.hpp index c57515b4bc4..2f1d1aa9c4d 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepVolumeBuilder.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepVolumeBuilder.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/IConfinedTrackingVolumeBuilder.hpp" #include "Acts/Geometry/TrackingVolume.hpp" diff --git a/Plugins/DD4hep/src/DD4hepFieldAdapter.cpp b/Plugins/DD4hep/src/DD4hepFieldAdapter.cpp index ad8ce3c2bda..236a0dfdd27 100644 --- a/Plugins/DD4hep/src/DD4hepFieldAdapter.cpp +++ b/Plugins/DD4hep/src/DD4hepFieldAdapter.cpp @@ -51,7 +51,7 @@ Result DD4hepFieldAdapter::getField( } Result DD4hepFieldAdapter::getFieldGradient( - const Vector3& /*position*/, ActsMatrix<3, 3>& /*derivative*/, + const Vector3& /*position*/, SquareMatrix3& /*derivative*/, MagneticFieldProvider::Cache& /*cache*/) const { return Result::failure(MagneticFieldError::NotImplemented); } diff --git a/Plugins/Json/src/SurfaceJsonConverter.cpp b/Plugins/Json/src/SurfaceJsonConverter.cpp index 0df6dc8b08b..fb6b0e7b08d 100644 --- a/Plugins/Json/src/SurfaceJsonConverter.cpp +++ b/Plugins/Json/src/SurfaceJsonConverter.cpp @@ -28,8 +28,7 @@ #include "Acts/Surfaces/StrawSurface.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" - -#include +#include "Acts/Utilities/ThrowAssert.hpp" void Acts::to_json(nlohmann::json& j, const Acts::SurfaceAndMaterialWithContext& surface) { diff --git a/Plugins/Legacy/include/Acts/Seeding/AtlasSeedFinder.hpp b/Plugins/Legacy/include/Acts/Seeding/AtlasSeedFinder.hpp index b7e060a1f80..96295086c31 100644 --- a/Plugins/Legacy/include/Acts/Seeding/AtlasSeedFinder.hpp +++ b/Plugins/Legacy/include/Acts/Seeding/AtlasSeedFinder.hpp @@ -11,6 +11,7 @@ /////////////////////////////////////////////////////////////////// #pragma once + #include "Acts/Seeding/LegacyInternalSeed.hpp" #include "Acts/Seeding/SPForSeed.hpp" diff --git a/Plugins/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp b/Plugins/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp index 9c6be79a4d6..e3882572a69 100644 --- a/Plugins/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp +++ b/Plugins/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp @@ -11,6 +11,7 @@ /////////////////////////////////////////////////////////////////// #pragma once + #include "Acts/Seeding/LegacySeed.hpp" #include "Acts/Seeding/SPForSeed.hpp" diff --git a/Plugins/Legacy/include/Acts/Seeding/LegacySeed.hpp b/Plugins/Legacy/include/Acts/Seeding/LegacySeed.hpp index f4f0e3bab68..93efa3ca2e8 100644 --- a/Plugins/Legacy/include/Acts/Seeding/LegacySeed.hpp +++ b/Plugins/Legacy/include/Acts/Seeding/LegacySeed.hpp @@ -11,6 +11,7 @@ /////////////////////////////////////////////////////////////////// #pragma once + #include namespace Acts::Legacy { diff --git a/Plugins/Legacy/include/Acts/Seeding/SPForSeed.hpp b/Plugins/Legacy/include/Acts/Seeding/SPForSeed.hpp index 2bc823d5925..955219011e7 100644 --- a/Plugins/Legacy/include/Acts/Seeding/SPForSeed.hpp +++ b/Plugins/Legacy/include/Acts/Seeding/SPForSeed.hpp @@ -11,6 +11,7 @@ /////////////////////////////////////////////////////////////////// #pragma once + #include // COLLECTION OF MAGIC NUMBERS IN HERE: diff --git a/Plugins/Onnx/include/Acts/Plugins/Onnx/OnnxRuntimeBase.hpp b/Plugins/Onnx/include/Acts/Plugins/Onnx/OnnxRuntimeBase.hpp index 0418a7cd5ac..86476121187 100644 --- a/Plugins/Onnx/include/Acts/Plugins/Onnx/OnnxRuntimeBase.hpp +++ b/Plugins/Onnx/include/Acts/Plugins/Onnx/OnnxRuntimeBase.hpp @@ -7,6 +7,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once + #include #include diff --git a/Tests/Benchmarks/AnnulusBoundsBenchmark.cpp b/Tests/Benchmarks/AnnulusBoundsBenchmark.cpp index fcfddd42adb..4d89df9bb41 100644 --- a/Tests/Benchmarks/AnnulusBoundsBenchmark.cpp +++ b/Tests/Benchmarks/AnnulusBoundsBenchmark.cpp @@ -52,7 +52,7 @@ int main(int /*argc*/, char** /*argv[]*/) { auto random_point = [&]() -> Vector2 { return {xDist(rng), yDist(rng)}; }; // for covariance based check, set up one; - ActsMatrix<2, 2> cov; + SquareMatrix2 cov; cov << 1.0, 0, 0, 0.05; BoundaryTolerance bcAbs = BoundaryTolerance::None(); diff --git a/Tests/UnitTests/Core/Geometry/VolumeTests.cpp b/Tests/UnitTests/Core/Geometry/VolumeTests.cpp index 599870f1a12..8c10abc18c2 100644 --- a/Tests/UnitTests/Core/Geometry/VolumeTests.cpp +++ b/Tests/UnitTests/Core/Geometry/VolumeTests.cpp @@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(VolumeTest) { Vector3 translation{1_mm, 2_mm, 3_mm}; // Build a translation - ActsMatrix<3, 3> rotation = RotationMatrix3::Identity(); + SquareMatrix3 rotation = RotationMatrix3::Identity(); double rotationAngle = 60_degree; Vector3 xPos(cos(rotationAngle), 0., sin(rotationAngle)); Vector3 yPos(0., 1., 0.); diff --git a/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp b/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp index 9e246b6c326..ec06fba2493 100644 --- a/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp +++ b/Tests/UnitTests/Core/MagneticField/InterpolatedBFieldMapTests.cpp @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(InterpolatedBFieldMap_rz) { CHECK_CLOSE_REL(c.getField(transformPos(pos)), BField::value({{perp(pos), pos.z()}}), 1e-6); - ActsMatrix<3, 3> deriv; + SquareMatrix3 deriv; pos << 1, 1, -5.5; // this position is outside the grid BOOST_CHECK(!b.isInside(pos)); diff --git a/Tests/UnitTests/Core/Propagator/BoundToCurvilinearConversionTests.cpp b/Tests/UnitTests/Core/Propagator/BoundToCurvilinearConversionTests.cpp index e44e0014fcd..435f4d45bdb 100644 --- a/Tests/UnitTests/Core/Propagator/BoundToCurvilinearConversionTests.cpp +++ b/Tests/UnitTests/Core/Propagator/BoundToCurvilinearConversionTests.cpp @@ -137,7 +137,7 @@ T_Matrix matrixRatio(const T_Matrix &a, const T_Matrix &b) { struct TestData { enum ESurfaceType { kPlane, kPolarDisk, kCylinder }; - TestData(Vector3 &&a_surface_center, ActsMatrix<3, 3> &&a_surface_rot, + TestData(Vector3 &&a_surface_center, SquareMatrix3 &&a_surface_rot, ESurfaceType a_surface_type, BoundVector &&a_param_vec, BoundSquareMatrix &&a_param_cov, Vector3 &&a_bfield) : surface_center(std::move(a_surface_center)), @@ -148,7 +148,7 @@ struct TestData { bfield(std::move(a_bfield)) {} Vector3 surface_center; - ActsMatrix<3, 3> surface_rot; + SquareMatrix3 surface_rot; ESurfaceType surface_type; BoundVector param_vec; BoundSquareMatrix param_cov; @@ -169,7 +169,7 @@ void test_bound_to_curvilinear(const std::vector &test_data_list, // create bound parameters from test data const Vector3 &surface_center = test_data.surface_center; - const ActsMatrix<3, 3> &surface_rot = test_data.surface_rot; + const SquareMatrix3 &surface_rot = test_data.surface_rot; const BoundVector ¶m_vec = test_data.param_vec; const BoundSquareMatrix &cov = test_data.param_cov; diff --git a/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp index f2a060167c7..10cfb500a50 100644 --- a/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/AnnulusBoundsTests.cpp @@ -141,6 +141,137 @@ BOOST_AUTO_TEST_CASE(AnnulusBoundsVertices) { BOOST_CHECK_EQUAL(vertices.size(), 14u); } +BOOST_AUTO_TEST_CASE(AnnulusBoundsNegativeTolerance) { + AnnulusBounds aBounds(minRadius, maxRadius, minPhi, maxPhi, offset); + double phiAverage = (minPhi + maxPhi) / 2; + + auto check = [&](const BoundaryTolerance& tolerance, const Vector2& point) { + Vector2 pointAverage(point[0], phiAverage + point[1]); + return aBounds.inside(pointAverage, tolerance); + }; + + double midRadius = (minRadius + maxRadius) / 2; + double hlPhi = (maxPhi - minPhi) / 2; + + { + auto tolerance = BoundaryTolerance::AbsoluteEuclidean(1); + + // Test points near radial boundaries + BOOST_CHECK(!check(tolerance, {minRadius - 1.5, 0})); + BOOST_CHECK(check(tolerance, {minRadius - 0.1, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 0.4, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 0.5, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 1.5, 0})); + + BOOST_CHECK(check(tolerance, {maxRadius - 1.5, 0})); + BOOST_CHECK(check(tolerance, {maxRadius - 0.1, 0})); + BOOST_CHECK(check(tolerance, {maxRadius + 0.3, 0})); + BOOST_CHECK(check(tolerance, {maxRadius + 0.55, 0})); + BOOST_CHECK(check(tolerance, {maxRadius + 1.2, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 1.7, 0})); + + // Check points near axial boundaries + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 1.5})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 1.1})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 0.8})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 0.5})); + + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 0.5})); + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 0.8})); + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 1.1})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 1.5})); + } + + { + auto tolerance = BoundaryTolerance::AbsoluteEuclidean(-1); + + // Test points near radial boundaries + BOOST_CHECK(!check(tolerance, {minRadius - 1.5, 0})); + BOOST_CHECK(!check(tolerance, {minRadius - 0.1, 0})); + BOOST_CHECK(!check(tolerance, {minRadius + 0.4, 0})); + BOOST_CHECK(!check(tolerance, {minRadius + 0.5, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 1.5, 0})); + + BOOST_CHECK(check(tolerance, {maxRadius - 1.5, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius - 0.1, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 0.3, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 0.55, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 1.2, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 1.7, 0})); + + // Check points near axial boundaries + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 1.5})); + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 1.1})); + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 0.8})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 0.5})); + + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 0.5})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 0.8})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 1.1})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 1.5})); + } + + { + auto tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 0.1); + + // Test points near radial boundaries + BOOST_CHECK(!check(tolerance, {minRadius - 1.5, 0})); + BOOST_CHECK(check(tolerance, {minRadius - 0.1, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 0.4, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 0.5, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 1.5, 0})); + + BOOST_CHECK(check(tolerance, {maxRadius - 1.5, 0})); + BOOST_CHECK(check(tolerance, {maxRadius - 0.1, 0})); + BOOST_CHECK(check(tolerance, {maxRadius + 0.3, 0})); + BOOST_CHECK(check(tolerance, {maxRadius + 0.55, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 1.2, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 1.7, 0})); + + // Check points near axial boundaries + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 1.5})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 1.1})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 0.8})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 0.5})); + + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 0.5})); + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 0.8})); + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 1.1})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 1.5})); + } + + { + auto tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), -0.1); + + // Test points near radial boundaries + BOOST_CHECK(!check(tolerance, {minRadius - 1.5, 0})); + BOOST_CHECK(!check(tolerance, {minRadius - 0.1, 0})); + BOOST_CHECK(!check(tolerance, {minRadius + 0.4, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 0.5, 0})); + BOOST_CHECK(check(tolerance, {minRadius + 1.5, 0})); + + BOOST_CHECK(check(tolerance, {maxRadius - 1.5, 0})); + BOOST_CHECK(check(tolerance, {maxRadius - 0.1, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 0.3, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 0.55, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 1.2, 0})); + BOOST_CHECK(!check(tolerance, {maxRadius + 1.7, 0})); + + // Check points near axial boundaries + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 1.5})); + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 1.1})); + BOOST_CHECK(!check(tolerance, {midRadius, -hlPhi * 0.8})); + BOOST_CHECK(check(tolerance, {midRadius, -hlPhi * 0.5})); + + BOOST_CHECK(check(tolerance, {midRadius, hlPhi * 0.5})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 0.8})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 1.1})); + BOOST_CHECK(!check(tolerance, {midRadius, hlPhi * 1.5})); + } +} + BOOST_AUTO_TEST_SUITE_END() } // namespace Acts::Test diff --git a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp index edc401e9b83..e80035a10a8 100644 --- a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp @@ -13,17 +13,100 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" +#include "Acts/Utilities/Helpers.hpp" #include #include +#include #include #include +#include #include namespace Acts::Test { BOOST_AUTO_TEST_SUITE(Surfaces) +BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { + using enum BoundaryTolerance::ToleranceMode; + { + // Test None constructor + BoundaryTolerance tolerance = BoundaryTolerance::None(); + BOOST_CHECK(tolerance.toleranceMode() == None); + } + + // Test AbsoluteBound constructor + { + // Valid positive tolerances + 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); + + // Negative tolerances should throw + BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteBound(-1.0, 2.0), + std::invalid_argument); + BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteBound(1.0, -2.0), + std::invalid_argument); + } + + // Test AbsoluteEuclidean constructor + { + // 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); + + // Valid negative tolerance + tolerance = BoundaryTolerance::AbsoluteEuclidean(-1.0); + BOOST_CHECK_EQUAL(tolerance.tolerance, -1.0); + BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Shrink); + } + + // Test AbsoluteCartesian constructor + { + // Valid positive tolerance + 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{BoundaryTolerance::AbsoluteCartesian(0.0, 0.0)} + .toleranceMode() == None); + + // Negative tolerances should throw + BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteCartesian(-1.0, 2.0), + std::invalid_argument); + BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteCartesian(1.0, -2.0), + std::invalid_argument); + } + + // Test Chi2Bound constructor + { + SquareMatrix2 cov; + cov << 1, 0.5, 0.5, 2; + + // 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); + + // Valid negative chi2 bound + tolerance = BoundaryTolerance::Chi2Bound(cov, -3.0); + BOOST_CHECK_EQUAL(tolerance.maxChi2, -3.0); + BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Shrink); + } + + // Test None constructor + BoundaryTolerance::None(); +} + // See: https://en.wikipedia.org/wiki/Bounding_volume // // Aligned box w/ simple check @@ -203,6 +286,104 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckDifferentTolerances) { } } +BOOST_AUTO_TEST_CASE(BoundaryCheckNegativeToleranceRect) { + // Test points for boundary check with euclidean tolerance + Vector2 ll(1, 1); + Vector2 ur(3, 3); + + auto check = [&ll, &ur](const BoundaryTolerance& tolerance, + const Vector2& point) { + return detail::insideAlignedBox(ll, ur, tolerance, point, std::nullopt); + }; + + { + auto tolerance = BoundaryTolerance::AbsoluteEuclidean(-0.25); + + BOOST_CHECK(!check(tolerance, {2.8, 2})); + BOOST_CHECK(!check(tolerance, {3.1, 2})); + BOOST_CHECK(check(tolerance, {2.7, 2})); + BOOST_CHECK(!check(tolerance, {2, 3.1})); + BOOST_CHECK(!check(tolerance, {2, 2.8})); + BOOST_CHECK(check(tolerance, {2, 2.7})); + + BOOST_CHECK(!check(tolerance, {0.8, 2})); + BOOST_CHECK(!check(tolerance, {1.2, 2})); + BOOST_CHECK(check(tolerance, {1.5, 2})); + BOOST_CHECK(!check(tolerance, {2, 0.8})); + BOOST_CHECK(!check(tolerance, {2, 1.2})); + BOOST_CHECK(check(tolerance, {2, 1.5})); + } + + { + auto tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), -0.1); + + BOOST_CHECK(!check(tolerance, {2.8, 2})); + BOOST_CHECK(!check(tolerance, {3.1, 2})); + BOOST_CHECK(check(tolerance, {2.5, 2})); + BOOST_CHECK(!check(tolerance, {2, 3.1})); + BOOST_CHECK(!check(tolerance, {2, 2.8})); + BOOST_CHECK(check(tolerance, {2, 2.5})); + + BOOST_CHECK(!check(tolerance, {0.8, 2})); + BOOST_CHECK(!check(tolerance, {1.4, 2})); + BOOST_CHECK(check(tolerance, {1.5, 2})); + BOOST_CHECK(!check(tolerance, {2, 0.8})); + BOOST_CHECK(!check(tolerance, {2, 1.4})); + BOOST_CHECK(check(tolerance, {2, 1.5})); + } +} + +BOOST_AUTO_TEST_CASE(BoundaryCheckNegativeToleranceTrap) { + Vector2 vertices[] = {{1.5, 1}, {2.5, 1}, {3, 3}, {1, 3}}; + + auto check = [&vertices](const BoundaryTolerance& tolerance, + const Vector2& point) { + return detail::insidePolygon(vertices, tolerance, point, std::nullopt); + }; + + { + auto tolerance = BoundaryTolerance::AbsoluteEuclidean(0.25); + // Axes + BOOST_CHECK(!check(tolerance, {3.1, 2})); + BOOST_CHECK(check(tolerance, {2.75, 2})); + BOOST_CHECK(check(tolerance, {2.5, 2})); + BOOST_CHECK(check(tolerance, {2.25, 2})); + BOOST_CHECK(check(tolerance, {2, 3.1})); + BOOST_CHECK(check(tolerance, {2, 2.75})); + BOOST_CHECK(check(tolerance, {2, 2.5})); + BOOST_CHECK(check(tolerance, {2, 2.25})); + BOOST_CHECK(check(tolerance, {2, 2})); + + // Corners + BOOST_CHECK(check(tolerance, {3.1, 3.2})); + BOOST_CHECK(check(tolerance, {0.9, 3.2})); + BOOST_CHECK(check(tolerance, {1.5, 0.8})); + BOOST_CHECK(check(tolerance, {2.5, 0.8})); + } + + { + auto tolerance = BoundaryTolerance::AbsoluteEuclidean(-0.25); + // Axes + BOOST_CHECK(!check(tolerance, {3.0, 2})); + BOOST_CHECK(!check(tolerance, {2.5, 2})); + BOOST_CHECK(check(tolerance, {2.25, 2})); + BOOST_CHECK(!check(tolerance, {2, 3.1})); + BOOST_CHECK(!check(tolerance, {2, 2.9})); + BOOST_CHECK(check(tolerance, {2, 2.7})); + + // Corners + BOOST_CHECK(!check(tolerance, {2.7, 2.9})); + BOOST_CHECK(check(tolerance, {2.4, 2.6})); + BOOST_CHECK(!check(tolerance, {1.3, 2.9})); + BOOST_CHECK(check(tolerance, {1.6, 2.6})); + BOOST_CHECK(!check(tolerance, {2.4, 1.1})); + BOOST_CHECK(check(tolerance, {1.75, 1.4})); + BOOST_CHECK(!check(tolerance, {1.6, 1.1})); + BOOST_CHECK(check(tolerance, {2.25, 1.4})); + } +} + BOOST_AUTO_TEST_SUITE_END() } // namespace Acts::Test diff --git a/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp b/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp new file mode 100644 index 00000000000..56bec3caaa8 --- /dev/null +++ b/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp @@ -0,0 +1,3184 @@ +// 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/. + +#include +#include +#include + +#include "Acts/Geometry/GeometryContext.hpp" +#include "Acts/Surfaces/AnnulusBounds.hpp" +#include "Acts/Surfaces/DiscSurface.hpp" +#include "Acts/Surfaces/PlanarBounds.hpp" +#include "Acts/Surfaces/PlaneSurface.hpp" +#include "Acts/Surfaces/RectangleBounds.hpp" +#include "Acts/Surfaces/RegularSurface.hpp" +#include "Acts/Surfaces/TrapezoidBounds.hpp" + +#include +#include + +namespace Acts::Test { + +GeometryContext gctx; + +std::size_t matrixResolution = 80; + +struct TestMatrix : public std::vector> { + TestMatrix() + : std::vector>( + matrixResolution, std::vector(matrixResolution, 0)) { + }; +}; + +std::pair boundingBox(const RegularSurface& surface, + double relMargin) { + Vector2 min{std::numeric_limits::max(), + std::numeric_limits::max()}; + Vector2 max{std::numeric_limits::lowest(), + std::numeric_limits::lowest()}; + + std::vector vertices; + if (const auto* pBounds = + dynamic_cast(&surface.bounds()); + pBounds) { + vertices = pBounds->vertices(); + } else if (const auto* dBounds = + dynamic_cast(&surface.bounds()); + dBounds) { + vertices = dBounds->vertices(); + } else { + throw std::runtime_error("Unsupported bounds type"); + } + + for (const auto& vertex : vertices) { + min = min.cwiseMin(vertex); + max = max.cwiseMax(vertex); + } + + Vector2 size = max - min; + + min = min - relMargin * size; + max = max + relMargin * size; + + Vector3 min3 = surface.transform(gctx) * Vector3{min[0], min[1], 0}; + Vector3 max3 = surface.transform(gctx) * Vector3{max[0], max[1], 0}; + + return {min3.head<2>(), max3.head<2>()}; +} + +TestMatrix makeTestMatrix(const RegularSurface& surface, + const BoundaryTolerance& tolerance, + double relMargin = 0.1) { + auto [min, max] = boundingBox(surface, relMargin); + Vector2 delta = max - min; + + TestMatrix testMatrix; + + Vector2 step = delta / (matrixResolution - 1); + + for (std::size_t i = 0; i < matrixResolution; ++i) { + for (std::size_t j = 0; j < matrixResolution; ++j) { + Vector2 query = min + Vector2(j, i).cwiseProduct(step); + Vector2 local = + surface.globalToLocal(gctx, Vector3{query[0], query[1], 0}).value(); + bool inside = surface.bounds().inside(local, tolerance); + testMatrix.at(i).at(j) = inside ? 1 : 0; + } + } + + return testMatrix; +} + +void printTestMatrix(const TestMatrix& matrix) { + for (const auto& row : matrix) { + for (std::uint8_t inside : row) { + std::cout << (inside == 1 ? "X" : "."); + } + std::cout << std::endl; + } +} + +TestMatrix parseMatrix(const std::string& matrix) { + TestMatrix result; + + std::size_t i = 0; + std::size_t j = 0; + + for (auto it = matrix.find_first_not_of("\n "); it < matrix.size(); it++) { + const char c = matrix.at(it); + if (c == ' ') { + continue; + } + if (c == '\n') { + i += 1; + j = 0; + continue; + } + if (c == '.') { + result.at(i).at(j) = 0; + } else { + result.at(i).at(j) = 1; + } + j += 1; + } + + return result; +} + +void printMatrixDiff(const TestMatrix& ref, const TestMatrix& act) { + static const std::string s_ref = "-"; + static const std::string s_act = "+"; + static const std::string s_in = "X"; + static const std::string s_out = "."; + + bool tty = isatty(fileno(stdout)) != 0; + + // Print special output in case the reference is empty so we can easily update + // the reference. + bool refEmpty = std::ranges::all_of(ref, [](const auto& row) { + return std::ranges::all_of(row, [](const auto& v) { return v == 0; }); + }); + + auto red = [tty](const std::string& s) { + if (!tty) { + return s; + } + return "\033[1;31m" + s + "\033[0m"; + }; + + auto green = [tty](const std::string& s) { + if (!tty) { + return s; + } + return "\033[1;32m" + s + "\033[0m"; + }; + + for (std::size_t i = 0; i <= matrixResolution - 1; ++i) { + for (std::size_t j = 0; j <= matrixResolution - 1; ++j) { + bool insideRef = ref.at(i).at(j) == 1; + bool insideAct = act.at(i).at(j) == 1; + + if (refEmpty) { + std::cout << (insideAct ? s_in : s_out); + continue; + } + + if (!insideRef && !insideAct) { + std::cout << s_out; + } + if (insideRef && !insideAct) { + std::cout << red(s_ref); + } + if (!insideRef && insideAct) { + std::cout << green(s_act); + } + if (insideRef && insideAct) { + std::cout << s_in; + } + } + std::cout << std::endl; + } + + if (!refEmpty) { + std::cout << red(s_ref + ": inside reference but not inside actual") + << std::endl; + std::cout << green(s_act + ": not inside reference but inside actual") + << std::endl; + std::cout << s_in + ": inside both" << std::endl; + std::cout << s_out + ": outside both" << std::endl; + } else { + std::cout << red("REFERENCE IS EMPTY") << std::endl; + std::cout << s_in + ": inside actual" << std::endl; + std::cout << s_out + ": outside actual" << std::endl; + } +} + +boost::test_tools::predicate_result checkMatrices(const TestMatrix& val, + const TestMatrix& ref) { + if (val == ref) { + return true; + } + printMatrixDiff(ref, val); + boost::test_tools::predicate_result res(false); + res.message() << "Actual test matrix differs from reference"; + return res; +} + +BOOST_AUTO_TEST_SUITE(Surfaces) + +BOOST_AUTO_TEST_CASE(Rectangle) { + auto bounds = std::make_shared(10, 20); + auto surface = + Surface::makeShared(Transform3::Identity(), bounds); + + BOOST_TEST_CONTEXT("None") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::None(); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteEuclidean(2)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(2); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.2), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteEuclidean(-2)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(-2); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("Chi2Bound(eye, 0.1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.5), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("Chi2Bound(eye, -0.1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), -0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteBound(0.8, 0.05)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0.8, 0.05); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.2), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteBound(1, 0)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteCartesian(1, 1.2); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 0.01)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteCartesian(1, 0.01); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(0.01, 1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteCartesian(0.01, 1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(0, 0)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::AbsoluteCartesian(0.0, 0.0); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } +} + +BOOST_AUTO_TEST_CASE(Trapezoid) { + auto bounds = std::make_shared(10, 20, 5, 0.1); + auto surface = + Surface::makeShared(Transform3::Identity(), bounds); + + BOOST_TEST_CONTEXT("None") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.....................................................XX......................... +..................................................XXXXX......................... +...............................................XXXXXXXXX........................ +............................................XXXXXXXXXXXX........................ +........................................XXXXXXXXXXXXXXXXX....................... +.....................................XXXXXXXXXXXXXXXXXXXX....................... +..................................XXXXXXXXXXXXXXXXXXXXXXX....................... +...............................XXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +.........XXXXXXXXXXXXXXXXXXXXXXXXX.............................................. +.........XXXXXXXXXXXXXXXXXXXXXX................................................. +.........XXXXXXXXXXXXXXXXXXX.................................................... +.........XXXXXXXXXXXXXXXX....................................................... +........XXXXXXXXXXXXX........................................................... +........XXXXXXXXXX.............................................................. +........XXXXXXX................................................................. +.......XXXXX.................................................................... +.......X........................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + BoundaryTolerance tolerance = BoundaryTolerance::None(); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteEuclidean(2)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +...................................................XXX.......................... +................................................XXXXXX.......................... +.............................................XXXXXXXXXX......................... +.........................................XXXXXXXXXXXXXX......................... +......................................XXXXXXXXXXXXXXXXX......................... +...................................XXXXXXXXXXXXXXXXXXXXX........................ +................................XXXXXXXXXXXXXXXXXXXXXXXX........................ +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXX............................................ +.........XXXXXXXXXXXXXXXXXXXXXXXX............................................... +.........XXXXXXXXXXXXXXXXXXXXX.................................................. +.........XXXXXXXXXXXXXXXXX...................................................... +..........XXXXXXXXXXXXX......................................................... +..........XXXXXXXXXX............................................................ +..........XXXXXXX............................................................... +...........XX................................................................... +................................................................................ +................................................................................ +................................................................................ + )X"; + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(2); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.2), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteEuclidean(-2)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +...................................................XXX.......................... +................................................XXXXXXX......................... +............................................XXXXXXXXXXX......................... +.........................................XXXXXXXXXXXXXX......................... +......................................XXXXXXXXXXXXXXXXXX........................ +...................................XXXXXXXXXXXXXXXXXXXXX........................ +...............................XXXXXXXXXXXXXXXXXXXXXXXXXX....................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +.................XXXXXXXXXXXXXXXXXXXXXXX........................................ +.................XXXXXXXXXXXXXXXXXXXX........................................... +................XXXXXXXXXXXXXXXXXX.............................................. +................XXXXXXXXXXXXXX.................................................. +................XXXXXXXXXXX..................................................... +...............XXXXXXXXX........................................................ +...............XXXXXX........................................................... +...............XX............................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(-2); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("Chi2Bound(eye, 0.1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +...............................................XX............................... +............................................XXXXXX.............................. +........................................XXXXXXXXXX.............................. +.....................................XXXXXXXXXXXXX.............................. +..................................XXXXXXXXXXXXXXXXX............................. +...............................XXXXXXXXXXXXXXXXXXXX............................. +.............................XXXXXXXXXXXXXXXXXXXXXXX............................ +.............................XXXXXXXXXXXXXXXXXXXXXXX............................ +............................XXXXXXXXXXXXXXXXXXXXXXXX............................ +............................XXXXXXXXXXXXXXXXXXXXXXXXX........................... +............................XXXXXXXXXXXXXXXXXXXXXXXXX........................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +......................XXXXXXXXXXXXXXXXXXXXXXXXXX................................ +.....................XXXXXXXXXXXXXXXXXXXXXXXX................................... +.....................XXXXXXXXXXXXXXXXXXXXX...................................... +.....................XXXXXXXXXXXXXXXXX.......................................... +.....................XXXXXXXXXXXXXX............................................. +....................XXXXXXXXXXXX................................................ +....................XXXXXXXXX................................................... +....................XXXXXX...................................................... +....................XX.......................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.5), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("Chi2Bound(eye, -0.1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +......................................................X......................... +...................................................XXXX......................... +................................................XXXXXXX......................... +.............................................XXXXXXXXXXX........................ +.........................................XXXXXXXXXXXXXXX........................ +......................................XXXXXXXXXXXXXXXXXXX....................... +...................................XXXXXXXXXXXXXXXXXXXXXX....................... +................................XXXXXXXXXXXXXXXXXXXXXXXXX....................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................................ +...........XXXXXXXXXXXXXXXXXXXXXXXXXX........................................... +...........XXXXXXXXXXXXXXXXXXXXXX............................................... +...........XXXXXXXXXXXXXXXXXXX.................................................. +..........XXXXXXXXXXXXXXXXX..................................................... +..........XXXXXXXXXXXXXX........................................................ +..........XXXXXXXXXX............................................................ +.........XXXXXXXX............................................................... +.........XXXXX.................................................................. +.........XX..................................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), -0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteBound(0.8, 0.05)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +...................................................XXX.......................... +................................................XXXXXX.......................... +.............................................XXXXXXXXX.......................... +.........................................XXXXXXXXXXXXX.......................... +......................................XXXXXXXXXXXXXXXX.......................... +...................................XXXXXXXXXXXXXXXXXXX.......................... +................................XXXXXXXXXXXXXXXXXXXXXX.......................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... +...........XXXXXXXXXXXXXXXXXXXXXXXXX............................................ +...........XXXXXXXXXXXXXXXXXXXXXX............................................... +...........XXXXXXXXXXXXXXXXXXX.................................................. +...........XXXXXXXXXXXXXXX...................................................... +...........XXXXXXXXXXXX......................................................... +...........XXXXXXXXX............................................................ +...........XXXXXX............................................................... +...........XX................................................................... +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0.8, 2); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.2), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteBound(1, 0)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +......................................................X......................... +...................................................XXXX......................... +................................................XXXXXXX......................... +............................................XXXXXXXXXXX......................... +.........................................XXXXXXXXXXXXXX......................... +......................................XXXXXXXXXXXXXXXXXX........................ +...................................XXXXXXXXXXXXXXXXXXXXX........................ +...............................XXXXXXXXXXXXXXXXXXXXXXXXX........................ +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +............XXXXXXXXXXXXXXXXXXXXXXX............................................. +...........XXXXXXXXXXXXXXXXXXXXX................................................ +...........XXXXXXXXXXXXXXXXXX................................................... +...........XXXXXXXXXXXXXX....................................................... +...........XXXXXXXXXXX.......................................................... +..........XXXXXXXXX............................................................. +..........XXXXXX................................................................ +..........XX.................................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteBound(0, 0.1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.....................................................X.......................... +.................................................XXXXX.......................... +..............................................XXXXXXXX.......................... +...........................................XXXXXXXXXXXX......................... +........................................XXXXXXXXXXXXXXX......................... +....................................XXXXXXXXXXXXXXXXXXXX........................ +.................................XXXXXXXXXXXXXXXXXXXXXXX........................ +..............................XXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXX........................................ +............XXXXXXXXXXXXXXXXXXXXXXXXX........................................... +...........XXXXXXXXXXXXXXXXXXXXXX............................................... +...........XXXXXXXXXXXXXXXXXXX.................................................. +...........XXXXXXXXXXXXXXXX..................................................... +...........XXXXXXXXXXX.......................................................... +..........XXXXXXXXX............................................................. +..........XXXXXX................................................................ +..........XXX................................................................... +..........X..................................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 1.2)") { + std::string reference = R"X( +................................................................................ +.....................................................XXX........................ +..................................................XXXXXXX....................... +...............................................XXXXXXXXXX....................... +...........................................XXXXXXXXXXXXXX....................... +........................................XXXXXXXXXXXXXXXXXX...................... +.....................................XXXXXXXXXXXXXXXXXXXXX...................... +..................................XXXXXXXXXXXXXXXXXXXXXXXXX..................... +..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................................. +.....XXXXXXXXXXXXXXXXXXXXXXXXXXX................................................ +.....XXXXXXXXXXXXXXXXXXXXXXX.................................................... +.....XXXXXXXXXXXXXXXXXXXX....................................................... +.....XXXXXXXXXXXXXXXXX.......................................................... +......XXXXXXXXXXXXX............................................................. +......XXXXXXXXX................................................................. +......XXXXXX.................................................................... +......XXX....................................................................... +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteCartesian(1, 1.2); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 0.01)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.....................................................XXX........................ +..................................................XXXXXXX....................... +...............................................XXXXXXXXXX....................... +............................................XXXXXXXXXXXXX....................... +........................................XXXXXXXXXXXXXXXXX....................... +.....................................XXXXXXXXXXXXXXXXXXXX....................... +..................................XXXXXXXXXXXXXXXXXXXXXXX....................... +...............................XXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXX............................................. +.........XXXXXXXXXXXXXXXXXXXXXX................................................. +.........XXXXXXXXXXXXXXXXXXX.................................................... +........XXXXXXXXXXXXXXXXX....................................................... +........XXXXXXXXXXXXXX.......................................................... +........XXXXXXXXXX.............................................................. +........XXXXXXX................................................................. +.......XXXXX.................................................................... +.......XX....................................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteCartesian(1, 0.01); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(0.01, 1)") { + std::string reference = R"X( +................................................................................ +................................................................................ +.....................................................XX......................... +..................................................XXXXX......................... +...............................................XXXXXXXX......................... +...........................................XXXXXXXXXXXX......................... +........................................XXXXXXXXXXXXXXX......................... +.....................................XXXXXXXXXXXXXXXXXX......................... +..................................XXXXXXXXXXXXXXXXXXXXX......................... +..............................XXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............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....................................................................... +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteCartesian(0.01, 1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + BOOST_TEST_CONTEXT("AbsoluteCartesian(0, 0)") { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.....................................................XX......................... +..................................................XXXXX......................... +...............................................XXXXXXXXX........................ +............................................XXXXXXXXXXXX........................ +........................................XXXXXXXXXXXXXXXXX....................... +.....................................XXXXXXXXXXXXXXXXXXXX....................... +..................................XXXXXXXXXXXXXXXXXXXXXXX....................... +...............................XXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +.........XXXXXXXXXXXXXXXXXXXXXXXXX.............................................. +.........XXXXXXXXXXXXXXXXXXXXXX................................................. +.........XXXXXXXXXXXXXXXXXXX.................................................... +.........XXXXXXXXXXXXXXXX....................................................... +........XXXXXXXXXXXXX........................................................... +........XXXXXXXXXX.............................................................. +........XXXXXXX................................................................. +.......XXXXX.................................................................... +.......X........................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::AbsoluteCartesian(0.0, 0.0); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } +} + +BOOST_AUTO_TEST_CASE(Annulus) { + const double minRadius = 7.2; + const double maxRadius = 12.0; + const double minPhi = 0.74195; + const double maxPhi = 1.33970; + + const Vector2 offset(-2., 2.); + + auto bounds = std::make_shared(minRadius, maxRadius, minPhi, + maxPhi, offset); + auto surface = + Surface::makeShared(Transform3::Identity(), bounds); + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +....................................X........................................... +...................................XXX.......................................... +...................................XXXX......................................... +..................................XXXXXXX....................................... +..................................XXXXXXXX...................................... +.................................XXXXXXXXXXX.................................... +................................XXXXXXXXXXXXX................................... +................................XXXXXXXXXXXXXX.................................. +...............................XXXXXXXXXXXXXXXXX................................ +..............................XXXXXXXXXXXXXXXXXXX............................... +..............................XXXXXXXXXXXXXXXXXXXXX............................. +.............................XXXXXXXXXXXXXXXXXXXXXXX............................ +............................XXXXXXXXXXXXXXXXXXXXXXXXX........................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXX....................................... +................XXXXXXXXXXXXXXXXXXXXXXX......................................... +................XXXXXXXXXXXXXXXXXXXXX........................................... +................XXXXXXXXXXXXXXXXXXX............................................. +................XXXXXXXXXXXXXXXXX............................................... +.................XXXXXXXXXXXXXX................................................. +.................XXXXXXXXXXXX................................................... +.................XXXXXXXXXX..................................................... +..................XXXXXXX....................................................... +..................XXXX.......................................................... +..................XX............................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::None(); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +...................................XXX.......................................... +................................XXXXXXXXX....................................... +...............................XXXXXXXXXXX...................................... +..............................XXXXXXXXXXXXX..................................... +..............................XXXXXXXXXXXXXXX................................... +.............................XXXXXXXXXXXXXXXXXX................................. +.............................XXXXXXXXXXXXXXXXXXX................................ +............................XXXXXXXXXXXXXXXXXXXXXX.............................. +............................XXXXXXXXXXXXXXXXXXXXXXX............................. +...........................XXXXXXXXXXXXXXXXXXXXXXXXX............................ +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +................XXXXXXXXXXXXXXXXXXXXXXXXX....................................... +................XXXXXXXXXXXXXXXXXXXXXXXX........................................ +................XXXXXXXXXXXXXXXXXXXXXX.......................................... +.................XXXXXXXXXXXXXXXXXX............................................. +.................XXXXXXXXXXXXXXXX............................................... +..................XXXXXXXXXXXXX................................................. +....................XXXXXXXX.................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.3), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.......................................X........................................ +......................................XXX....................................... +.....................................XXXXXX..................................... +....................................XXXXXXXX.................................... +....................................XXXXXXXXXX.................................. +...................................XXXXXXXXXXXX................................. +..................................XXXXXXXXXXXXXX................................ +.................................XXXXXXXXXXXXXXXXX.............................. +................................XXXXXXXXXXXXXXXXXXX............................. +...............................XXXXXXXXXXXXXXXXXXXXXX........................... +..............................XXXXXXXXXXXXXXXXXXXXXXXX.......................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXX................................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXX.................................. +......................XXXXXXXXXXXXXXXXXXXXXXX................................... +......................XXXXXXXXXXXXXXXXXXXXX..................................... +......................XXXXXXXXXXXXXXXXXXXX...................................... +......................XXXXXXXXXXXXXXXXXXX....................................... +.......................XXXXXXXXXXXXXXXX......................................... +.......................XXXXXXXXXXXXXXX.......................................... +.......................XXXXXXXXXXXXX............................................ +........................XXXXXXXXXX.............................................. +........................XXXXXXXXX............................................... +........................XXXXXXX................................................. +.........................XXXX................................................... +.........................XX..................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(-1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +.....................................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...................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.5), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +...................................X............................................ +..................................XXX........................................... +..................................XXXX.......................................... +.................................XXXXXX......................................... +................................XXXXXXXX........................................ +...............................XXXXXXXXXXX...................................... +...............................XXXXXXXXXXXX..................................... +..............................XXXXXXXXXXXXXX.................................... +.............................XXXXXXXXXXXXXXXX................................... +............................XXXXXXXXXXXXXXXXXX.................................. +...........................XXXXXXXXXXXXXXXXXXXX................................. +..........................XXXXXXXXXXXXXXXXXXXXXX................................ +.........................XXXXXXXXXXXXXXXXXXXXXXXXX.............................. +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.................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.................................................. +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = + BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), -0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::Infinite(); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +...............................XX............................................... +...............................XXX.............................................. +...............................XXXXX............................................ +..............................XXXXXXX........................................... +..............................XXXXXXXXX......................................... +.............................XXXXXXXXXXX........................................ +.............................XXXXXXXXXXXXX...................................... +............................XXXXXXXXXXXXXXXX.................................... +............................XXXXXXXXXXXXXXXXX................................... +...........................XXXXXXXXXXXXXXXXXXXX................................. +..........................XXXXXXXXXXXXXXXXXXXXXX................................ +..........................XXXXXXXXXXXXXXXXXXXXXXXX.............................. +.........................XXXXXXXXXXXXXXXXXXXXXXXXXX............................. +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXX....................................... +...............XXXXXXXXXXXXXXXXXXXXXXXX......................................... +................XXXXXXXXXXXXXXXXXXXXX........................................... +................XXXXXXXXXXXXXXXXXXX............................................. +................XXXXXXXXXXXXXXXXX............................................... +................XXXXXXXXXXXXXXX................................................. +.................XXXXXXXXXXX.................................................... +.................XXXXXXXXX...................................................... +.................XXXXXX......................................................... +.................XXX............................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0.8, 0.05); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.2), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +............................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........... +..............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....................................................... +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), + parseMatrix(reference))); + } + + { + std::string reference = R"X( +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +......................................X......................................... +......................................XXX....................................... +.....................................XXXXXX..................................... +.....................................XXXXXXX.................................... +....................................XXXXXXXXXX.................................. +....................................XXXXXXXXXXXX................................ +...................................XXXXXXXXXXXXXX............................... +...................................XXXXXXXXXXXXXXXX............................. +..................................XXXXXXXXXXXXXXXXXXX........................... +..................................XXXXXXXXXXXXXXXXXXXXX......................... +.................................XXXXXXXXXXXXXXXXXXXXXXX........................ +................................XXXXXXXXXXXXXXXXXXXXXXXXXX...................... +................................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +...............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................................ +.......XXXXXXXXXXXXXXXXXXXXXXXXXXX.............................................. +.......XXXXXXXXXXXXXXXXXXXXXXXXX................................................ +.......XXXXXXXXXXXXXXXXXXXXXXX.................................................. +.......XXXXXXXXXXXXXXXXXXXX..................................................... +.......XXXXXXXXXXXXXXXXXX....................................................... +........XXXXXXXXXXXXXX.......................................................... +........XXXXXXXXXXXX............................................................ +........XXXXXXXXX............................................................... +........XXXXXX.................................................................. +........XX...................................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ + )X"; + + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), + parseMatrix(reference))); + } +} + +BOOST_AUTO_TEST_SUITE_END() +} // namespace Acts::Test diff --git a/Tests/UnitTests/Core/Surfaces/CMakeLists.txt b/Tests/UnitTests/Core/Surfaces/CMakeLists.txt index 906967dd54d..47037b14126 100644 --- a/Tests/UnitTests/Core/Surfaces/CMakeLists.txt +++ b/Tests/UnitTests/Core/Surfaces/CMakeLists.txt @@ -28,3 +28,4 @@ add_unittest(TrapezoidBounds TrapezoidBoundsTests.cpp) add_unittest(VerticesHelper VerticesHelperTests.cpp) add_unittest(AlignmentHelper AlignmentHelperTests.cpp) add_unittest(PolyhedronSurfacesTests PolyhedronSurfacesTests.cpp) +add_unittest(BoundsRegression BoundsRegressionTests.cpp) diff --git a/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp index 5d0102653b2..4e037a105ba 100644 --- a/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/ConeSurfaceTests.cpp @@ -22,8 +22,8 @@ #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Result.hpp" +#include "Acts/Utilities/ThrowAssert.hpp" -#include #include #include #include diff --git a/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp index 6b6712c230b..7b516b6bfec 100644 --- a/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/ConvexPolygonBoundsTests.cpp @@ -15,15 +15,9 @@ #include #include -#include #include -#include #include -namespace Acts { -class AssertionFailureException; -} // namespace Acts - using vec2 = Acts::Vector2; template using poly = Acts::ConvexPolygonBounds; diff --git a/Tests/UnitTests/Core/Surfaces/CylinderBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/CylinderBoundsTests.cpp index 14cafdd045b..6cc6bc8da82 100644 --- a/Tests/UnitTests/Core/Surfaces/CylinderBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/CylinderBoundsTests.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp index 9ef504bd0df..e37b339d00c 100644 --- a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp @@ -24,27 +24,19 @@ #include "Acts/Tests/CommonHelpers/DetectorElementStub.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Result.hpp" +#include "Acts/Utilities/ThrowAssert.hpp" #include "Acts/Utilities/detail/periodic.hpp" -#include #include -#include #include #include -#include #include -#include using namespace Acts::UnitLiterals; -namespace Acts { -class AssertionFailureException; -} // namespace Acts - namespace Acts::Test { auto logger = Acts::getDefaultLogger("UnitTests", Acts::Logging::VERBOSE); diff --git a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp index 2e1fd4473f9..15140f73c7a 100644 --- a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp @@ -13,7 +13,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Alignment.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" #include "Acts/Geometry/Extent.hpp" #include "Acts/Geometry/GeometryContext.hpp" @@ -27,25 +26,19 @@ #include "Acts/Tests/CommonHelpers/DetectorElementStub.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Result.hpp" +#include "Acts/Utilities/ThrowAssert.hpp" +#include "Acts/Utilities/detail/periodic.hpp" -#include #include -#include #include #include #include #include -#include using namespace Acts::UnitLiterals; -namespace Acts { -class AssertionFailureException; -} // namespace Acts - namespace Acts::Test { // Create a test context GeometryContext tgContext = GeometryContext(); diff --git a/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp index 15d930929af..0721039acef 100644 --- a/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/LineSurfaceTests.cpp @@ -22,7 +22,6 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/LineBounds.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Tests/CommonHelpers/DetectorElementStub.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Tests/CommonHelpers/LineSurfaceStub.hpp" @@ -30,24 +29,18 @@ #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Result.hpp" +#include "Acts/Utilities/ThrowAssert.hpp" #include "Acts/Utilities/UnitVectors.hpp" #include "Acts/Utilities/VectorHelpers.hpp" -#include #include #include #include #include #include -#include -#include #include #include -namespace Acts { -class AssertionFailureException; -} // namespace Acts - namespace Acts::Test { // Create a test context diff --git a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp index de2a87483e0..b62517f3e2c 100644 --- a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp @@ -27,13 +27,12 @@ #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Result.hpp" +#include "Acts/Utilities/ThrowAssert.hpp" -#include #include #include #include #include -#include using namespace Acts::UnitLiterals; diff --git a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp index 184d69e341f..8029a53426b 100644 --- a/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PolyhedronSurfacesTests.cpp @@ -29,7 +29,6 @@ #include "Acts/Utilities/Logger.hpp" #include -#include #include using namespace Acts::UnitLiterals; diff --git a/Tests/UnitTests/Core/Surfaces/RadialBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/RadialBoundsTests.cpp index a25eeb4d352..a5083efaf92 100644 --- a/Tests/UnitTests/Core/Surfaces/RadialBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/RadialBoundsTests.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/Tests/UnitTests/Core/Surfaces/StrawSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/StrawSurfaceTests.cpp index 2998ad0e799..99e8671c7cf 100644 --- a/Tests/UnitTests/Core/Surfaces/StrawSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/StrawSurfaceTests.cpp @@ -20,10 +20,6 @@ #include #include -namespace Acts { -class PlanarBounds; -} // namespace Acts - namespace Acts::Test { // Create a test context diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp index 2d62f29f4e4..732e7d9ff6a 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceArrayTests.cpp @@ -15,13 +15,10 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" -#include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Utilities/Axis.hpp" #include "Acts/Utilities/AxisFwd.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Helpers.hpp" -#include "Acts/Utilities/detail/grid_helper.hpp" #include #include diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp index 14b432d2945..655303f9602 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp @@ -24,7 +24,6 @@ #include #include #include -#include using namespace Acts::UnitLiterals; diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp index 11c66abf303..822c28c69df 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceLocalToGlobalRoundtripTests.cpp @@ -30,12 +30,7 @@ #include #include -#include #include -#include -#include -#include -#include namespace { diff --git a/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp index 0e9f1bba029..52155fec5fe 100644 --- a/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp @@ -20,10 +20,8 @@ #include #include #include -#include #include #include -#include #include namespace bdata = boost::unit_test::data; diff --git a/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp b/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp index 249f822eb54..343190311a3 100644 --- a/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp +++ b/Tests/UnitTests/Core/TrackFitting/Gx2fTests.cpp @@ -995,7 +995,7 @@ BOOST_AUTO_TEST_CASE(Material) { createMeasurements(simPropagator, geoCtx, magCtx, parametersMeasurements, resMapAllPixel, rng); - const Acts::ActsVector<2> scatterOffset = {100_mm, 100_mm}; + const Acts::Vector2 scatterOffset = {100_mm, 100_mm}; const std::size_t indexMaterialSurface = 3; for (std::size_t iMeas = indexMaterialSurface; iMeas < nSurfaces; iMeas++) { // This only works, because our detector is evenly spaced diff --git a/Tests/UnitTests/Core/Utilities/HelpersTests.cpp b/Tests/UnitTests/Core/Utilities/HelpersTests.cpp index a2a719fc535..c849366e12f 100644 --- a/Tests/UnitTests/Core/Utilities/HelpersTests.cpp +++ b/Tests/UnitTests/Core/Utilities/HelpersTests.cpp @@ -77,11 +77,11 @@ BOOST_AUTO_TEST_CASE(theta_eta_test_helper) { BOOST_AUTO_TEST_CASE(cross_test_helper) { { Vector3 v(1, 2, 3); - ActsMatrix<3, 3> mat; + SquareMatrix3 mat; mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; - ActsMatrix<3, 3> act = cross(mat, v); - ActsMatrix<3, 3> exp; + SquareMatrix3 act = cross(mat, v); + SquareMatrix3 exp; exp << -2, -1, 0, 4, 2, 0, -2, -1, 0; CHECK_CLOSE_ABS(act, exp, 1e-9); @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(cross_test_helper) { } BOOST_AUTO_TEST_CASE(toString_test_helper) { - ActsMatrix<3, 3> mat; + SquareMatrix3 mat; mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; std::string out; out = toString(mat); @@ -172,8 +172,8 @@ BOOST_AUTO_TEST_CASE(test_matrix_dimension_switch) { } using MatrixProductTypes = - std::tuple, ActsMatrix<3, 3>>, - std::pair, ActsMatrix<4, 4>>, + std::tuple, + std::pair, std::pair, ActsMatrix<8, 8>>, std::pair, ActsMatrix<7, 4>>>; diff --git a/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp b/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp index d26ba186e84..d1f59da82ce 100644 --- a/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp @@ -305,7 +305,7 @@ BOOST_DATA_TEST_CASE(TimeAtPca, tracksWithoutIPs* vertices, t0, phi, theta, p, geoContext, rParams, vtxPos, state) .value(); - ActsVector<4> distVec = distAndMom.first; + Vector4 distVec = distAndMom.first; Vector3 momDir = distAndMom.second; // Check quantities: