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

Surface remeshing crash fix #89

Closed

Conversation

Angela-Oo
Copy link

Description

Performing SurfaceRemeshing Adaptive with Features can lead to crashes.

To reproduce the crash do the following

  • Start the remeshing project with a mesh file that has degenerated triangles and kinks (if you need a concrete file for reproduction I can provide you one)
    The remeshing project does not work in the latest commit as already reported in Issue
    Inheriting from MeshViewer on Windows crashes due to the imgui context being null Inheriting from MeshViewer on Windows crashes due to the imgui context being null #87.
    The latest working commit is as far as I know SHA-1: 3145a49
  • Click Detect Features with 70
  • Execute Adaptive remeshing
    The program will crash because mesh_->halfedge(f) is called with an invalid Face f

The reason for this crash is, that for some degenerated triangles solving minimize_squared_areas lead to an vector containing nan, so one solution is to check at the end of minimize_squared_areas if the solved vector contains invalid values.

By doing so the crash is prevented but it takes a really long time to solve (might be an endless loop).
One solution for this might be to change the function is_too_long, so that an edge is never to long if it is smaller than min_edge_length_.

Motivation

Adaptive surface remeshing with features should not crash

Benefits

no crash

Drawbacks

I am not sure if there is a reason that an edge is currently allowed to be smaller than min_edge_length_, but everything seems to work with the change.

Maybe it would be better to abort the calculation if it is not possible to calculate the minimize_squared_areas.

Signed-off-by: Angela Denninger <angela.denninger@googlemail.com>
Signed-off-by: Angela Denninger <angela.denninger@googlemail.com>
@dsieger
Copy link
Member

dsieger commented Nov 23, 2021

Hi @Angela-Oo

I'm currently looking into remeshing robustness issues in relation to #90. I've got some changes in the pipeline and would like to test them with some more models. If you could share any models that crashed for you, I'd be glad to have a look.

Thanks,
Daniel

@dsieger
Copy link
Member

dsieger commented Nov 23, 2021

You can also have a look at the remeshing-robustness branch if you want to try for yourself.

@Angela-Oo
Copy link
Author

Hi @dsieger,

Here is one example mesh where the adaptive remeshing crashed.
surface_remeshing_crash.zip

Thank you too,
Angela =)

@dsieger
Copy link
Member

dsieger commented Nov 23, 2021

The good news is that it doesn't crash anymore. Yay!

The bad news is that the resulting mesh might not be satisfactory, but that's a different issue. :-)

Here's what I observed: The initial mesh quality is too bad to detect proper feature edges. By proper I mean single connected line segments. I think the kinks also lead to extremely high curvature values and therefore to lots of refinement in otherwise flat / low curvature regions. Some smoothing and/or manual cleanup of the feature edges could help.

@dsieger dsieger mentioned this pull request Nov 25, 2021
@dsieger dsieger closed this in #91 Nov 25, 2021
@Angela-Oo
Copy link
Author

Hi @dsieger,

Thank you for the fix =)
I don't expect the library to detect the correct feature edges, as these are already known in my input data.

Kind regards,
Angela

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