8000 wasm: fix CrossSection slice and project bindings by neilpa · Pull Request #930 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wasm: fix CrossSection slice and project bindings #930

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 4 commits into from
Sep 18, 2024

Conversation

neilpa
Copy link
Contributor
@neilpa neilpa commented Sep 15, 2024

Resolves #929 by calling the CrossSectionCtor directly. These functions already have the vector returned by the _Slice/_Project so the polygons2vec isn't needed. I just copied what the CrossSection wrapper did w/out it.

I'm not sure if the memory management with disposePolygons is correct, but my tests in with a local ManifoldCAD work after this change.

I also couldn't figure out how to add new tests. AFAICT, it's just running the examples? It might be worth adding a slice example anyway. Happy to add as part of this PR if you point me in the right direction.

8000 Copy link
codecov bot commented Sep 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.29%. Comparing base (d437097) to head (cc07628).
Report is 96 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #930      +/-   ##
==========================================
- Coverage   91.84%   88.29%   -3.55%     
==========================================
  Files          37       62      +25     
  Lines        4976     8643    +3667     
  Branches        0     1046    +1046     
==========================================
+ Hits         4570     7631    +3061     
- Misses        406     1012     +606     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Yes, another example / test would be great to show people how to use slice/project. The difficulty is I like our examples to be high quality - simple, readable, cool-looking. If you're up to the challenge that would be great.

@@ -284,11 +284,17 @@ Module.setup = function() {
};

Module.Manifold.prototype.slice = function(height = 0.) {
return Module.CrossSection(this._Slice(height));
const polygonsVec = this._Slice(height);
const result = new CrossSectionCtor(polygonsVec, 2 /* positive */);
Copy link
Owner

Choose a reason for hiding this comment

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

How about fillRule2Int('Positive') as elsewhere, for maintainability?

@neilpa
Copy link
Contributor Author
neilpa commented Sep 16, 2024

I leaned into the default yellow rendering and made a cheesy example. Let me know if that works for you.

Also, how do I run the auto code formatter to fix the one broken CI check? I installed clang-format via homebrew and ran the format.sh script locally but that didn't do anything.

@elalish
Copy link
Owner
elalish commented Sep 16, 2024

Would you mind adding a screenshot?

As to formatting, it looks like our format.sh is restricting the paths a bit too much - can you update accordingly? Thanks!

@neilpa
Copy link
Contributor Author
neilpa commented Sep 17, 2024
Screen Shot 2024-09-16 at 5 54 08 PM

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.

image

@@ -51,6 +51,34 @@ export const examples = {
return result;
},

Auger: function() {
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for the example! But I'm also really picky about public examples, so I went ahead and made my own instead. Please don't feel slighted; it's just my own aesthetics.

@@ -153,7 +153,7 @@ jobs:
cp ../manifold.* ./dist/
- name: Upload WASM files
uses: actions/upload-artifact@v4
if: matrix.exception == 'ON'
if: matrix.exception == 'ON' && github.event_name == 'push'
Copy link
Owner

Choose a reason for hiding this comment

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

Hopefully this will fix the accidental update problem.

@elalish elalish merged commit 9257734 into elalish:master Sep 18, 2024
22 checks passed
@elalish elalish mentioned this pull request Nov 5, 2024
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.

Error when slice-ing the bottom face of a manifold
2 participants
0