8000 Fix Cross Section Mirror and add Test by michael-j-faulkner · Pull Request #1206 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 3 commits into from
Mar 30, 2025

Conversation

michael-j-faulkner
Copy link
Contributor

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.

Copy link
codecov bot commented Mar 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.23%. Comparing base (4fabfc3) to head (e5d8992).
Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@michael-j-faulkner
Copy link
Contributor Author

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.

@pca006132
Copy link
Collaborator

Those are unrelated, we will fix them soon to unblock these PRs.

@pca006132
Copy link
Collaborator

you can merge the master branch and push now

Copy link
Owner
@elalish elalish left a 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?

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.);
Copy link
Owner

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.

Copy link
Owner
@elalish elalish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

@elalish elalish merged commit 7c8fbe1 into elalish:master Mar 30, 2025
27 checks passed
@michael-j-faulkner michael-j-faulkner deleted the mirror-bug branch March 30, 2025 19:21
@elalish elalish mentioned this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cross Section Mirror behaving unexpectedly
3 participants
0