8000 added Slice() by elalish · Pull Request #644 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

added Slice() #644

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 6 commits into from
Dec 13, 2023
Merged

added Slice() #644

merged 6 commits into from
Dec 13, 2023

Conversation

elalish
Copy link
Owner
@elalish elalish commented Dec 11, 2023

Fixes #426

This gets us proper cross-sections of a Manifold. I gave it a height parameter to make it cheaper to do a stack of slices as a 3D printer might need, rather than having to transform the whole model each time like in OpenSCAD. This will return the bottom face if the height is equal to the bottom of the bounding box, and return empty when at the top of the bounding box.

Now we just need to add the various bindings for this and Project. Done

@elalish elalish self-assigned this Dec 11, 2023
Copy link
codecov bot commented Dec 11, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e15f4cf) 91.58% compared to head (1a9887e) 91.61%.
Report is 3 commits behind head on master.

Files Patch % Lines
src/manifold/src/face_op.cpp 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #644      +/-   ##
==========================================
+ Coverage   91.58%   91.61%   +0.03%     
==========================================
  Files          36       36              
  Lines        4693     4724      +31     
==========================================
+ Hits         4298     4328      +30     
- Misses        395      396       +1     

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

Copy link
Collaborator
@pca006132 pca006132 left a comment

Choose a reason for hiding this comment

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

We may also want to clarify that triangles that does not cross the target height may not be sliced. E.g. Cube().Slice(1.0) is empty while Cube().Translate({0, 0, 1.0}).Slice(1.0) is a square, because we require z.min <= height && z.max > height.

const SparseIndices collisions =
collider_.Collisions<false, false>(query.cview());

std::set<int> tris;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what about std::unordered_set?

@pca006132
Copy link
Collaborator

Btw we should also add Slice and project to js, C and python bindings. Should be simple though.


ManifoldCrossSection *manifold_project(void *mem, ManifoldManifold *m) {
auto poly = from_c(m)->Project();
return to_c(new (mem) CrossSection(poly));
Copy link
Owner Author

Choose a reason for hiding this comment

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

@geoffder Does this look right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes (late I know, already merged). Sorry I've been swamped in trying to wrap up things with my PhD (and will be for a while) so I've been skimming too many of my manifold GitHub email notifications (though I've still been trying to read most of them to stay up to date).

Copy link
Owner Author

Choose a reason for hiding this comment

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

No prob! I know how it is with wrapping up a PhD - good luck! It's better on the other side, I promise!

@@ -95,15 +95,13 @@ function addMembers(
const cls = module[className];
const obj = areStatic ? cls : cls.prototype;
for (const name of methodNames) {
if (name != 'cylinder') {
Copy link
Owner Author

Choose a reason for hiding this comment

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

@geoffder Can I assume this was a debugging leftover of some kind?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea looks like it sorry!

@elalish elalish merged commit 3216a24 into master Dec 13, 2023
@elalish elalish deleted the slice branch December 13, 2023 00:48
@elalish elalish mentioned this pull request Jan 7, 2024
cartesian-theatrics pushed a commit to cartesian-theatrics/manifold that referenced this pull request Mar 11, 2024
* added slice

* added test, addressed feedback

* added JS bindings

* remove code oddity

* added python bindings

* added C bindings
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.

Get CrossSection from Manifold and plane
3 participants
0