Skip to content

Commit

Permalink
feat(geo): Surface::isOnSurface gets tolerance parameter (#3544)
Browse files Browse the repository at this point in the history
This parameter gets piped through to the `localToGlobal` call. Defaults are unchanged.
  • Loading branch information
paulgessinger authored Aug 23, 2024
1 parent fb8c3bc commit e5fa01e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
9 changes: 6 additions & 3 deletions Core/include/Acts/Surfaces/RegularSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include "Acts/Definitions/Tolerance.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/ThrowAssert.hpp"

Expand Down Expand Up @@ -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;
};
Expand Down
10 changes: 6 additions & 4 deletions Core/include/Acts/Surfaces/Surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
9 changes: 5 additions & 4 deletions Core/src/Surfaces/RegularSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 6 additions & 5 deletions Core/src/Surfaces/Surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e5fa01e

Please sign in to comment.