-
Notifications
You must be signed in to change notification settings - Fork 137
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
added Slice() #644
Conversation
Codecov ReportAttention:
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. |
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.
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
.
src/manifold/src/face_op.cpp
Outdated
const SparseIndices collisions = | ||
collider_.Collisions<false, false>(query.cview()); | ||
|
||
std::set<int> tris; |
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.
what about std::unordered_set
?
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)); |
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.
@geoffder Does this look right?
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.
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).
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.
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') { |
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.
@geoffder Can I assume this was a debugging leftover of some kind?
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.
Yea looks like it sorry!
Sorry, something went wrong.
All reactions
* added slice * added test, addressed feedback * added JS bindings * remove code oddity * added python bindings * added C bindings
Successfully merging this pull request may close these issues.
Get CrossSection from Manifold and plane
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 andDoneProject
.