diff --git a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp index 9ce660e5856..203cc18b3cf 100644 --- a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp @@ -13,11 +13,9 @@ #include "Acts/Geometry/VolumeBounds.hpp" #include -#include #include #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Surfaces/AnnulusBounds.hpp b/Core/include/Acts/Surfaces/AnnulusBounds.hpp index 4e56b56dac7..1f60c53cc26 100644 --- a/Core/include/Acts/Surfaces/AnnulusBounds.hpp +++ b/Core/include/Acts/Surfaces/AnnulusBounds.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -66,27 +65,31 @@ class AnnulusBounds : public DiscBounds { /// @param values The parameter array AnnulusBounds(const std::array& values) noexcept(false); - AnnulusBounds(const AnnulusBounds& source) = default; + BoundsType type() const final { return eAnnulus; } - BoundsType type() const final { return SurfaceBounds::eAnnulus; } + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return false; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Outstream operator - /// /// @param sl is the ostream to be dumped into std::ostream& toStream(std::ostream& sl) const final; @@ -184,23 +187,19 @@ class AnnulusBounds : public DiscBounds { /// if consistency is not given void checkConsistency() noexcept(false); - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param tolR tolerance on the radius - /// @param tolPhi tolerance on the polar angle phi - /// @return boolean indicator for the success of this operation - virtual bool inside(const Vector2& lposition, double tolR, - double tolPhi) const final; - /// Transform the strip cartesian /// into the module polar system /// /// @param vStripXY the position in the cartesian strip system /// @return the position in the module polar coordinate system Vector2 stripXYToModulePC(const Vector2& vStripXY) const; + + Vector2 stripPCToModulePC(const Vector2& vStripPC) const; + + Vector2 modulePCToStripPC(const Vector2& vModulePC) const; + + SquareMatrix2 stripPCToModulePCJacobian( + const Vector2& lpositionRotated) const; }; } // namespace Acts diff --git a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp index 5dfc7ad6552..53d068d7f00 100644 --- a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp +++ b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp @@ -72,6 +72,10 @@ class BoundaryTolerance { throw std::invalid_argument( "AbsoluteBound: Tolerance must be non-negative"); } + if ((tolerance0 == 0) != (tolerance1 == 0)) { + throw std::invalid_argument( + "AbsoluteBound: Both tolerances must be zero or non-zero"); + } } }; @@ -112,10 +116,10 @@ class BoundaryTolerance { : maxChi2(maxChi2_), weight(weight_) {} }; - enum class ToleranceMode { - Extend, // Extend the boundary - None, // No tolerance - Shrink // Shrink the boundary + enum class Mode { + Extend, //< Extend the boundary + None, //< No tolerance + Shrink //< Shrink the boundary }; /// Underlying variant type @@ -151,8 +155,8 @@ class BoundaryTolerance { /// Check if the tolerance is chi2 with bound coordinates. bool hasChi2Bound() const; - /// Check if any tolerance is set. - ToleranceMode toleranceMode() const; + /// Get the tolerance mode. + Mode mode() const; /// Get the tolerance as absolute bound. AbsoluteBound asAbsoluteBound(bool isCartesian = false) const; @@ -171,12 +175,6 @@ class BoundaryTolerance { bool isTolerated(const Vector2& distance, const std::optional& jacobianOpt) const; - /// Check if there is a metric assigned with this tolerance. - bool hasMetric(bool hasJacobian) const; - - /// Get the metric for the tolerance. - SquareMatrix2 getMetric(const std::optional& jacobian) const; - private: Variant m_variant; diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 7d852f2df87..4ab780265da 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include @@ -71,24 +70,37 @@ class ConeBounds : public SurfaceBounds { /// @param values The parameter array ConeBounds(const std::array& values) noexcept(false); - BoundsType type() const final { return SurfaceBounds::eCone; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eCone; } - /// Return the bound values as dynamically sized vector - /// - /// @return this returns a copy of the internal values + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return true; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + /// @copydoc SurfaceBounds::values std::vector values() const final; - /// inside method for local position - /// - /// @param lposition is the local position to be checked - /// @param boundaryTolerance is the boundary check directive - /// @return is a boolean indicating if the position is inside - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance = - BoundaryTolerance::None()) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Output Method for std::ostream - /// /// @param sl is the ostrea into which the dump is done /// @return is the input object std::ostream& toStream(std::ostream& sl) const final; diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp index afb5bb406f9..49c75d0cc59 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -34,8 +33,11 @@ class ConvexPolygonBoundsBase : public PlanarBounds { /// @param sl is the ostream to be written into std::ostream& toStream(std::ostream& sl) const final; + /// Return the bounds type of this bounds object. + /// @return The bounds type + BoundsType type() const final { return eConvexPolygon; } + /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; @@ -95,15 +97,14 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// @param values The values to build up the vertices ConvexPolygonBounds(const value_array& values) noexcept(false); - BoundsType type() const final { return SurfaceBounds::eConvexPolygon; } + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; - /// Return whether a local 2D point lies inside of the bounds defined by this - /// object. - /// @param lposition The local position to check - /// @param boundaryTolerance The `BoundaryTolerance` object handling tolerances. - /// @return Whether the points is inside - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + using SurfaceBounds::inside; /// Return the vertices /// @@ -144,17 +145,14 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase { /// @param vertices The list of vertices. ConvexPolygonBounds(const std::vector& vertices); - /// Return the bounds type of this bounds object. - /// @return The bounds type - BoundsType type() const final { return SurfaceBounds::eConvexPolygon; } - - /// Return whether a local 2D point lies inside of the bounds defined by this - /// object. - /// @param lposition The local position to check - /// @param boundaryTolerance The `BoundaryTolerance` object handling tolerances. - /// @return Whether the points is inside - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 8201a9dedd6..a5bd108b0be 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -6,13 +6,15 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/ThrowAssert.hpp" +namespace Acts { + template - requires std::same_as -void Acts::ConvexPolygonBoundsBase::convex_impl( - const coll_t& vertices) noexcept(false) { + requires std::same_as +void ConvexPolygonBoundsBase::convex_impl(const coll_t& vertices) noexcept( + false) { const std::size_t N = vertices.size(); for (std::size_t i = 0; i < N; i++) { std::size_t j = (i + 1) % N; @@ -48,7 +50,7 @@ void Acts::ConvexPolygonBoundsBase::convex_impl( } template -Acts::RectangleBounds Acts::ConvexPolygonBoundsBase::makeBoundingBox( +RectangleBounds ConvexPolygonBoundsBase::makeBoundingBox( const coll_t& vertices) { Vector2 vmax, vmin; vmax = vertices[0]; @@ -63,8 +65,8 @@ Acts::RectangleBounds Acts::ConvexPolygonBoundsBase::makeBoundingBox( } template -Acts::ConvexPolygonBounds::ConvexPolygonBounds( - const std::vector& vertices) noexcept(false) +ConvexPolygonBounds::ConvexPolygonBounds( + const std::vector& vertices) noexcept(false) : m_vertices(), m_boundingBox(makeBoundingBox(vertices)) { throw_assert(vertices.size() == N, "Size and number of given vertices do not match."); @@ -75,15 +77,15 @@ Acts::ConvexPolygonBounds::ConvexPolygonBounds( } template -Acts::ConvexPolygonBounds::ConvexPolygonBounds( +ConvexPolygonBounds::ConvexPolygonBounds( const vertex_array& vertices) noexcept(false) : m_vertices(vertices), m_boundingBox(makeBoundingBox(vertices)) { checkConsistency(); } template -Acts::ConvexPolygonBounds::ConvexPolygonBounds( - const value_array& values) noexcept(false) +ConvexPolygonBounds::ConvexPolygonBounds(const value_array& values) noexcept( + false) : m_vertices(), m_boundingBox(0., 0.) { for (std::size_t i = 0; i < N; i++) { m_vertices[i] = Vector2(values[2 * i], values[2 * i + 1]); @@ -93,25 +95,32 @@ Acts::ConvexPolygonBounds::ConvexPolygonBounds( } template -bool Acts::ConvexPolygonBounds::inside( - const Acts::Vector2& lposition, - const Acts::BoundaryTolerance& boundaryTolerance) const { - return detail::insidePolygon(m_vertices, boundaryTolerance, lposition, - std::nullopt); +bool ConvexPolygonBounds::inside(const Vector2& lposition) const { + return detail::VerticesHelper::isInsidePolygon(lposition, m_vertices); } template -std::vector Acts::ConvexPolygonBounds::vertices( +Vector2 ConvexPolygonBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, m_vertices, metric.value_or(SquareMatrix2::Identity())); +} + +template +std::vector ConvexPolygonBounds::vertices( unsigned int /*ignoredSegments*/) const { return {m_vertices.begin(), m_vertices.end()}; } template -const Acts::RectangleBounds& Acts::ConvexPolygonBounds::boundingBox() const { +const RectangleBounds& ConvexPolygonBounds::boundingBox() const { return m_boundingBox; } template -void Acts::ConvexPolygonBounds::checkConsistency() const noexcept(false) { +void ConvexPolygonBounds::checkConsistency() const noexcept(false) { convex_impl(m_vertices); } + +} // namespace Acts diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index 10fab504635..05e84edc57d 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Tolerance.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include @@ -45,6 +44,7 @@ namespace Acts { /// \ | / \ | / /// \|/______________\|/ /// 2 * ZhalfLength +/// class CylinderBounds : public SurfaceBounds { public: enum BoundValues : int { @@ -83,22 +83,36 @@ class CylinderBounds : public SurfaceBounds { checkConsistency(); } - BoundsType type() const final { return SurfaceBounds::eCylinder; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eCylinder; } + + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return true; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check tolerance directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Access to the bound values /// @param bValue the class nested enum for the array access @@ -136,9 +150,6 @@ class CylinderBounds : public SurfaceBounds { /// Helper method to shift into the phi-frame /// @param lposition the polar coordinates in the global frame Vector2 shifted(const Vector2& lposition) const; - - /// Return the jacobian into the polar coordinate - SquareMatrix2 jacobian() const; }; } // namespace Acts diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index 096efc2dd27..35923e934b5 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -66,22 +65,22 @@ class DiamondBounds : public PlanarBounds { Vector2{*std::max_element(values.begin(), values.begin() + 2), values[eHalfLengthYpos]}) {} - BoundsType type() const final { return SurfaceBounds::eDiamond; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eDiamond; } /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Return the vertices that describe this shape /// diff --git a/Core/include/Acts/Surfaces/DiscBounds.hpp b/Core/include/Acts/Surfaces/DiscBounds.hpp index 626f8e2405c..56669ceacab 100644 --- a/Core/include/Acts/Surfaces/DiscBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscBounds.hpp @@ -18,7 +18,7 @@ namespace Acts { /// /// common base class for all bounds that are in a r/phi frame /// - simply introduced to avoid wrong bound assignments to surfaces - +/// class DiscBounds : public SurfaceBounds { public: /// Return method for inner Radius diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp index 57ffd86586a..922527a2120 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -60,22 +59,30 @@ class DiscTrapezoidBounds : public DiscBounds { checkConsistency(); } - BoundsType type() const final { return SurfaceBounds::eDiscTrapezoid; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eDiscTrapezoid; } + + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return false; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; - /// This method checks if the radius given in the LocalPosition is inside - /// [rMin,rMax] - /// if only tol0 is given and additional in the phi sector is tol1 is given - /// @param lposition is the local position to be checked (in polar - /// coordinates) - /// @param boundaryTolerance is the boundary check directive - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance = - BoundaryTolerance::None()) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Output Method for std::ostream std::ostream& toStream(std::ostream& sl) const final; @@ -161,12 +168,6 @@ class DiscTrapezoidBounds : public DiscBounds { /// /// @param lposition The local position in polar coordinates Vector2 toLocalCartesian(const Vector2& lposition) const; - - /// Jacobian - /// into its Cartesian representation - /// - /// @param lposition The local position in polar coordinates - SquareMatrix2 jacobianToLocalCartesian(const Vector2& lposition) const; }; } // namespace Acts diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index 007c0fd0aff..9cd29c53bf9 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -66,24 +65,22 @@ class EllipseBounds : public PlanarBounds { checkConsistency(); } - BoundsType type() const final { return SurfaceBounds::eEllipse; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eEllipse; } /// Return the bound values as dynamically sized vector /// /// @return this returns a copy of the internal values std::vector values() const final; - /// This method checks if the point given in the local coordinates is between - /// two ellipsoids if only tol0 is given and additional in the phi sector is - /// tol1 is given - /// - /// @warning This **only** works for tolerance-based checks - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index e08ff779cbf..9ce1ded9449 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" namespace Acts { @@ -20,17 +21,45 @@ namespace Acts { /// class InfiniteBounds : public SurfaceBounds { public: - BoundsType type() const final { return SurfaceBounds::eBoundless; } + /// @copydoc SurfaceBounds::type + SurfaceBounds::BoundsType type() const final { return eBoundless; } + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return true; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + /// @copydoc SurfaceBounds::values std::vector values() const final { return {}; } - /// Method inside() returns true for any case - /// - /// ignores input parameters - /// - /// @return always true - bool inside(const Vector2& /*lposition*/, - const BoundaryTolerance& /*boundaryTolerance*/) const final { + /// @copydoc SurfaceBounds::inside(const Vector2&) const + bool inside(const Vector2& lposition) const final { + (void)lposition; + return true; + } + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final { + (void)metric; + return lposition; + } + + /// @copydoc SurfaceBounds::inside(const Vector2&, const BoundaryTolerance&) const + bool inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const final { + (void)lposition; + (void)boundaryTolerance; return true; } diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index 7a8d2af2468..9c9b7dce38c 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include @@ -41,23 +40,36 @@ class LineBounds : public SurfaceBounds { checkConsistency(); } - BoundsType type() const final { return SurfaceBounds::eLine; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eLine; } + + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return true; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Output Method for std::ostream /// diff --git a/Core/include/Acts/Surfaces/PlanarBounds.hpp b/Core/include/Acts/Surfaces/PlanarBounds.hpp index 28bc0e42b60..b4cab64cc46 100644 --- a/Core/include/Acts/Surfaces/PlanarBounds.hpp +++ b/Core/include/Acts/Surfaces/PlanarBounds.hpp @@ -36,8 +36,22 @@ class PlanarBounds : public SurfaceBounds { virtual std::vector vertices( unsigned int quarterSegments = 2u) const = 0; + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return true; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + /// Bounding box parameters - /// /// @return rectangle bounds for a bounding box virtual const RectangleBounds& boundingBox() const = 0; }; diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index f10884e5b75..5f27184cb90 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/DiscBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -56,21 +55,30 @@ class RadialBounds : public DiscBounds { checkConsistency(); } - BoundsType type() const final { return SurfaceBounds::eDisc; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eDisc; } + + /// @copydoc SurfaceBounds::isCartesian + bool isCartesian() const final { return false; } + + /// @copydoc SurfaceBounds::boundToCartesianJacobian + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::boundToCartesianMetric + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final; /// Return the bound values as dynamically sized vector - /// /// @return this returns a copy of the internal values std::vector values() const final; - /// For disc surfaces the local position in (r,phi) is checked - /// - /// @param lposition local position to be checked - /// @param boundaryTolerance boundary check directive - /// - /// @return is a boolean indicating the operation success - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Outstream operator /// diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index 87620dadab8..289322063e3 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -63,21 +62,20 @@ class RectangleBounds : public PlanarBounds { checkConsistency(); } - BoundsType type() const final { return SurfaceBounds::eRectangle; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eRectangle; } - std::vector values() const final { - return {m_min.x(), m_min.y(), m_max.x(), m_max.y()}; - } + /// @copydoc SurfaceBounds::values + std::vector values() const final; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + /// @copydoc SurfaceBounds::inside + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index 6bd1c126a93..f4778471241 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -250,6 +250,21 @@ class Surface : public virtual GeometryObject, const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::None(), double tolerance = s_onSurfaceTolerance) const; + /// Calculates the closest point on the boundary of the surface to a given + /// point in local coordinates. + /// @param lposition The local position to check + /// @param metric The metric to use for the calculation + /// @return The closest point on the boundary of the surface + virtual Vector2 closestPointOnBounds( + const Vector2& lposition, + const std::optional& metric) const; + + /// Calculates the distance to the boundary of the surface from a given point + /// in local coordinates. + /// @param lposition The local position to check + /// @return The distance to the boundary of the surface + virtual double distanceToBounds(const Vector2& lposition) const; + /// The insideBounds method for local positions /// /// @param lposition The local position to check diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index aae4e61e273..1bf4e90c945 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -11,6 +11,8 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" +#include +#include #include namespace Acts { @@ -49,28 +51,99 @@ class SurfaceBounds { virtual ~SurfaceBounds() = default; /// Return the bounds type - for persistency optimization - /// - /// @return is a BoundsType enum + /// @return the bounds type virtual BoundsType type() const = 0; + /// Check if the bound coordinates are cartesian + /// @return true if the bound coordinates are cartesian + virtual bool isCartesian() const = 0; + + /// Computes the bound to cartesian jacobian at a given local position + /// @param lposition is the local position at which the jacobian is computed + /// @return the bound to cartesian jacobian + virtual SquareMatrix2 boundToCartesianJacobian( + const Vector2& lposition) const = 0; + + /// Computes the bound to cartesian metric at a given local position + /// @param lposition is the local position at which the metric is computed + /// @return the bound to cartesian metric + virtual SquareMatrix2 boundToCartesianMetric( + const Vector2& lposition) const = 0; + /// Access method for bound values, this is a dynamically sized /// vector containing the parameters needed to describe these bounds - /// /// @return of the stored values for this SurfaceBounds object virtual std::vector values() const = 0; - /// Inside check for the bounds object driven by the boundary check directive - /// Each Bounds has a method inside, which checks if a LocalPosition is inside - /// the bounds Inside can be called without/with tolerances. - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// @return boolean indicator for the success of this operation + /// Inside check for the bounds object + /// @param lposition is the local position + /// @return true if the local position is inside the bounds + virtual bool inside(const Vector2& lposition) const = 0; + + /// Calculates the closest point on the bounds to a given local position + /// @param lposition is the local position + /// @param metric is the metric to be used for the distance calculation + /// @return the closest point on the bounds + virtual Vector2 closestPoint( + const Vector2& lposition, + const std::optional& metric) const = 0; + + /// Calculates the distance to the bounds from a given local position + /// @param lposition is the local position + /// @return the distance to the bounds + virtual double distance(const Vector2& lposition) const { + SquareMatrix2 metric = boundToCartesianMetric(lposition); + + Vector2 closest = closestPoint(lposition, metric); + Vector2 diff = closest - lposition; + return std::sqrt((diff.transpose() * metric * diff)(0, 0)); + } + + /// Inside check for the bounds object given a boundary tolerance. + /// @param lposition is the local position + /// @param boundaryTolerance is the boundary tolerance object + /// @return true if the local position is inside the bounds and tolerance virtual bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const = 0; + const BoundaryTolerance& boundaryTolerance) const { + using enum BoundaryTolerance::Mode; + + if (boundaryTolerance.isInfinite()) { + return true; + } + + BoundaryTolerance::Mode toleranceMode = boundaryTolerance.mode(); + bool strictlyInside = inside(lposition); + + if (toleranceMode == None) { + return strictlyInside; + } + + if (toleranceMode == Extend && strictlyInside) { + return true; + } + + std::optional jacobian; + std::optional metric; + if (boundaryTolerance.hasChi2Bound()) { + SquareMatrix2 j = boundToCartesianJacobian(lposition); + jacobian = j; + metric = j.transpose() * boundaryTolerance.asChi2Bound().weight * j; + } else if (!isCartesian()) { + jacobian = boundToCartesianJacobian(lposition); + metric = boundToCartesianMetric(lposition); + } + + Vector2 closest = closestPoint(lposition, metric); + Vector2 distance = closest - lposition; + + if (toleranceMode == Shrink) { + return boundaryTolerance.isTolerated(distance, jacobian) && + strictlyInside; + } + return boundaryTolerance.isTolerated(distance, jacobian); + } /// Output Method for std::ostream, to be overloaded by child classes - /// /// @param os is the outstream in which the string dump is done virtual std::ostream& toStream(std::ostream& os) const = 0; diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index f8bfebe2971..867cc62fa25 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" @@ -51,10 +50,14 @@ class TrapezoidBounds : public PlanarBounds { /// @param values the values to be stream in TrapezoidBounds(const std::array& values) noexcept(false); - BoundsType type() const final { return SurfaceBounds::eTrapezoid; } + /// @copydoc SurfaceBounds::type + BoundsType type() const final { return eTrapezoid; } + /// @copydoc SurfaceBounds::values std::vector values() const final; + /// @copydoc SurfaceBounds::inside + /// /// The orientation of the Trapezoid is according to the figure above, /// in words: the shorter of the two parallel sides of the trapezoid /// intersects @@ -91,13 +94,13 @@ class TrapezoidBounds : public PlanarBounds { ///
/// and @f$ \delta_{I} = \delta_{II} = - \frac{1}{2}\kappa_{I}(x_{max} + /// x_{min}) @f$ - /// - /// @param lposition Local position (assumed to be in right surface frame) - /// @param boundaryTolerance boundary check directive - /// - /// @return boolean indicator for the success of this operation - bool inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const final; + bool inside(const Vector2& lposition) const final; + + /// @copydoc SurfaceBounds::closestPoint + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final; + + using SurfaceBounds::inside; /// Return the vertices /// diff --git a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp b/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp deleted file mode 100644 index 86b61770ae7..00000000000 --- a/Core/include/Acts/Surfaces/detail/BoundaryCheckHelper.hpp +++ /dev/null @@ -1,137 +0,0 @@ -// This file is part of the ACTS project. -// -// Copyright (C) 2016 CERN for the benefit of the ACTS project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -#pragma once - -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/VerticesHelper.hpp" - -#include - -namespace Acts::detail { - -/// Check if a point is inside a box. -/// -/// @param lowerLeft The lower left corner of the box. -/// @param upperRight The upper right corner of the box. -/// @param tolerance The tolerance to use. -/// @param point The point to check. -/// @param jacobianOpt The Jacobian to transform the distance to Cartesian -/// -/// @return True if the point is inside the box. -inline bool insideAlignedBox(const Vector2& lowerLeft, - const Vector2& upperRight, - const BoundaryTolerance& tolerance, - const Vector2& point, - const std::optional& jacobianOpt) { - using enum BoundaryTolerance::ToleranceMode; - - if (tolerance.isInfinite()) { - return true; - } - - BoundaryTolerance::ToleranceMode mode = tolerance.toleranceMode(); - bool insideRectangle = - detail::VerticesHelper::isInsideRectangle(point, lowerLeft, upperRight); - - if (mode == None) { - return insideRectangle; - } - - if (mode == Extend && insideRectangle) { - return true; - } - - Vector2 closestPoint; - - if (!tolerance.hasMetric(jacobianOpt.has_value())) { - closestPoint = - detail::VerticesHelper::computeEuclideanClosestPointOnRectangle( - point, lowerLeft, upperRight); - } else { - // TODO there might be a more optimal way to compute the closest point to a - // box with metric - - std::array vertices = {{lowerLeft, - {upperRight[0], lowerLeft[1]}, - upperRight, - {lowerLeft[0], upperRight[1]}}}; - - SquareMatrix2 metric = tolerance.getMetric(jacobianOpt); - - closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( - point, vertices, metric); - } - - Vector2 distance = closestPoint - point; - - if (mode == Extend) { - return tolerance.isTolerated(distance, jacobianOpt); - } else { - return tolerance.isTolerated(distance, jacobianOpt) && insideRectangle; - } -} - -/// Check if a point is inside a polygon. -/// -/// @param vertices The vertices of the polygon. -/// @param tolerance The tolerance to use. -/// @param point The point to check. -/// @param jacobianOpt The Jacobian to transform the distance to Cartesian -/// -/// @return True if the point is inside the polygon. -inline bool insidePolygon(std::span vertices, - const BoundaryTolerance& tolerance, - const Vector2& point, - const std::optional& jacobianOpt) { - using enum BoundaryTolerance::ToleranceMode; - if (tolerance.isInfinite()) { - // The null boundary check always succeeds - return true; - } - - BoundaryTolerance::ToleranceMode mode = tolerance.toleranceMode(); - bool insidePolygon = detail::VerticesHelper::isInsidePolygon(point, vertices); - - 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 insidePolygon; - } - - if (mode == Extend && insidePolygon) { - return true; - } - - // TODO: When tolerance is not 0, we could also avoid this computation in - // some cases by testing against a bounding box of the polygon, padded - // on each side with our tolerance. Check if this optimization is - // worthwhile in some production workflows, and if so implement it. - - SquareMatrix2 metric = tolerance.getMetric(jacobianOpt); - - // We are outside of the polygon, but there is a tolerance. Must find what - // the closest point on the polygon is and check if it's within tolerance. - auto closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( - point, vertices, metric); - - Vector2 distance = closestPoint - point; - - 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/VerticesHelper.hpp b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp index 24373a59c5c..30cf0c27244 100644 --- a/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/VerticesHelper.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -297,4 +298,29 @@ inline Vector2 computeEuclideanClosestPointOnRectangle( } } +inline Vector2 computeClosestPointOnAlignedBox( + const Vector2& lowerLeft, const Vector2& upperRight, const Vector2& point, + const std::optional& metricOpt) { + Vector2 closestPoint; + + if (!metricOpt.has_value()) { + closestPoint = + detail::VerticesHelper::computeEuclideanClosestPointOnRectangle( + point, lowerLeft, upperRight); + } else { + // TODO there might be a more optimal way to compute the closest point to a + // box with metric + + std::array vertices = {{lowerLeft, + {upperRight[0], lowerLeft[1]}, + upperRight, + {lowerLeft[0], upperRight[1]}}}; + + closestPoint = detail::VerticesHelper::computeClosestPointOnPolygon( + point, vertices, *metricOpt); + } + + return closestPoint; +} + } // namespace Acts::detail::VerticesHelper diff --git a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp index 545e0947797..b5779f4e18f 100644 --- a/Core/src/Detector/detail/CylindricalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CylindricalDetectorHelper.cpp @@ -24,17 +24,14 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Utilities/Axis.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Enumerate.hpp" -#include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/StringHelpers.hpp" #include #include #include -#include #include #include #include diff --git a/Core/src/Surfaces/AnnulusBounds.cpp b/Core/src/Surfaces/AnnulusBounds.cpp index 956a644ba5f..b4329a7c13c 100644 --- a/Core/src/Surfaces/AnnulusBounds.cpp +++ b/Core/src/Surfaces/AnnulusBounds.cpp @@ -8,7 +8,7 @@ #include "Acts/Surfaces/AnnulusBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -18,26 +18,26 @@ #include #include #include -#include +#include namespace Acts { namespace { Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p, - const SquareMatrix2& weight) { + const SquareMatrix2& metric) { // connecting vector auto n = b - a; // squared norm of line - auto f = (n.transpose() * weight * n).value(); + auto f = (n.transpose() * metric * n).value(); // weighted scalar product of line to point and segment line - auto u = ((p - a).transpose() * weight * n).value() / f; + auto u = ((p - a).transpose() * metric * 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(); +double squaredNorm(const Vector2& v, const SquareMatrix2& metric) { + return (v.transpose() * metric * v).value(); } } // namespace @@ -171,274 +171,222 @@ std::vector AnnulusBounds::vertices( m_outLeftStripXY}; } -bool AnnulusBounds::inside(const Vector2& lposition, double tolR, - double tolPhi) const { +SquareMatrix2 AnnulusBounds::boundToCartesianJacobian( + const Vector2& lposition) const { + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = -lposition[0] * std::sin(lposition[1]); + j(1, 0) = std::sin(lposition[1]); + j(1, 1) = lposition[0] * std::cos(lposition[1]); + return j; +} + +SquareMatrix2 AnnulusBounds::boundToCartesianMetric( + const Vector2& lposition) const { + SquareMatrix2 m; + m(0, 0) = 1; + m(0, 1) = 0; + m(1, 0) = 0; + m(1, 1) = lposition[0] * lposition[0]; + return m; +} + +bool AnnulusBounds::inside(const Vector2& lposition) const { // locpo is PC in STRIP SYSTEM // need to perform internal rotation induced by average phi Vector2 locpo_rotated = m_rotationStripPC * lposition; double phiLoc = locpo_rotated[1]; double rLoc = locpo_rotated[0]; - if (phiLoc < (get(eMinPhiRel) - tolPhi) || - phiLoc > (get(eMaxPhiRel) + tolPhi)) { + if (phiLoc < get(eMinPhiRel) || phiLoc > get(eMaxPhiRel)) { return false; } // calculate R in MODULE SYSTEM to evaluate R-bounds - if (tolR == 0.) { - // don't need R, can use R^2 - double r_mod2 = m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + - 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]); - - if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) { - return false; - } - } else { - // use R - double r_mod = sqrt(m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + - 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1])); + // don't need R, can use R^2 + double r_mod2 = m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc + + 2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]); - if (r_mod < (get(eMinR) - tolR) || r_mod > (get(eMaxR) + tolR)) { - return false; - } + if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) { + return false; } + return true; } -bool AnnulusBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - using enum BoundaryTolerance::ToleranceMode; - if (boundaryTolerance.isInfinite()) { - return true; - } - - if (boundaryTolerance.isNone()) { - return inside(lposition, 0., 0.); - } +SquareMatrix2 AnnulusBounds::stripPCToModulePCJacobian( + const Vector2& lpositionRotated) const { + double dphi = get(eAveragePhi); + double phi_strip = lpositionRotated[1]; + double r_strip = lpositionRotated[0]; + double O_x = m_shiftXY[0]; + double O_y = m_shiftXY[1]; - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(); - absoluteBound.has_value()) { - return inside(lposition, absoluteBound->tolerance0, - absoluteBound->tolerance1); - } + // 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 j; + j(0, 0) = (B * O_x + C * O_y + r_strip) / sqrtA; + j(0, 1) = r_strip * (B * O_y + O_x * sinDPhiPhiStrip) / sqrtA; + j(1, 0) = -(B * O_y - C * O_x) / A; + j(1, 1) = r_strip * (B * O_x + C * O_y + r_strip) / A; + return j; +} - bool insideStrict = inside(lposition, 0., 0.); +Vector2 AnnulusBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + // lposition is PC in STRIP SYSTEM + // we need to rotate the local position + Vector2 lpositionRotated = m_rotationStripPC * lposition; - 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; - } + SquareMatrix2 jacobianStripPCToModulePC = + stripPCToModulePCJacobian(lpositionRotated); - if (mode == Extend && insideStrict) { - return true; - } + // calculate the metrics for STRIP PC and MODULE PC + SquareMatrix2 metricStripPC = metric.value_or(SquareMatrix2::Identity()); + SquareMatrix2 metricModulePC = jacobianStripPCToModulePC.transpose() * + metricStripPC * jacobianStripPCToModulePC; - // locpo is PC in STRIP SYSTEM - // we need to rotate the locpo - Vector2 locpo_rotated = m_rotationStripPC * lposition; + // minimum distance and associated point + double minDist = std::numeric_limits::max(); + Vector2 closest = Vector2::Zero(); - // covariance is given in STRIP SYSTEM in PC we need to convert the - // covariance to the MODULE SYSTEM in PC via jacobian. The following - // transforms into STRIP XY, does the shift into MODULE XY, and then - // transforms into MODULE PC - double dphi = get(eAveragePhi); - double phi_strip = locpo_rotated[1]; - double r_strip = locpo_rotated[0]; - double O_x = m_shiftXY[0]; - double O_y = m_shiftXY[1]; + // first: STRIP system. lpositionRotated is in STRIP PC already - 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); + { + Vector2 currentClosest = closestOnSegment(m_inLeftStripPC, m_outLeftStripPC, + lpositionRotated, metricStripPC); + double currentDist = + squaredNorm(lpositionRotated - currentClosest, metricStripPC); if (currentDist < minDist) { minDist = currentDist; - delta = locpo_rotated - currentClosest; + closest = m_rotationStripPC.inverse() * currentClosest; } + } - // 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); + { + Vector2 currentClosest = closestOnSegment( + m_inRightStripPC, m_outRightStripPC, lpositionRotated, metricStripPC); + double currentDist = + squaredNorm(lpositionRotated - currentClosest, metricStripPC); if (currentDist < minDist) { minDist = currentDist; - delta = jacobianStripPCToModulePC.inverse() * - (currentClosest - locpoModulePC); + closest = m_rotationStripPC.inverse() * currentClosest; } + } - currentClosest = closestOnSegment(m_outLeftModulePC, m_outRightModulePC, - locpoModulePC, weightModulePC); - currentDist = squaredNorm(locpoModulePC - currentClosest, weightModulePC); + // now: MODULE system. Need to transform lposition to MODULE PC + // transform is STRIP PC -> STRIP XY -> MODULE XY -> MODULE PC + Vector2 lpositionModulePC = stripPCToModulePC(lpositionRotated); + + // now check edges in MODULE PC (inner and outer circle) + + { + Vector2 currentClosest = closestOnSegment( + m_inLeftModulePC, m_inRightModulePC, lpositionModulePC, metricModulePC); + double currentDist = + squaredNorm(lpositionModulePC - currentClosest, metricModulePC); if (currentDist < minDist) { minDist = currentDist; - delta = jacobianStripPCToModulePC.inverse() * - (currentClosest - locpoModulePC); + closest = m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); } + } - 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; + { + Vector2 currentClosest = + closestOnSegment(m_outLeftModulePC, m_outRightModulePC, + lpositionModulePC, metricModulePC); + double currentDist = + squaredNorm(lpositionModulePC - currentClosest, metricModulePC); + if (currentDist < minDist) { + minDist = currentDist; + closest = m_rotationStripPC.inverse() * modulePCToStripPC(currentClosest); } } - throw std::logic_error("not implemented"); + return closest; } Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const { - Vector2 vecModuleXY = vStripXY + m_shiftXY; - return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)}; + Vector2 vModuleXY = vStripXY + m_shiftXY; + return {vModuleXY.norm(), VectorHelpers::phi(vModuleXY)}; +} + +Vector2 AnnulusBounds::stripPCToModulePC(const Vector2& vStripPC) const { + return stripXYToModulePC({vStripPC[0] * std::cos(vStripPC[1]), + vStripPC[0] * std::sin(vStripPC[1])}); +} + +Vector2 AnnulusBounds::modulePCToStripPC(const Vector2& vModulePC) const { + Vector2 vModuleXY = {vModulePC[0] * std::cos(vModulePC[1]), + vModulePC[0] * std::sin(vModulePC[1])}; + Vector2 vStripXY = vModuleXY - m_shiftXY; + return {vStripXY.norm(), VectorHelpers::phi(vStripXY)}; } Vector2 AnnulusBounds::moduleOrigin() const { diff --git a/Core/src/Surfaces/BoundaryTolerance.cpp b/Core/src/Surfaces/BoundaryTolerance.cpp index 971a026d7de..5bb54cabe41 100644 --- a/Core/src/Surfaces/BoundaryTolerance.cpp +++ b/Core/src/Surfaces/BoundaryTolerance.cpp @@ -60,8 +60,9 @@ bool BoundaryTolerance::hasChi2Bound() const { return holdsVariant(); } -BoundaryTolerance::ToleranceMode BoundaryTolerance::toleranceMode() const { - using enum ToleranceMode; +BoundaryTolerance::Mode BoundaryTolerance::mode() const { + using enum Mode; + if (isInfinite()) { return Extend; } @@ -205,24 +206,4 @@ bool BoundaryTolerance::isTolerated( throw std::logic_error("Unsupported tolerance type"); } -bool BoundaryTolerance::hasMetric(bool hasJacobian) const { - return hasJacobian || hasChi2Bound(); -} - -SquareMatrix2 BoundaryTolerance::getMetric( - const std::optional& jacobianOpt) const { - bool isCartesian = !jacobianOpt.has_value(); - SquareMatrix2 metric = SquareMatrix2::Identity(); - - if (const auto* chi2Bound = getVariantPtr(); - chi2Bound != nullptr) { - metric = chi2Bound->weight; - } else if (!isCartesian) { - const auto& jacobian = *jacobianOpt; - metric = jacobian.transpose() * jacobian; - } - - return metric; -} - } // namespace Acts diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 31f9da55b59..a606d995314 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -8,8 +8,8 @@ #include "Acts/Surfaces/ConeBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Definitions/Tolerance.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/detail/periodic.hpp" #include @@ -72,12 +72,20 @@ Vector2 ConeBounds::shifted(const Vector2& lposition) const { return shifted; } -bool ConeBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +bool ConeBounds::inside(const Vector2& lposition) const { auto rphiHalf = r(lposition[1]) * get(eHalfPhiSector); - return detail::insideAlignedBox( + return detail::VerticesHelper::isInsideRectangle( + shifted(lposition), Vector2(-rphiHalf, get(eMinZ)), + Vector2(rphiHalf, get(eMaxZ))); +} + +Vector2 ConeBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + auto rphiHalf = r(lposition[1]) * get(eHalfPhiSector); + return detail::VerticesHelper::computeClosestPointOnAlignedBox( Vector2(-rphiHalf, get(eMinZ)), Vector2(rphiHalf, get(eMaxZ)), - boundaryTolerance, shifted(lposition), std::nullopt); + shifted(lposition), metric); } std::ostream& ConeBounds::toStream(std::ostream& sl) const { diff --git a/Core/src/Surfaces/ConvexPolygonBounds.cpp b/Core/src/Surfaces/ConvexPolygonBounds.cpp index d48dfaf7030..45116922d64 100644 --- a/Core/src/Surfaces/ConvexPolygonBounds.cpp +++ b/Core/src/Surfaces/ConvexPolygonBounds.cpp @@ -9,8 +9,7 @@ #include "Acts/Surfaces/ConvexPolygonBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -46,11 +45,16 @@ ConvexPolygonBounds::ConvexPolygonBounds( m_boundingBox(makeBoundingBox(vertices)) {} bool ConvexPolygonBounds::inside( + const Vector2& lposition) const { + return detail::VerticesHelper::isInsidePolygon(lposition, m_vertices); +} + +Vector2 ConvexPolygonBounds::closestPoint( const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - return detail::insidePolygon( - std::span(m_vertices.data(), m_vertices.size()), - boundaryTolerance, lposition, std::nullopt); + const std::optional& metric) const { + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, std::span(m_vertices.data(), m_vertices.size()), + metric.value_or(SquareMatrix2::Identity())); } std::vector ConvexPolygonBounds::vertices( diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index ab5fce5e296..c01de5d3a11 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -8,8 +8,6 @@ #include "Acts/Surfaces/CylinderBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -35,17 +33,7 @@ Vector2 CylinderBounds::shifted(const Vector2& lposition) const { lposition[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 CylinderBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +bool CylinderBounds::inside(const Vector2& lposition) const { double bevelMinZ = get(eBevelMinZ); double bevelMaxZ = get(eBevelMaxZ); @@ -53,9 +41,9 @@ bool CylinderBounds::inside(const Vector2& lposition, double halfPhi = get(eHalfPhiSector); if (bevelMinZ == 0. || bevelMaxZ == 0.) { - return detail::insideAlignedBox( - Vector2(-halfPhi, -halfLengthZ), Vector2(halfPhi, halfLengthZ), - boundaryTolerance, shifted(lposition), jacobian()); + return detail::VerticesHelper::isInsideRectangle( + shifted(lposition), Vector2(-halfPhi, -halfLengthZ), + Vector2(halfPhi, halfLengthZ)); } double radius = get(eR); @@ -88,8 +76,28 @@ bool CylinderBounds::inside(const Vector2& lposition, Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, upperRight, middleRight, lowerRight}; - return detail::insidePolygon(vertices, boundaryTolerance, lposition, - jacobian()); + return detail::VerticesHelper::isInsidePolygon(lposition, vertices); +} + +Vector2 CylinderBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + double bevelMinZ = get(eBevelMinZ); + double bevelMaxZ = get(eBevelMaxZ); + double halfLengthZ = get(eHalfLengthZ); + double radius = get(eR); + + Vector2 lowerLeft = {-radius, -halfLengthZ}; + Vector2 middleLeft = {0., -(halfLengthZ + radius * std::tan(bevelMinZ))}; + Vector2 upperLeft = {radius, -halfLengthZ}; + Vector2 upperRight = {radius, halfLengthZ}; + Vector2 middleRight = {0., (halfLengthZ + radius * std::tan(bevelMaxZ))}; + Vector2 lowerRight = {-radius, halfLengthZ}; + Vector2 vertices[] = {lowerLeft, middleLeft, upperLeft, + upperRight, middleRight, lowerRight}; + + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } std::ostream& CylinderBounds::toStream(std::ostream& sl) const { diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index 78ff02c8c4a..4a54411713b 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -9,8 +9,7 @@ #include "Acts/Surfaces/DiamondBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -33,8 +32,7 @@ void DiamondBounds::checkConsistency() noexcept(false) { } } -bool DiamondBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +bool DiamondBounds::inside(const Vector2& lposition) const { // Vertices starting at lower left (min rel. phi) // counter-clockwise double x1 = get(DiamondBounds::eHalfLengthXnegY); @@ -45,8 +43,24 @@ bool DiamondBounds::inside(const Vector2& lposition, double y3 = get(DiamondBounds::eHalfLengthYpos); Vector2 vertices[] = {{-x1, -y1}, {x1, -y1}, {x2, y2}, {x3, y3}, {-x3, y3}, {-x2, y2}}; - return detail::insidePolygon(vertices, boundaryTolerance, lposition, - std::nullopt); + return detail::VerticesHelper::isInsidePolygon(lposition, vertices); +} + +Vector2 DiamondBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + // Vertices starting at lower left (min rel. phi) + // counter-clockwise + double x1 = get(DiamondBounds::eHalfLengthXnegY); + double y1 = get(DiamondBounds::eHalfLengthYneg); + double x2 = get(DiamondBounds::eHalfLengthXzeroY); + double y2 = 0.; + double x3 = get(DiamondBounds::eHalfLengthXposY); + double y3 = get(DiamondBounds::eHalfLengthYpos); + Vector2 vertices[] = {{-x1, -y1}, {x1, -y1}, {x2, y2}, + {x3, y3}, {-x3, y3}, {-x2, y2}}; + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } std::vector DiamondBounds::vertices( diff --git a/Core/src/Surfaces/DiscTrapezoidBounds.cpp b/Core/src/Surfaces/DiscTrapezoidBounds.cpp index d96b2ea645e..7444e475dfa 100644 --- a/Core/src/Surfaces/DiscTrapezoidBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidBounds.cpp @@ -9,8 +9,7 @@ #include "Acts/Surfaces/DiscTrapezoidBounds.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/detail/periodic.hpp" #include @@ -52,26 +51,45 @@ Vector2 DiscTrapezoidBounds::toLocalCartesian(const Vector2& lposition) const { lposition[0] * std::cos(lposition[1] - get(eAveragePhi))}; } -SquareMatrix2 DiscTrapezoidBounds::jacobianToLocalCartesian( +SquareMatrix2 DiscTrapezoidBounds::boundToCartesianJacobian( 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; + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = -lposition[0] * std::sin(lposition[1]); + j(1, 0) = std::sin(lposition[1]); + j(1, 1) = lposition[0] * std::cos(lposition[1]); + return j; } -bool DiscTrapezoidBounds::inside( +SquareMatrix2 DiscTrapezoidBounds::boundToCartesianMetric( + const Vector2& lposition) const { + SquareMatrix2 m; + m(0, 0) = 1; + m(0, 1) = 0; + m(1, 0) = 0; + m(1, 1) = lposition[0] * lposition[0]; + return m; +} + +bool DiscTrapezoidBounds::inside(const Vector2& lposition) const { + Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, + {get(eHalfLengthXmaxR), m_ymax}, + {-get(eHalfLengthXmaxR), m_ymax}, + {-get(eHalfLengthXminR), get(eMinR)}}; + return detail::VerticesHelper::isInsidePolygon(toLocalCartesian(lposition), + vertices); +} + +Vector2 DiscTrapezoidBounds::closestPoint( const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { + const std::optional& metric) const { Vector2 vertices[] = {{get(eHalfLengthXminR), get(eMinR)}, {get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXmaxR), m_ymax}, {-get(eHalfLengthXminR), get(eMinR)}}; - auto jacobian = jacobianToLocalCartesian(lposition); - return detail::insidePolygon(vertices, boundaryTolerance, - toLocalCartesian(lposition), jacobian); + return detail::VerticesHelper::computeClosestPointOnPolygon( + toLocalCartesian(lposition), vertices, + metric.value_or(SquareMatrix2::Identity())); } std::vector DiscTrapezoidBounds::vertices( diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index 531e1ce7d28..f257214299c 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -8,7 +8,6 @@ #include "Acts/Surfaces/EllipseBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/MathHelpers.hpp" #include "Acts/Utilities/VectorHelpers.hpp" @@ -44,31 +43,20 @@ void EllipseBounds::checkConsistency() noexcept(false) { } } -bool EllipseBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - if (boundaryTolerance.isInfinite()) { - return true; - } - - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(); - absoluteBound.has_value()) { - double tol0 = absoluteBound->tolerance0; - double tol1 = absoluteBound->tolerance1; - - double phi = - detail::radian_sym(VectorHelpers::phi(lposition) - get(eAveragePhi)); - double phiHalf = get(eHalfPhiSector) + tol1; - - bool insidePhi = (-phiHalf <= phi) && (phi < phiHalf); - bool insideInner = (get(eInnerRx) <= tol0) || (get(eOuterRx) <= tol0) || - (1 < (square(lposition[0] / (get(eInnerRx) - tol0)) + - square(lposition[1] / (get(eOuterRx) - tol0)))); - bool insideOuter = (square(lposition[0] / (get(eInnerRy) + tol0)) + - square(lposition[1] / (get(eOuterRy) + tol0))) < 1; - return insidePhi && insideInner && insideOuter; - } +bool EllipseBounds::inside(const Vector2& lposition) const { + double phi = + detail::radian_sym(VectorHelpers::phi(lposition) - get(eAveragePhi)); + return (-get(eHalfPhiSector) <= phi) && (phi < get(eHalfPhiSector)) && + (square(lposition[eBoundLoc0] / get(eInnerRx)) + + square(lposition[eBoundLoc1] / get(eInnerRy))) >= 1 && + (square(lposition[eBoundLoc0] / get(eOuterRx)) + + square(lposition[eBoundLoc1] / get(eOuterRy))) < 1; +} - throw std::logic_error("Unsupported boundary check type"); +Vector2 EllipseBounds::closestPoint( + const Vector2& /*lposition*/, + const std::optional& /*metric*/) const { + throw std::logic_error("Not implemented"); } std::vector EllipseBounds::vertices( diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index 9511722d002..8369cb1af1d 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -8,8 +8,7 @@ #include "Acts/Surfaces/LineBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -29,13 +28,20 @@ void LineBounds::checkConsistency() noexcept(false) { } } -bool LineBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { +bool LineBounds::inside(const Vector2& lposition) const { double r = get(LineBounds::eR); double halfLengthZ = get(LineBounds::eHalfLengthZ); - return detail::insideAlignedBox(Vector2(-r, -halfLengthZ), - Vector2(r, halfLengthZ), boundaryTolerance, - lposition, std::nullopt); + return detail::VerticesHelper::isInsideRectangle( + lposition, Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ)); +} + +Vector2 LineBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + double r = get(LineBounds::eR); + double halfLengthZ = get(LineBounds::eHalfLengthZ); + return detail::VerticesHelper::computeClosestPointOnAlignedBox( + Vector2(-r, -halfLengthZ), Vector2(r, halfLengthZ), lposition, metric); } std::ostream& LineBounds::toStream(std::ostream& sl) const { diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 41bd184be9a..9e0cc8251ce 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -8,8 +8,6 @@ #include "Acts/Surfaces/RadialBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include "Acts/Surfaces/detail/VerticesHelper.hpp" #include "Acts/Utilities/detail/periodic.hpp" @@ -35,6 +33,26 @@ void RadialBounds::checkConsistency() noexcept(false) { } } +SquareMatrix2 RadialBounds::boundToCartesianJacobian( + const Vector2& lposition) const { + SquareMatrix2 j; + j(0, 0) = std::cos(lposition[1]); + j(0, 1) = -lposition[0] * std::sin(lposition[1]); + j(1, 0) = std::sin(lposition[1]); + j(1, 1) = lposition[0] * std::cos(lposition[1]); + return j; +} + +SquareMatrix2 RadialBounds::boundToCartesianMetric( + const Vector2& lposition) const { + SquareMatrix2 m; + m(0, 0) = 1; + m(0, 1) = 0; + m(1, 0) = 0; + m(1, 1) = lposition[0] * lposition[0]; + return m; +} + Vector2 RadialBounds::shifted(const Vector2& lposition) const { Vector2 tmp; tmp[0] = lposition[0]; @@ -42,12 +60,18 @@ Vector2 RadialBounds::shifted(const Vector2& lposition) const { return tmp; } -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); +bool RadialBounds::inside(const Vector2& lposition) const { + return detail::VerticesHelper::isInsideRectangle( + shifted(lposition), Vector2(get(eMinR), -get(eHalfPhiSector)), + Vector2(get(eMaxR), get(eHalfPhiSector))); +} + +Vector2 RadialBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + return detail::VerticesHelper::computeClosestPointOnAlignedBox( + Vector2(get(eMinR), -get(eHalfPhiSector)), + Vector2(get(eMaxR), get(eHalfPhiSector)), shifted(lposition), metric); } std::vector RadialBounds::vertices(unsigned int lseg) const { diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index 98bdedd930d..da9b81e66f2 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -8,7 +8,8 @@ #include "Acts/Surfaces/RectangleBounds.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Definitions/Algebra.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include @@ -32,6 +33,10 @@ double RectangleBounds::get(BoundValues bValue) const { } } +std::vector RectangleBounds::values() const { + return {m_min.x(), m_min.y(), m_max.x(), m_max.y()}; +} + void RectangleBounds::checkConsistency() noexcept(false) { if (get(eMinX) > get(eMaxX)) { throw std::invalid_argument("RectangleBounds: invalid local x setup"); @@ -41,10 +46,24 @@ void RectangleBounds::checkConsistency() noexcept(false) { } } -bool RectangleBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - return detail::insideAlignedBox(m_min, m_max, boundaryTolerance, lposition, - std::nullopt); +bool RectangleBounds::inside(const Vector2& lposition) const { + return detail::VerticesHelper::isInsideRectangle(lposition, m_min, m_max); +} + +Vector2 RectangleBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + // If no metric is provided we can use a shortcut for the rectangle + if (!metric.has_value()) { + return detail::VerticesHelper::computeEuclideanClosestPointOnRectangle( + lposition, m_min, m_max); + } + + // Otherwise we need to compute the closest point on the polygon + std::array vertices = { + {m_min, {m_max[0], m_min[1]}, m_max, {m_min[0], m_max[1]}}}; + return detail::VerticesHelper::computeClosestPointOnPolygon( + lposition, vertices, metric.value_or(SquareMatrix2::Identity())); } std::vector RectangleBounds::vertices(unsigned int /*lseg*/) const { diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 5394587eeae..40d770304bf 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -246,6 +246,16 @@ const Transform3& Surface::transform(const GeometryContext& gctx) const { return *m_transform; } +Vector2 Surface::closestPointOnBounds( + const Vector2& lposition, + const std::optional& metric) const { + return bounds().closestPoint(lposition, metric); +} + +double Surface::distanceToBounds(const Vector2& lposition) const { + return bounds().distance(lposition); +} + bool Surface::insideBounds(const Vector2& lposition, const BoundaryTolerance& boundaryTolerance) const { return bounds().inside(lposition, boundaryTolerance); diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 73b082cefec..0ca5b53a57e 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -8,9 +8,7 @@ #include "Acts/Surfaces/TrapezoidBounds.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/ConvexPolygonBounds.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" #include #include @@ -39,12 +37,7 @@ std::vector TrapezoidBounds::values() const { return {m_values.begin(), m_values.end()}; } -bool TrapezoidBounds::inside(const Vector2& lposition, - const BoundaryTolerance& boundaryTolerance) const { - if (boundaryTolerance.isInfinite()) { - return true; - } - +bool TrapezoidBounds::inside(const Vector2& lposition) const { const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); const double hlY = get(TrapezoidBounds::eHalfLengthY); @@ -54,33 +47,45 @@ bool TrapezoidBounds::inside(const Vector2& lposition, const double x = extPosition[0]; const double y = extPosition[1]; - if (auto absoluteBound = boundaryTolerance.asAbsoluteBoundOpt(true); - absoluteBound.has_value()) { - double tolX = absoluteBound->tolerance0; - double tolY = absoluteBound->tolerance1; - - if (std::abs(y) - hlY > tolY) { - // outside y range - return false; - } - - if (std::abs(x) - std::max(hlXnY, hlXpY) > tolX) { - // outside x range - return false; - } - - if (std::abs(x) - std::min(hlXnY, hlXpY) <= tolX) { - // inside x range - return true; - } + if (std::abs(y) - hlY > 0) { + // outside y range + return false; + } + + if (std::abs(x) - std::max(hlXnY, hlXpY) > 0) { + // outside x range + return false; + } + + if (std::abs(x) - std::min(hlXnY, hlXpY) <= 0) { + // inside x range + return true; } // at this stage, the point can only be in the triangles // run slow-ish polygon check Vector2 vertices[] = { {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; - return detail::insidePolygon(vertices, boundaryTolerance, extPosition, - std::nullopt); + return detail::VerticesHelper::isInsidePolygon(extPosition, vertices); +} + +Vector2 TrapezoidBounds::closestPoint( + const Vector2& lposition, + const std::optional& metric) const { + const double hlXnY = get(TrapezoidBounds::eHalfLengthXnegY); + const double hlXpY = get(TrapezoidBounds::eHalfLengthXposY); + const double hlY = get(TrapezoidBounds::eHalfLengthY); + const double rotAngle = get(TrapezoidBounds::eRotationAngle); + + const Vector2 extPosition = Eigen::Rotation2Dd(rotAngle) * lposition; + + Vector2 vertices[] = { + {-hlXnY, -hlY}, {hlXnY, -hlY}, {hlXpY, hlY}, {-hlXpY, hlY}}; + + Vector2 extClosest = detail::VerticesHelper::computeClosestPointOnPolygon( + extPosition, vertices, metric.value_or(SquareMatrix2::Identity())); + + return Eigen::Rotation2Dd(-rotAngle) * extClosest; } std::vector TrapezoidBounds::vertices( diff --git a/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp b/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp index f18a32070be..2c1c384cc65 100644 --- a/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp +++ b/Tests/Benchmarks/BoundaryToleranceBenchmark.cpp @@ -7,16 +7,12 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Units.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/ConvexPolygonBounds.hpp" #include "Acts/Tests/CommonHelpers/BenchmarkTools.hpp" #include -#include -#include #include -#include #include #include @@ -26,7 +22,8 @@ int main(int /*argc*/, char** /*argv[]*/) { // === PROBLEM DATA === // Trapezoidal area of interest - const Vector2 poly[] = {{0.4, 0.25}, {0.6, 0.25}, {0.8, 0.75}, {0.2, 0.75}}; + ConvexPolygonBounds poly( + {{0.4, 0.25}, {0.6, 0.25}, {0.8, 0.75}, {0.2, 0.75}}); // Covariance matrix which specifies "soft" boundary check tolerance SquareMatrix2 cov; @@ -107,35 +104,21 @@ int main(int /*argc*/, char** /*argv[]*/) { default: // do nothing break; }; - run_bench( - [&] { - return detail::insidePolygon(poly, check, center, std::nullopt); - }, - num_inside_points, "Center"); - run_bench( - [&] { - return detail::insidePolygon(poly, check, edge_inside, std::nullopt); - }, - num_inside_points, "Inside edge"); - run_bench( - [&] { - return detail::insidePolygon(poly, check, edge_outside, std::nullopt); - }, - num_outside_points, "Outside edge"); - run_bench( - [&] { - return detail::insidePolygon(poly, check, far_away, std::nullopt); - }, - num_outside_points, "Far away"); + run_bench([&] { return poly.inside(center, check); }, num_inside_points, + "Center"); + run_bench([&] { return poly.inside(edge_inside, check); }, + num_inside_points, "Inside edge"); + run_bench([&] { return poly.inside(edge_outside, check); }, + num_outside_points, "Outside edge"); + run_bench([&] { return poly.inside(far_away, check); }, num_outside_points, + "Far away"); // Pre-rolled random points std::vector points(num_outside_points); std::generate(points.begin(), points.end(), random_point); run_bench_with_inputs( - [&](const auto& point) { - return detail::insidePolygon(poly, check, point, std::nullopt); - }, - points, "Random"); + [&](const auto& point) { return poly.inside(point, check); }, points, + "Random"); }; // Benchmark scenarios diff --git a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp index e80035a10a8..365bdb73612 100644 --- a/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/BoundaryToleranceTests.cpp @@ -11,28 +11,21 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" -#include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include "Acts/Utilities/Helpers.hpp" +#include "Acts/Surfaces/ConvexPolygonBounds.hpp" +#include "Acts/Surfaces/PlanarBounds.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; + using enum BoundaryTolerance::Mode; { // Test None constructor BoundaryTolerance tolerance = BoundaryTolerance::None(); - BOOST_CHECK(tolerance.toleranceMode() == None); + BOOST_CHECK(tolerance.mode() == None); } // Test AbsoluteBound constructor @@ -41,9 +34,10 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { auto tolerance = BoundaryTolerance::AbsoluteBound(1.0, 2.0); BOOST_CHECK_EQUAL(tolerance.tolerance0, 1.0); BOOST_CHECK_EQUAL(tolerance.tolerance1, 2.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); - BOOST_CHECK(BoundaryTolerance{BoundaryTolerance::AbsoluteBound(0.0, 0.0)} - .toleranceMode() == None); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); + BOOST_CHECK( + BoundaryTolerance{BoundaryTolerance::AbsoluteBound(0.0, 0.0)}.mode() == + None); // Negative tolerances should throw BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteBound(-1.0, 2.0), @@ -57,14 +51,15 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { // Valid positive tolerance auto tolerance = BoundaryTolerance::AbsoluteEuclidean(1.0); BOOST_CHECK_EQUAL(tolerance.tolerance, 1.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); - BOOST_CHECK(BoundaryTolerance{BoundaryTolerance::AbsoluteEuclidean(0.0)} - .toleranceMode() == None); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); + BOOST_CHECK( + BoundaryTolerance{BoundaryTolerance::AbsoluteEuclidean(0.0)}.mode() == + None); // Valid negative tolerance tolerance = BoundaryTolerance::AbsoluteEuclidean(-1.0); BOOST_CHECK_EQUAL(tolerance.tolerance, -1.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Shrink); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Shrink); } // Test AbsoluteCartesian constructor @@ -73,10 +68,10 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { auto tolerance = BoundaryTolerance::AbsoluteCartesian(1.0, 2.0); BOOST_CHECK_EQUAL(tolerance.tolerance0, 1.0); BOOST_CHECK_EQUAL(tolerance.tolerance1, 2.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); BOOST_CHECK( BoundaryTolerance{BoundaryTolerance::AbsoluteCartesian(0.0, 0.0)} - .toleranceMode() == None); + .mode() == None); // Negative tolerances should throw BOOST_CHECK_THROW(BoundaryTolerance::AbsoluteCartesian(-1.0, 2.0), @@ -93,14 +88,15 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { // Valid positive chi2 bound auto tolerance = BoundaryTolerance::Chi2Bound(cov, 3.0); BOOST_CHECK_EQUAL(tolerance.maxChi2, 3.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Extend); - BOOST_CHECK(BoundaryTolerance{BoundaryTolerance::Chi2Bound(cov, 0.0)} - .toleranceMode() == None); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Extend); + BOOST_CHECK( + BoundaryTolerance{BoundaryTolerance::Chi2Bound(cov, 0.0)}.mode() == + None); // Valid negative chi2 bound tolerance = BoundaryTolerance::Chi2Bound(cov, -3.0); BOOST_CHECK_EQUAL(tolerance.maxChi2, -3.0); - BOOST_CHECK(BoundaryTolerance{tolerance}.toleranceMode() == Shrink); + BOOST_CHECK(BoundaryTolerance{tolerance}.mode() == Shrink); } // Test None constructor @@ -113,15 +109,12 @@ BOOST_AUTO_TEST_CASE(BoundaryToleranceConstructors) { BOOST_AUTO_TEST_CASE(BoundaryCheckBoxSimple) { Vector2 ll(-1, -1); Vector2 ur(1, 1); + RectangleBounds bounds(ll, ur); auto tolerance = BoundaryTolerance::None(); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } // Aligned box w/ tolerance check along first axis @@ -132,18 +125,14 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckBoxToleranceLoc0) { em.execute([]() { Vector2 ll(-1, -1); Vector2 ur(1, 1); - auto tolerance = BoundaryTolerance::AbsoluteBound( + RectangleBounds bounds(ll, ur); + BoundaryTolerance::AbsoluteBound tolerance( 1.5, std::numeric_limits::infinity()); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {4, 4}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({4, 4}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); return 0; }); @@ -155,134 +144,97 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckBoxCovariance) { cov << 1, 0.5, 0.5, 2; Vector2 ll(-1, -1); Vector2 ur(1, 1); + RectangleBounds bounds(ll, ur); auto tolerance = BoundaryTolerance::Chi2Bound(cov.inverse(), 3.); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {4, 4}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 3}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {3, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({4, 4}, tolerance)); + BOOST_CHECK(bounds.inside({0, 3}, tolerance)); + BOOST_CHECK(bounds.inside({3, 0}, tolerance)); } // Triangle w/ simple check BOOST_AUTO_TEST_CASE(BoundaryCheckTriangleSimple) { - Vector2 vertices[] = {{-2, 0}, {2, 0}, {0, 2}}; + ConvexPolygonBounds poly({{-2, 0}, {2, 0}, {0, 2}}); auto tolerance = BoundaryTolerance::None(); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 1}, std::nullopt)); - BOOST_CHECK( - !detail::insidePolygon(vertices, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insidePolygon(vertices, tolerance, {0, -1}, std::nullopt)); + BOOST_CHECK(poly.inside({0, 0}, tolerance)); + BOOST_CHECK(poly.inside({0, 1}, tolerance)); + BOOST_CHECK(!poly.inside({2, 2}, tolerance)); + BOOST_CHECK(!poly.inside({0, -1}, tolerance)); } // Triangle w/ covariance check BOOST_AUTO_TEST_CASE(BoundaryCheckTriangleCovariance) { - Vector2 vertices[] = {{-2, 0}, {2, 0}, {0, 2}}; + ConvexPolygonBounds poly({{-2, 0}, {2, 0}, {0, 2}}); SquareMatrix2 cov; cov << 0.5, 0, 0, 0.5; auto tolerance = BoundaryTolerance::Chi2Bound(cov.inverse(), 4.1); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 1}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 3}, std::nullopt)); - BOOST_CHECK(detail::insidePolygon(vertices, tolerance, {0, 4}, std::nullopt)); - BOOST_CHECK( - !detail::insidePolygon(vertices, tolerance, {0, 5}, std::nullopt)); + BOOST_CHECK(poly.inside({0, 0}, tolerance)); + BOOST_CHECK(poly.inside({0, 1}, tolerance)); + BOOST_CHECK(poly.inside({0, 2}, tolerance)); + BOOST_CHECK(poly.inside({0, 3}, tolerance)); + BOOST_CHECK(poly.inside({0, 4}, tolerance)); + BOOST_CHECK(!poly.inside({0, 5}, tolerance)); } BOOST_AUTO_TEST_CASE(BoundaryCheckDifferentTolerances) { Vector2 ll(-1, -1); Vector2 ur(1, 1); + RectangleBounds bounds(ll, ur); { auto tolerance = BoundaryTolerance::None(); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::Infinite(); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::AbsoluteBound(0.5, 0.5); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({0, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::AbsoluteCartesian(0.5, 0.5); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 1.1}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {1.1, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({0, 1.1}, tolerance)); + BOOST_CHECK(bounds.inside({1.1, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::AbsoluteEuclidean(1.1); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); } { auto tolerance = BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 1.); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 0}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {0, 2}, std::nullopt)); - BOOST_CHECK( - detail::insideAlignedBox(ll, ur, tolerance, {2, 0}, std::nullopt)); - BOOST_CHECK( - !detail::insideAlignedBox(ll, ur, tolerance, {3, 3}, std::nullopt)); + BOOST_CHECK(bounds.inside({0, 0}, tolerance)); + BOOST_CHECK(bounds.inside({2, 2}, tolerance)); + BOOST_CHECK(bounds.inside({0, 2}, tolerance)); + BOOST_CHECK(bounds.inside({2, 0}, tolerance)); + BOOST_CHECK(!bounds.inside({3, 3}, tolerance)); } } @@ -290,10 +242,11 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckNegativeToleranceRect) { // Test points for boundary check with euclidean tolerance Vector2 ll(1, 1); Vector2 ur(3, 3); + RectangleBounds bounds(ll, ur); - auto check = [&ll, &ur](const BoundaryTolerance& tolerance, - const Vector2& point) { - return detail::insideAlignedBox(ll, ur, tolerance, point, std::nullopt); + auto check = [&bounds](const BoundaryTolerance& tolerance, + const Vector2& point) { + return bounds.inside(point, tolerance); }; { @@ -335,11 +288,12 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckNegativeToleranceRect) { } BOOST_AUTO_TEST_CASE(BoundaryCheckNegativeToleranceTrap) { - Vector2 vertices[] = {{1.5, 1}, {2.5, 1}, {3, 3}, {1, 3}}; + ConvexPolygonBounds bounds( + {{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 check = [&bounds](const BoundaryTolerance& tolerance, + const Vector2& point) { + return bounds.inside(point, tolerance); }; { diff --git a/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp b/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp index 56bec3caaa8..363652bb02d 100644 --- a/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/BoundsRegressionTests.cpp @@ -752,7 +752,7 @@ BOOST_AUTO_TEST_CASE(Rectangle) { parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteBound(1, 0)") { + BOOST_TEST_CONTEXT("AbsoluteBound(1, 0.01)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -836,12 +836,12 @@ BOOST_AUTO_TEST_CASE(Rectangle) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0.01); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 1)") { + BOOST_TEST_CONTEXT("AbsoluteBound(0.01, 0.1)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -925,7 +925,7 @@ BOOST_AUTO_TEST_CASE(Rectangle) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0.01, 0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } @@ -1749,43 +1749,44 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .........................................XXXXXXXXXXXXX.......................... ......................................XXXXXXXXXXXXXXXX.......................... ...................................XXXXXXXXXXXXXXXXXXX.......................... -................................XXXXXXXXXXXXXXXXXXXXXX.......................... +................................XXXXXXXXXXXXXXXXXXXXXXX......................... ............................XXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... @@ -1795,15 +1796,14 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. @@ -1827,7 +1827,7 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteBound(1, 0)") { + BOOST_TEST_CONTEXT("AbsoluteBound(1, 0.01)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -1838,19 +1838,19 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ ................................................................................ ................................................................................ -......................................................X......................... -...................................................XXXX......................... -................................................XXXXXXX......................... +................................................................................ +...................................................XXX.......................... +...............................................XXXXXXX.......................... ............................................XXXXXXXXXXX......................... .........................................XXXXXXXXXXXXXX......................... ......................................XXXXXXXXXXXXXXXXXX........................ -...................................XXXXXXXXXXXXXXXXXXXXX........................ +..................................XXXXXXXXXXXXXXXXXXXXXX........................ ...............................XXXXXXXXXXXXXXXXXXXXXXXXX........................ ............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... @@ -1882,23 +1882,23 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... -............XXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... ............XXXXXXXXXXXXXXXXXXXXXXX............................................. ...........XXXXXXXXXXXXXXXXXXXXX................................................ ...........XXXXXXXXXXXXXXXXXX................................................... -...........XXXXXXXXXXXXXX....................................................... +...........XXXXXXXXXXXXXXX...................................................... ...........XXXXXXXXXXX.......................................................... ..........XXXXXXXXX............................................................. ..........XXXXXX................................................................ -..........XX.................................................................... +..........XXX................................................................... ................................................................................ ................................................................................ ................................................................................ @@ -1911,12 +1911,12 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0.01); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } - BOOST_TEST_CONTEXT("AbsoluteBound(0, 0.1)") { + BOOST_TEST_CONTEXT("AbsoluteBound(0, 0)") { std::string reference = R"X( ................................................................................ ................................................................................ @@ -1927,16 +1927,16 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ ................................................................................ ................................................................................ -.....................................................X.......................... -.................................................XXXXX.......................... -..............................................XXXXXXXX.......................... -...........................................XXXXXXXXXXXX......................... -........................................XXXXXXXXXXXXXXX......................... -....................................XXXXXXXXXXXXXXXXXXXX........................ -.................................XXXXXXXXXXXXXXXXXXXXXXX........................ -..............................XXXXXXXXXXXXXXXXXXXXXXXXXX........................ -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +................................................................................ +...................................................XXX.......................... +................................................XXXXXX.......................... +............................................XXXXXXXXXXX......................... +.........................................XXXXXXXXXXXXXX......................... +......................................XXXXXXXXXXXXXXXXXX........................ +...................................XXXXXXXXXXXXXXXXXXXXX........................ +...............................XXXXXXXXXXXXXXXXXXXXXXXXX........................ +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... @@ -1970,25 +1970,25 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXX........................................ -............XXXXXXXXXXXXXXXXXXXXXXXXX........................................... -...........XXXXXXXXXXXXXXXXXXXXXX............................................... -...........XXXXXXXXXXXXXXXXXXX.................................................. -...........XXXXXXXXXXXXXXXX..................................................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... +............XXXXXXXXXXXXXXXXXXXXXXX............................................. +...........XXXXXXXXXXXXXXXXXXXXX................................................ +...........XXXXXXXXXXXXXXXXXX................................................... +...........XXXXXXXXXXXXXX....................................................... ...........XXXXXXXXXXX.......................................................... ..........XXXXXXXXX............................................................. ..........XXXXXX................................................................ -..........XXX................................................................... -..........X..................................................................... +..........XX.................................................................... +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -2000,7 +2000,7 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } @@ -2008,55 +2008,56 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { BOOST_TEST_CONTEXT("AbsoluteCartesian(1, 1.2)") { std::string reference = R"X( ................................................................................ -.....................................................XXX........................ +.....................................................XXXX....................... ..................................................XXXXXXX....................... -...............................................XXXXXXXXXX....................... -...........................................XXXXXXXXXXXXXX....................... +..............................................XXXXXXXXXXX....................... +...........................................XXXXXXXXXXXXXXX...................... ........................................XXXXXXXXXXXXXXXXXX...................... -.....................................XXXXXXXXXXXXXXXXXXXXX...................... -..................................XXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................................XXXXXXXXXXXXXXXXXXXXXX..................... +.................................XXXXXXXXXXXXXXXXXXXXXXXXXX..................... ..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... @@ -2065,13 +2066,12 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... @@ -2082,10 +2082,10 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .....XXXXXXXXXXXXXXXXXXXXXXX.................................................... .....XXXXXXXXXXXXXXXXXXXX....................................................... .....XXXXXXXXXXXXXXXXX.......................................................... -......XXXXXXXXXXXXX............................................................. -......XXXXXXXXX................................................................. -......XXXXXX.................................................................... -......XXX....................................................................... +.....XXXXXXXXXXXXXX............................................................. +.....XXXXXXXXXX................................................................. +.....XXXXXXX.................................................................... +.....XXXX....................................................................... ................................................................................ )X"; @@ -2103,21 +2103,21 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ................................................................................ ................................................................................ ................................................................................ -.....................................................XXX........................ -..................................................XXXXXXX....................... -...............................................XXXXXXXXXX....................... -............................................XXXXXXXXXXXXX....................... +.....................................................XX......................... +..................................................XXXXX......................... +...............................................XXXXXXXXX........................ +............................................XXXXXXXXXXXX........................ ........................................XXXXXXXXXXXXXXXXX....................... .....................................XXXXXXXXXXXXXXXXXXXX....................... ..................................XXXXXXXXXXXXXXXXXXXXXXX....................... ...............................XXXXXXXXXXXXXXXXXXXXXXXXXXX...................... ...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... ........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. @@ -2156,7 +2156,7 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... @@ -2187,21 +2187,21 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { std::string reference = R"X( ................................................................................ ................................................................................ -.....................................................XX......................... -..................................................XXXXX......................... -...............................................XXXXXXXX......................... -...........................................XXXXXXXXXXXX......................... -........................................XXXXXXXXXXXXXXX......................... -.....................................XXXXXXXXXXXXXXXXXX......................... -..................................XXXXXXXXXXXXXXXXXXXXX......................... -..............................XXXXXXXXXXXXXXXXXXXXXXXXXX........................ -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ +....................................................XXX......................... +.................................................XXXXXX......................... +.............................................XXXXXXXXXXX........................ +..........................................XXXXXXXXXXXXXX........................ +.......................................XXXXXXXXXXXXXXXXXX....................... +....................................XXXXXXXXXXXXXXXXXXXXX....................... +................................XXXXXXXXXXXXXXXXXXXXXXXXX....................... +.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... @@ -2238,31 +2238,31 @@ BOOST_AUTO_TEST_CASE(Trapezoid) { .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... -........XXXXXXXXXXXXXXXXXXXXXXXXXXX............................................. -........XXXXXXXXXXXXXXXXXXXXXXX................................................. -.......XXXXXXXXXXXXXXXXXXXXX.................................................... -.......XXXXXXXXXXXXXXXXXX....................................................... -.......XXXXXXXXXXXXXXX.......................................................... -.......XXXXXXXXXXXX............................................................. -.......XXXXXXXX................................................................. -.......XXXXX.................................................................... -.......XX....................................................................... +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXX............................................ +.........XXXXXXXXXXXXXXXXXXXXXXXX............................................... +.........XXXXXXXXXXXXXXXXXXXXX.................................................. +........XXXXXXXXXXXXXXXXXX...................................................... +........XXXXXXXXXXXXXXX......................................................... +........XXXXXXXXXXXX............................................................ +........XXXXXXXXX............................................................... +.......XXXXXX................................................................... +.......XXX...................................................................... +................................................................................ +................................................................................ +................................................................................ +................................................................................ +................................................................................ ................................................................................ ................................................................................ )X"; @@ -2476,8 +2476,8 @@ BOOST_AUTO_TEST_CASE(Annulus) { ................................................................................ ................................................................................ ................................................................................ -...................................XXX.......................................... -................................XXXXXXXXX....................................... +...................................XXXX......................................... +.................................XXXXXXXX....................................... ...............................XXXXXXXXXXX...................................... ..............................XXXXXXXXXXXXX..................................... ..............................XXXXXXXXXXXXXXX................................... @@ -2497,7 +2497,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { ..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ @@ -2508,7 +2508,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. @@ -2520,7 +2520,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... @@ -2586,7 +2586,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { .................................XXXXXXXXXXXXXXXXX.............................. ................................XXXXXXXXXXXXXXXXXXX............................. ...............................XXXXXXXXXXXXXXXXXXXXXX........................... -..............................XXXXXXXXXXXXXXXXXXXXXXXX.......................... +.............................XXXXXXXXXXXXXXXXXXXXXXXXX.......................... ............................XXXXXXXXXXXXXXXXXXXXXXXXXXX......................... ...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... @@ -2662,51 +2662,51 @@ BOOST_AUTO_TEST_CASE(Annulus) { ................................................................................ ................................................................................ ................................................................................ -.....................................X.......................................... -....................................XX.XX....................................... -....................................XXXXXXX..................................... -....................................XXXXXXXX.................................... -...................................XXXXXXXXXXX.................................. -..................................XXXXXXXXXXXXXX................................ -..................................XXXXXXXXXXXXXXXX.............................. -.................................XXXXXXXXXXXXXXXXXX............................. -................................XXXXXXXXXXXXXXXXXXXXX........................... -................................XXXXXXXXXXXXXXXXXXXXXXX......................... -...............................XXXXXXXXXXXXXXXXXXXXXXXXX........................ -..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXX................................... -..................XXXXXXXXXXXXXXXXXXXXXXXXX..................................... -..................XXXXXXXXXXXXXXXXXXXXXXXX...................................... -..................XXXXXXXXXXXXXXXXXXXXXX........................................ -...................XXXXXXXXXXXXXXXXXXX.......................................... -...................XXXXXXXXXXXXXXXXX............................................ -...................XXXXXXXXXXXXXXX.............................................. -...................XXXXXXXXXXXX................................................. -...................XXXXXXXXXX................................................... -.......................XXX...................................................... +......................................XXXX...................................... +....................................XXXXX....................................... +...................................XXXXXX....................................... +..................................XXXXXXXX...................................... +...................................XXXXXXXX..................................... +..................................XXXXXXXXXXX................................... +................................XXXXXXXXXXXXXX.................................. +................................XXXXXXXXXXXXXXX................................. +...............................XXXXXXXXXXXXXXXXXX............................... +..............................XXXXXXXXXXXXXXXXXXXX.............................. +.............................XXXXXXXXXXXXXXXXXXXXXXX............................ +............................XXXXXXXXXXXXXXXXXXXXXXXXX........................... +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.........X.............. +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......XX.............. +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....XXX.............. +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXX............... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +................XXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +................XXXXXXXXXXXXXXXXXXXXXXXXX....................................... +................XXXXXXXXXXXXXXXXXXXXXXX......................................... +................XXXXXXXXXXXXXXXXXXXXX........................................... +................XXXXXXXXXXXXXXXXXX.............................................. +................XXXXXXXXXXXXXXXXX............................................... +................XXXXXXXXXXXXX................................................... ................................................................................ ................................................................................ ................................................................................ @@ -2728,7 +2728,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { )X"; BoundaryTolerance tolerance = - BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), 0.1); + BoundaryTolerance::Chi2Bound(Vector2(1, 10).asDiagonal(), 0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.5), parseMatrix(reference))); } @@ -2748,59 +2748,59 @@ BOOST_AUTO_TEST_CASE(Annulus) { ................................................................................ ................................................................................ ................................................................................ -................................................................................ -...................................X............................................ -..................................XXX........................................... -..................................XXXX.......................................... -.................................XXXXXX......................................... -................................XXXXXXXX........................................ -...............................XXXXXXXXXXX...................................... -...............................XXXXXXXXXXXX..................................... -..............................XXXXXXXXXXXXXX.................................... -.............................XXXXXXXXXXXXXXXX................................... -............................XXXXXXXXXXXXXXXXXX.................................. -...........................XXXXXXXXXXXXXXXXXXXX................................. -..........................XXXXXXXXXXXXXXXXXXXXXX................................ -.........................XXXXXXXXXXXXXXXXXXXXXXXXX.............................. -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +....................................XX.......................................... +....................................XXX......................................... +....................................XXXX........................................ +....................................XXXXXX...................................... +....................................XXXXXXX..................................... +...................................XXXXXXXXX.................................... +..................................XXXXXXXXXXXX.................................. +..................................XXXXXXXXXXXXX................................. +.................................XXXXXXXXXXXXXXXX............................... +................................XXXXXXXXXXXXXXXXXX.............................. +...............................XXXXXXXXXXXXXXXXXXXX............................. +..............................XXXXXXXXXXXXXXXXXXXXXXX........................... +.............................XXXXXXXXXXXXXXXXXXXXXXXXX.......................... +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ .................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -........................XXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -........................XXXXXXXXXXXXXXXXXXXXXXXX................................ -.........................XXXXXXXXXXXXXXXXXXXXXX................................. -.........................XXXXXXXXXXXXXXXXXXXXX.................................. -..........................XXXXXXXXXXXXXXXXXX.................................... -..........................XXXXXXXXXXXXXXXXX..................................... -..........................XXXXXXXXXXXXXXX....................................... -...........................XXXXXXXXXXXX......................................... -...........................XXXXXXXXXXX.......................................... -............................XXXXXXXX............................................ -............................XXXXXX.............................................. -.............................XXX................................................ -.............................X.................................................. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +......................XXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +.......................XXXXXXXXXXXXXXXXXXXXXXXXX................................ +.......................XXXXXXXXXXXXXXXXXXXXXXXX................................. +.......................XXXXXXXXXXXXXXXXXXXXXX................................... +........................XXXXXXXXXXXXXXXXXXXX.................................... +........................XXXXXXXXXXXXXXXXXXX..................................... +.........................XXXXXXXXXXXXXXXX....................................... +.........................XXXXXXXXXXXXXXX........................................ +.........................XXXXXXXXXXXXX.......................................... +..........................XXXXXXXXXX............................................ +..........................XXXXXXXXX............................................. +..........................XXXXXXX............................................... +...........................XXXX................................................. +...........................XXX.................................................. +............................X................................................... +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -2818,7 +2818,7 @@ BOOST_AUTO_TEST_CASE(Annulus) { )X"; BoundaryTolerance tolerance = - BoundaryTolerance::Chi2Bound(SquareMatrix2::Identity(), -0.1); + BoundaryTolerance::Chi2Bound(Vector2(1, 10).asDiagonal(), -0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance), parseMatrix(reference))); } @@ -2920,18 +2920,18 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ ................................................................................ ................................................................................ -...............................XX............................................... -...............................XXX.............................................. +................................................................................ +................................XX.............................................. ...............................XXXXX............................................ ..............................XXXXXXX........................................... -..............................XXXXXXXXX......................................... +.............................XXXXXXXXXX......................................... .............................XXXXXXXXXXX........................................ -.............................XXXXXXXXXXXXX...................................... +............................XXXXXXXXXXXXXX...................................... ............................XXXXXXXXXXXXXXXX.................................... -............................XXXXXXXXXXXXXXXXX................................... +...........................XXXXXXXXXXXXXXXXXX................................... ...........................XXXXXXXXXXXXXXXXXXXX................................. ..........................XXXXXXXXXXXXXXXXXXXXXX................................ -..........................XXXXXXXXXXXXXXXXXXXXXXXX.............................. +.........................XXXXXXXXXXXXXXXXXXXXXXXXX.............................. .........................XXXXXXXXXXXXXXXXXXXXXXXXXX............................. ........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... .......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... @@ -2939,56 +2939,56 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... ........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ .........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXX....................................... -...............XXXXXXXXXXXXXXXXXXXXXXXX......................................... -................XXXXXXXXXXXXXXXXXXXXX........................................... -................XXXXXXXXXXXXXXXXXXX............................................. -................XXXXXXXXXXXXXXXXX............................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXX...................................... +...............XXXXXXXXXXXXXXXXXXXXXXXXX........................................ +................XXXXXXXXXXXXXXXXXXXXXX.......................................... +................XXXXXXXXXXXXXXXXXXXX............................................ +................XXXXXXXXXXXXXXXXXX.............................................. ................XXXXXXXXXXXXXXX................................................. -.................XXXXXXXXXXX.................................................... +.................XXXXXXXXXXXX................................................... .................XXXXXXXXX...................................................... -.................XXXXXX......................................................... -.................XXX............................................................ +.................XXXXX.......................................................... +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -3008,84 +3008,84 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ ................................................................................ ................................................................................ -............................XX.................................................. -............................XXXX................................................ -...........................XXXXXX............................................... -...........................XXXXXXXX............................................. -..........................XXXXXXXXXX............................................ -..........................XXXXXXXXXXX........................................... -.........................XXXXXXXXXXXXXX......................................... -.........................XXXXXXXXXXXXXXX........................................ -........................XXXXXXXXXXXXXXXXXX...................................... -.......................XXXXXXXXXXXXXXXXXXXX..................................... -.......................XXXXXXXXXXXXXXXXXXXXX.................................... -......................XXXXXXXXXXXXXXXXXXXXXXXX.................................. -.....................XXXXXXXXXXXXXXXXXXXXXXXXXX................................. -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... -.......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... -...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... -.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..............................X................................................. +...............................XX............................................... +................................XX.............................................. +..................................XX............................................ +..................................XXX........................................... +..................................XXXX.......................................... +.................................XXXXXXX........................................ +.................................XXXXXXXX....................................... +................................XXXXXXXXXXX..................................... +................................XXXXXXXXXXXX.................................... +...............................XXXXXXXXXXXXXXX.................................. +..............................XXXXXXXXXXXXXXXXX................................. +..............................XXXXXXXXXXXXXXXXXX................................ +.............................XXXXXXXXXXXXXXXXXXXXX.............................. +............................XXXXXXXXXXXXXXXXXXXXXXX............................. +...........................XXXXXXXXXXXXXXXXXXXXXXXXXX........................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... +..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... -................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... -...................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................ -...................XXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. -...................XXXXXXXXXXXXXXXXXXXXXXXXX.................................... -....................XXXXXXXXXXXXXXXXXXXXXXX..................................... -....................XXXXXXXXXXXXXXXXXXXXX....................................... -....................XXXXXXXXXXXXXXXXXXX......................................... -....................XXXXXXXXXXXXXXXXX........................................... -.....................XXXXXXXXXXXXXX............................................. -.....................XXXXXXXXXXX................................................ -.....................XXXXXXXXX.................................................. -......................XXXXXX.................................................... -......................XXX....................................................... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +.........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... +..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +...........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. +............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. +.............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... +..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... +...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... +................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................. +.................XXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... +.................XXXXXXXXXXXXXXXXXXXXXXXXXX..................................... +.................XXXXXXXXXXXXXXXXXXXXXXXX....................................... +..................XXXXXXXXXXXXXXXXXXXXX......................................... +..................XXXXXXXXXXXXXXXXXXX........................................... +..................XXXXXXXXXXXXXXXXX............................................. +...................XXXXXXXXXXXXXX............................................... +...................XXXXXXXXXXXX................................................. +...................XXXXXXXXXX................................................... +...................XXXXXXXX..................................................... +....................XXXX........................................................ +....................XXX......................................................... +....................XXX......................................................... +.....................XX......................................................... ................................................................................ ................................................................................ ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(1, 0.01); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } @@ -3097,11 +3097,11 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ ................................................................................ ................................................................................ -......................................X......................................... -......................................XXX....................................... -.....................................XXXXXX..................................... -.....................................XXXXXXX.................................... -....................................XXXXXXXXXX.................................. +................................................................................ +.......................................X........................................ +......................................X..XX..................................... +.....................................X.XXXXX.................................... +.....................................XXXXXXXXX.................................. ....................................XXXXXXXXXXXX................................ ...................................XXXXXXXXXXXXXX............................... ...................................XXXXXXXXXXXXXXXX............................. @@ -3113,39 +3113,39 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ...............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ..............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. .............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... -.............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. -............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +............................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ ...........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ -.........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..... -.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...... -....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... -.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +......................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....... +.....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +....................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +..................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........ +.................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ...............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ..............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......... ............XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......... ..........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -........XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... -......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ -....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........... +..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............ +..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............. ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............. ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............... ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ -...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. +...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................ ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................. ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................. ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................... ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................... +....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................... ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...................... -....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................... ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................ ....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................... .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................... .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................... -.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................. +.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................ .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.............................. .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................... .....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................. @@ -3153,19 +3153,19 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.................................... ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..................................... ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....................................... -......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX......................................... +......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................................ ......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.......................................... .......XXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................................ .......XXXXXXXXXXXXXXXXXXXXXXXXXXX.............................................. .......XXXXXXXXXXXXXXXXXXXXXXXXX................................................ .......XXXXXXXXXXXXXXXXXXXXXXX.................................................. -.......XXXXXXXXXXXXXXXXXXXX..................................................... +.......XXXXXXXXXXXXXXXXXXXXX.................................................... .......XXXXXXXXXXXXXXXXXX....................................................... -........XXXXXXXXXXXXXX.......................................................... +........XXXXXXXXXXXXXXX......................................................... ........XXXXXXXXXXXX............................................................ -........XXXXXXXXX............................................................... ........XXXXXX.................................................................. -........XX...................................................................... +................................................................................ +................................................................................ ................................................................................ ................................................................................ ................................................................................ @@ -3174,11 +3174,12 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................................................................ )X"; - BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0, 0.1); + BoundaryTolerance tolerance = BoundaryTolerance::AbsoluteBound(0.01, 0.1); BOOST_CHECK(checkMatrices(makeTestMatrix(*surface, tolerance, 0.15), parseMatrix(reference))); } } BOOST_AUTO_TEST_SUITE_END() + } // namespace Acts::Test diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp index 470512383a0..6e7087b940b 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceBoundsTests.cpp @@ -34,16 +34,43 @@ class SurfaceBoundsStub : public SurfaceBounds { #pragma GCC diagnostic ignored "-Wstringop-overflow" #endif SurfaceBoundsStub(const SurfaceBoundsStub& other) = default; + SurfaceBoundsStub& operator=(const SurfaceBoundsStub& other) = default; #if defined(__GNUC__) && (__GNUC__ == 13 || __GNUC__ == 14) && \ !defined(__clang__) #pragma GCC diagnostic pop #endif - ~SurfaceBoundsStub() override = default; - BoundsType type() const final { return SurfaceBounds::eOther; } - std::vector values() const override { return m_values; } - bool inside(const Vector2& /*lpos*/, - const BoundaryTolerance& /*boundaryTolerance*/) const final { + BoundsType type() const final { return eOther; } + + bool isCartesian() const final { return true; } + + SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { + (void)lposition; + return SquareMatrix2::Identity(); + } + + std::vector values() const final { return m_values; } + + bool inside(const Vector2& lposition) const final { + (void)lposition; + return true; + } + + Vector2 closestPoint(const Vector2& lposition, + const std::optional& metric) const final { + (void)metric; + return lposition; + } + + bool inside(const Vector2& lposition, + const BoundaryTolerance& boundaryTolerance) const final { + (void)lposition; + (void)boundaryTolerance; return true; } diff --git a/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp b/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp index 52155fec5fe..de1f3b55d33 100644 --- a/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp @@ -15,11 +15,10 @@ #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" -#include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp" +#include "Acts/Surfaces/detail/VerticesHelper.hpp" #include #include -#include #include #include #include @@ -128,7 +127,6 @@ BOOST_AUTO_TEST_CASE(TrapezoidBoundsProperties) { !trapezoidBoundsObject.inside(outside, BoundaryTolerance::None())); const auto vertices = trapezoidBoundsObject.vertices(); - BoundaryTolerance tolerance = BoundaryTolerance::None(); std::vector testPoints = { // inside @@ -165,8 +163,8 @@ BOOST_AUTO_TEST_CASE(TrapezoidBoundsProperties) { for (const auto& p : testPoints) { BOOST_TEST_CONTEXT("p=" << p.transpose()) { BOOST_CHECK_EQUAL( - detail::insidePolygon(vertices, tolerance, p, std::nullopt), - trapezoidBoundsObject.inside(p, tolerance)); + detail::VerticesHelper::isInsidePolygon(p, vertices), + trapezoidBoundsObject.inside(p, BoundaryTolerance::None())); } } } @@ -179,22 +177,16 @@ BOOST_DATA_TEST_CASE( bdata::random((bdata::engine = std::mt19937(), bdata::seed = 22, bdata::distribution = std::uniform_real_distribution(-3, 3))) ^ - bdata::xrange(1000) * bdata::make({0., 0.1, 0.2, 0.3}), - x, y, index, tol) { + bdata::xrange(1000), + x, y, index) { (void)index; static const TrapezoidBounds trapezoidBoundsObject(minHalfX, maxHalfX, halfY); static const auto vertices = trapezoidBoundsObject.vertices(); - BoundaryTolerance tolerance = BoundaryTolerance::None(); - - if (tol != 0.) { - tolerance = BoundaryTolerance::AbsoluteBound{tol, tol}; - } - BOOST_CHECK_EQUAL( - detail::insidePolygon(vertices, tolerance, {x, y}, std::nullopt), - trapezoidBoundsObject.inside({x, y}, tolerance)); + detail::VerticesHelper::isInsidePolygon(Vector2{x, y}, vertices), + trapezoidBoundsObject.inside({x, y}, BoundaryTolerance::None())); } /// Unit test for testing TrapezoidBounds assignment