Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix trapezoid accelerated inside check #2696

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Core/include/Acts/Surfaces/TrapezoidBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace Acts {
/// @image html TrapezoidBounds.gif
///
/// @todo can be speed optimized by calculating kappa/delta and caching it

class TrapezoidBounds : public PlanarBounds {
public:
enum BoundValues {
Expand Down
25 changes: 19 additions & 6 deletions Core/src/Surfaces/TrapezoidBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,31 @@ bool Acts::TrapezoidBounds::inside(const Acts::Vector2& lposition,
double tolX = bcheck.tolerance()[eBoundLoc0];
double tolY = bcheck.tolerance()[eBoundLoc1];

if (std::abs(y) - hlY > tolY) {
andiwand marked this conversation as resolved.
Show resolved Hide resolved
// outside y range
double distY = std::abs(y) - hlY;

// check outside y range + tolerance
if (distY > tolY) {
return false;
}

if (std::abs(x) - std::max(hlXnY, hlXpY) > tolX) {
// outside x range
// distance x to outer rectangle
double distOuterX = std::abs(x) - std::max(hlXnY, hlXpY);

// check outside x range + tolerance
if (distOuterX > tolX) {
return false;
}

if (std::abs(x) - std::min(hlXnY, hlXpY) <= tolX) {
// inside x range
// distance x to inner rectangle
double distInnerX = std::abs(x) - std::min(hlXnY, hlXpY);

// check inside x range, inside y range + tolerance (already checked above)
if (distInnerX <= 0) {
return true;
}

// check inside x range + tolerance, inside y range
if ((distInnerX <= tolX) && (distY <= 0)) {
return true;
}
}
Expand Down
Loading