diff --git a/Core/include/Acts/Surfaces/RegularSurface.hpp b/Core/include/Acts/Surfaces/RegularSurface.hpp index d23824dc7ca..c911a739519 100644 --- a/Core/include/Acts/Surfaces/RegularSurface.hpp +++ b/Core/include/Acts/Surfaces/RegularSurface.hpp @@ -8,6 +8,7 @@ #pragma once +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/ThrowAssert.hpp" @@ -105,11 +106,13 @@ class RegularSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param position global position to be evaludated /// @param boundaryTolerance BoundaryTolerance directive for this onSurface check + /// @param tolerance optional tolerance within which a point is considered on surface /// /// @return boolean indication if operation was successful - bool isOnSurface(const GeometryContext& gctx, const Vector3& position, - const BoundaryTolerance& boundaryTolerance = - BoundaryTolerance::None()) const; + bool isOnSurface( + const GeometryContext& gctx, const Vector3& position, + const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::None(), + double tolerance = s_onSurfaceTolerance) const; using Surface::isOnSurface; }; diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index f0f204d0791..1ca13d48600 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -252,12 +252,14 @@ class Surface : public virtual GeometryObject, /// @param position global position to be evaludated /// @param direction global momentum direction (required for line-type surfaces) /// @param boundaryTolerance BoundaryTolerance directive for this onSurface check + /// @param tolerance optional tolerance within which a point is considered on surface /// /// @return boolean indication if operation was successful - bool isOnSurface(const GeometryContext& gctx, const Vector3& position, - const Vector3& direction, - const BoundaryTolerance& boundaryTolerance = - BoundaryTolerance::None()) const; + bool isOnSurface( + const GeometryContext& gctx, const Vector3& position, + const Vector3& direction, + const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::None(), + double tolerance = s_onSurfaceTolerance) const; /// The insideBounds method for local positions /// diff --git a/Core/src/Surfaces/RegularSurface.cpp b/Core/src/Surfaces/RegularSurface.cpp index 83ffc6c69df..31f015bc6cf 100644 --- a/Core/src/Surfaces/RegularSurface.cpp +++ b/Core/src/Surfaces/RegularSurface.cpp @@ -31,11 +31,12 @@ Vector3 RegularSurface::localToGlobal(const GeometryContext& gctx, return localToGlobal(gctx, lposition); } -bool RegularSurface::isOnSurface( - const GeometryContext& gctx, const Vector3& position, - const BoundaryTolerance& boundaryTolerance) const { +bool RegularSurface::isOnSurface(const GeometryContext& gctx, + const Vector3& position, + const BoundaryTolerance& boundaryTolerance, + double tolerance) const { // global to local transformation - auto lpResult = globalToLocal(gctx, position); + auto lpResult = globalToLocal(gctx, position, tolerance); if (!lpResult.ok()) { return false; } diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 1238488c7b2..d6442dbaf49 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -45,12 +45,13 @@ Acts::Surface::Surface(const GeometryContext& gctx, const Surface& other, Acts::Surface::~Surface() = default; -bool Acts::Surface::isOnSurface( - const GeometryContext& gctx, const Vector3& position, - const Vector3& direction, - const BoundaryTolerance& boundaryTolerance) const { +bool Acts::Surface::isOnSurface(const GeometryContext& gctx, + const Vector3& position, + const Vector3& direction, + const BoundaryTolerance& boundaryTolerance, + double tolerance) const { // global to local transformation - auto lpResult = globalToLocal(gctx, position, direction); + auto lpResult = globalToLocal(gctx, position, direction, tolerance); if (!lpResult.ok()) { return false; }