Skip to content
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 CreateFaces entirely #951

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Remove CreateFaces entirely #951

wants to merge 5 commits into from

Conversation

elalish
Copy link
Owner

@elalish elalish commented Sep 25, 2024

This is a sizable refactor and moderate breaking change. Manifold will no longer use equal faceIDs to mean that those triangles are coplanar. This was always problematic, because it meant that using Warp or Refine would destroy the entire mesh relation, making material association quite difficult. This also means we can remove any concept of property tolerances from our API, which I never liked. Now edges can collapse if the two triangles are coplanar, have the same meshID, and reference the same propVerts on both sides of the edge.

Hopefully this will also make things a bit faster, since CreateFaces was always slow due to the connected components algorithm. I'm still on the fence as to whether we should store and update the internalEdges list, or generate it on the fly. For the first pass it's on the fly. This PR is very much WIP.

@elalish elalish self-assigned this Sep 25, 2024
impl->CreateTangents(impl->UpdateSharpenedEdges(sharpenedEdges));
const Vec<bool> internalEdges = impl->InternalEdges();
impl->CreateTangents(impl->UpdateSharpenedEdges(sharpenedEdges),
internalEdges);
Copy link
Owner Author

Choose a reason for hiding this comment

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

@pca006132 Any ideas for reducing the duplication between these two MeshGL functions?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Move this to impl?

@elalish elalish added the breaking change API changes for major versions label Sep 25, 2024
@pca006132
Copy link
Collaborator

Btw, do you have any particular test where CreateFaces is very slow? I ran both our perfTest and our Samples/SDF/BooleanComplex tests, CreateFaces is typically pretty fast:

image

@elalish
Copy link
Owner Author

elalish commented Sep 28, 2024

Huh, I thought it was slow, but it was awhile back - maybe your union find optimization helped more than I realized. I believe in general the slowness comes with importing a large mesh. Anyway, the primary purpose of this PR isn't speed, but making the mesh relation work better.

@pca006132
Copy link
Collaborator

Btw, I guess this is the final breaking change (feature-wise) for 3.0? Others are mostly some API cleanup, as well as binding changes to match our updated APIs?

@elalish
Copy link
Owner Author

elalish commented Oct 1, 2024

Btw, I guess this is the final breaking change (feature-wise) for 3.0? Others are mostly some API cleanup, as well as binding changes to match our updated APIs?

Close, but I think removing GLM from our public API is one more: #962.

@elalish
Copy link
Owner Author

elalish commented Oct 1, 2024

Hmm, definitely still some work to do on this one. Something's still a bit broken because it's not collapsing all edges it should. However, it's also dramatically slower, which has me a little more worried - may need to change the approach. @pca006132 if you want to have a look, maybe see if Tracy has any interesting insights (since I can't run it on Mac), that would be great.

@pca006132
Copy link
Collaborator

Do you have any tests that are slower in particular? I tried running some tests, but they fail with vec out of range immediately, so it is hard to get profiler result for this.

And I think tracy does support mac?

@elalish
Copy link
Owner Author

elalish commented Oct 2, 2024

Oh, did you pull my latest? I thought I fixed the vec out of range stuff. I guess I should try Tracy again, maybe I'm remembering wrong.

@pca006132
Copy link
Collaborator

Yeah, apparently I forgot to pull the latest. Will test later tonight.

@pca006132
Copy link
Collaborator

Just had a look at perf output, nothing too unusual. I think the problem is just we are not simplifying enough, causing everything to run slower?

@elalish
Copy link
Owner Author

elalish commented Oct 4, 2024

Ha, looks like #975 fixed the slowness - sure enough it just wasn't running parallel. That makes me feel better - now I just need to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change API changes for major versions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants