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

fix cube performance #717

Merged
merged 3 commits into from
Jan 29, 2024
Merged

fix cube performance #717

merged 3 commits into from
Jan 29, 2024

Conversation

pca006132
Copy link
Collaborator

Removed the need for using transforms and AsOriginal for cube, which improves performance quite a bit.
Closes #710.

@elalish do you know why MeshGLRoundTrip now breaks?

TEST(Boolean, MeshGLRoundTrip) {
  Manifold cube = Manifold::Cube(glm::vec3(2));
  ASSERT_GE(cube.OriginalID(), 0);
  const MeshGL original = cube.GetMeshGL();

  Manifold result = cube + cube.Translate({1, 1, 0});

  ASSERT_LT(result.OriginalID(), 0);
  ExpectMeshes(result, {{18, 32}});
  RelatedGL(result, {original});

  MeshGL inGL = result.GetMeshGL();
  ASSERT_EQ(inGL.runOriginalID.size(), 2);
  const Manifold result2(inGL);

  ASSERT_LT(result2.OriginalID(), 0);
  ExpectMeshes(result2, {{16, 28}}); // <--- need this to pass the test
  RelatedGL(result2, {original});

  const MeshGL outGL = result2.GetMeshGL();
  ASSERT_EQ(outGL.runOriginalID.size(), 2);
}

I assume it simplifies the mesh when manifold is created from the MeshGL, but I have no idea why it does this. Changing cube to Manifold::Cube(glm::vec3(2)).AsOriginal() doesn't help.

@pca006132 pca006132 requested a review from elalish January 23, 2024 18:30
@elalish
Copy link
Owner

elalish commented Jan 26, 2024

Hmm, that's odd. I almost wonder if the test was broken before? I feel like both ExpectMeshes calls should ask for {16, 28}. Does that fix it? What are we actually getting for result and result2?

@pca006132
Copy link
Collaborator Author

result = {18, 32}, result2 = {16, 28}, thinking about it {16, 28} makes more sense, we union two identical cubes, the mesh should be simplified.

@pca006132
Copy link
Collaborator Author

@elalish what do you think about the value of result? I feel that {16, 28} makes more sense but somehow we are not getting that...

Copy link

codecov bot commented Jan 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0b7ee87) 91.67% compared to head (db7b635) 91.69%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #717      +/-   ##
==========================================
+ Coverage   91.67%   91.69%   +0.01%     
==========================================
  Files          37       37              
  Lines        4732     4730       -2     
==========================================
- Hits         4338     4337       -1     
+ Misses        394      393       -1     

☔ 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.

Thanks, that test looks better now!

@pca006132 pca006132 merged commit 3b8282e into elalish:master Jan 29, 2024
18 checks passed
@pca006132 pca006132 deleted the cube-perf branch January 29, 2024 05:47
cartesian-theatrics pushed a commit to SovereignShop/manifold that referenced this pull request Mar 11, 2024
* fix cube performance

* fix test
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.

Manifold::Cube is slow.
2 participants