-
Notifications
You must be signed in to change notification settings - Fork 168
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
fix: Fix trapezoid accelerated inside check #2696
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2696 +/- ##
==========================================
+ Coverage 49.63% 49.64% +0.01%
==========================================
Files 474 474
Lines 26941 26951 +10
Branches 12415 12416 +1
==========================================
+ Hits 13372 13381 +9
- Misses 4746 4747 +1
Partials 8823 8823 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This surprises me. The way I read the new code it seems to me like it's the same shape but with extra redundant checks. Can you draw a sketch of which points it was previously missing?
@paulgessinger this test https://github.com/acts-project/acts/blob/main/Tests/UnitTests/Core/Surfaces/TrapezoidBoundsTests.cpp#L203 failed after I changed the RNG in #2694 The reason is that we previously extended the inner rectangle in X and Y direction using tolerance without special treatment of the corners. Not sure what we expect at the corners but the behavior is different in the polygon check and in the quick bounds check looking at your MC generated image the problem are the corners where we either just inflate the trapezoid or like in your picture we have rectangles overshooting the inflated trapezoid |
Hm, I think that's what we want. By convention, the tolerances are aligned with the local axes not with the slanted edge of the trap. I need to double check how the polygon code uses the tolerances. |
the polygon code will make the trapezoid bigger in x and y so there are no additional edges which seems "more correct" to me |
@andiwand Hm I see. I think the polygon code calculates the minimum distance first and then determines if they're inside tolerance in x and y. Ultimately it's a choice. I think the current behavior is least surprising given "dumb" tolerances but that's just me. Btw, with this PR included, the covered shape by the trap with tolerances seems to be exactly unchanged compared to before: If this is correct, maybe the unit test failure is because of a floating point edge case and not because of a geometric difference? |
hmm I see. now I am confused. I don't think the numbers where small enough for a FP issue but let me check again this is the error I see in #2694 (reverted the fix there)
|
@andiwand Hm, the way the test is written (full polygon vs trap inside method) I think your diagnosis should be correct, in that it's the ears of the trap that are just different in the two. 😵💫 |
running on higher stats shows that this happens very rarely and only in one of the corners. happened 52 / 1000000 failures.txt my code is basically delegating the corners to the polygon code this is why the edge case disappears. maybe there is a problem in the polygon code after all? |
If it's only in one of the corners maybe it's just |
it seems to be a rare numerical problem with the polygon method. I moved not the seed in #2694 so it does not fail not sure if it is worth trying to make the polygon method more numerical stable closing for now |
This bug flagged some points to be inside while they are not. I fixed this by checking against two rectangles instead of just one which is too big.
discovered in #2694