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

Flip it if you can't collapse it #8609

Open
wants to merge 4 commits into
base: 5.6.x-branch
Choose a base branch
from

Conversation

sloriot
Copy link
Member

@sloriot sloriot commented Nov 14, 2024

if a needle is also a cap, it will be handled as a needle only. But if we can't collapse the edge, a flip will not be tried. Try the flip too.

Note that this will slow down the method as the status of a triangle is tested twice.

Fix #8605

if (res[1] == boost::graph_traits<TriangleMesh>::null_halfedge())
std::cout << "add new needle: " << edge(res[0], tmesh) << std::endl;
else
std::cout << "add new needle (also a cap): " << edge(res[0], tmesh) << std::endl;
Copy link
Member

@MaelRL MaelRL Nov 22, 2024

Choose a reason for hiding this comment

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

Do you not fill both ranges on purpose? There's still:

  ...
  else // let's not make it possible to have a face be both a cap and a needle (for now)
  ...

a little below; so, if it's a needle & a cap, you fill the needle range, but not the cap range.

Copy link
Member

@MaelRL MaelRL Nov 22, 2024

Choose a reason for hiding this comment

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

I'm not sure about the current changes in the is_badly_shaped + collect functions.

I think it should be something like:

collect almost degenerate triangles():
- if it's a needle
-   put it in the needle range
- else if it's a cap
-   put it in the cap range

treat():
- while there are needles or caps:
-   if there are needles, pop the topmost needle
-     if it's no longer a needle or collapse is rejected
-      test if it's a cap // this is what was missing
-        put it in caps
-   if there are caps
-    pop the cap, treat it 

So:

  • no edge should appear in both ranges
  • there shouldn't be any calls to the version of is_badly_shaped() that checks for both needle & cap regardless of needle-ness.

I think you didn't need to modify as much, it should be enough with the lines filling the edges_to_flip range and leave is_badly_shaped() + collection untouched?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants