-
Notifications
You must be signed in to change notification settings - Fork 137
Fix Cross Section Mirror and add Test #1206
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1206 +/- ##
=======================================
Coverage 92.23% 92.23%
=======================================
Files 31 31
Lines 5988 5988
=======================================
Hits 5523 5523
Misses 465 465 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I'm not familiar enough to know what's going wrong with the Mac TBB checks given how little I changed, so I leave it to others, assuming those are actual errors that need fixing. |
Those are unrelated, we will fix them soon to unblock these PRs. |
you can merge the master branch and push now |
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.
The reason the mirror is defined by its normal is that this way the API is consistent between 2D and 3D - in 3D it takes two tangents to define a plane, but only one normal. If that wasn't clear from the API docs, would you mind updating them?
test/cross_section_test.cpp
Outdated
EXPECT_FLOAT_EQ(result_a.Volume(), 0.); | ||
EXPECT_FLOAT_EQ(result_a2.Volume(), 0.); | ||
EXPECT_FLOAT_EQ(result_b.Volume(), 0.); | ||
EXPECT_FLOAT_EQ(result_b2.Volume(), 0.); |
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 is a little complicated - could we use a bounding box check instead of all these boolean ops? I also don't think we need to export all these models.
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.
Perfect, thanks!
Fixes #1204
Removes an extraneous
la::abs
call that would result in incorrect behavior for axes with mixed sign components (i.e. (-1, 1)) and adds a test to catch it.Note: what initially caused me to think something was wrong was that mirroring something in quadrant 1 across the axis given by (1,1) ended up in quadrant 3. After looking at the code more intently, it appears this is actually intended behavior and the provided axis vector should be interpreted as being the normal to the axis we are mirroring over, not tangent to the axis.
I believe this is done to avoid having to calculate any angles and seems like a reasonable thing to do; however, I was caught off guard because in 2D I would typically think of defining a line in terms of it's tangent vector. Unclear if this is just me having some bad intuition or if some additional clarification could also be useful.