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
Remove degenerate polygons in PolySetBuilder #5007
Conversation
@pca006132 In case you have any comments :) |
src/core/primitives.cc
Outdated
p->vertices=this->points; | ||
p->indices=this->faces; | ||
for (auto &poly : p->indices) | ||
PolySetBuilder builder(this->points.size(), this->faces.size()); |
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.
going through PolySetBuilder
will lose manifoldness.
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.
Riight, this is the wrong hammer for this job; we need something that cleans up a user-specified polyhedron. I'll think about it, perhaps just tessellate to triangles early for user polyhedrons.
void addVertex(int n); | ||
void addVertex(const Vector3d &v); | ||
// Calling this is optional; will be called automatically when adding a new polygon or building the PolySet | ||
void endPolygon(); |
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.
why should we have this if it can be called automatically?
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.
Really just for API cleanliness, as most client code will use begin/end pairs to make it more readable.
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 could make it required and rather assert if someone tries to do two beginPolygon() in a row.
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 could make it required and rather assert if someone tries to do two beginPolygon() in a row.
Sounds good.
I think we probably should not do this in the |
Another concern (not specific to this PR): we are using |
I think the only issue here is That said, there might be a better/more general place to insert a polygon cleaner which doesn't collapse manifolds. |
No, but @elalish may know |
Tidbit: It's been a long time, but the last time I tried to build in debug mode for MSYS2/Windows, the build failed - it hit some kind of Windows symbol table limit. |
I'm not sure it has a specific name - it's just an artifact of various different manifoldness definitions floating around. I wrote up the major differences on our wiki. The short answer is that anything that doesn't allow disjoint vertices at the same location cannot maintain manifoldness through Boolean operations in general. It's closely related to why STL is not capable of reliably transmitting manifolds either. Hence why 3MF should be used instead, and now even glTF with my new EXT_mesh_manifold extension. |
b71cd76
to
7277f00
Compare
7277f00
to
9eb7a13
Compare
Also includes some PolySetBuilder refactoring.
Fixes #5000
Note: rotate_extrude() could be improved to better handle manifold corner cases. Deferring to #5046