Skip to content

Make CurvatureAngles more robust to degenerate faces#1620

Open
Renovic wants to merge 1 commit into
elalish:masterfrom
Renovic:master
Open

Make CurvatureAngles more robust to degenerate faces#1620
Renovic wants to merge 1 commit into
elalish:masterfrom
Renovic:master

Conversation

@Renovic

@Renovic Renovic commented Mar 31, 2026

Copy link
Copy Markdown

Fixes 7 in #1474. It implements a some checks for degenerate edges and faces within Curvature Angles, and creates a test case to ensure no NANs are produced when degenerate faces are inputted.

@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.16%. Comparing base (4613509) to head (84192b3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1620   +/-   ##
=======================================
  Coverage   95.15%   95.16%           
=======================================
  Files          34       34           
  Lines        7701     7707    +6     
=======================================
+ Hits         7328     7334    +6     
  Misses        373      373           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@elalish elalish left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks! Just a few things.

Comment thread test/properties_test.cpp
// degenerate faces

TEST(Properties, DegenerateCurvature) {
Manifold::Impl impl;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

In general we test Manifold rather than Impl to stick with testing the public API surface as much as possible. It's also a good opportunity to demonstrate how to read properties from MeshGL.

@Renovic Renovic Mar 31, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm a little confused on what to do. When using the Manifold constructor it automatically cleans up the degenerate faces, but I need them to test the CurvatureAngles fixes.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Ah, fair point. I guess that's why we never saw this bug in practice. Okay, you can leave the Impl test then.

Comment thread test/properties_test.cpp
impl.faceNormal_[0] = vec3(0.0, 0.0, 1.0);
impl.faceNormal_[1] = vec3(0.0, 0.0, 1.0);

impl.CalculateCurvature(-1, 0);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Let's test both curvatures as long as we're here.

Comment thread src/properties.cpp
vertGaussianCurvature[vert] *= factor;
// Degenerate vertices can have zero area, which can cause the
// curvature to become NaN
if (vertArea[vert] > 0.0) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What will the curvature be if the area is 0? It might be good to explicitly set it to zero here for clarity.

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.

2 participants