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

Incorrect detection of non-manifold edges/faces #805

Closed
2 of 8 tasks
danieltwagner opened this issue Oct 4, 2020 · 4 comments
Closed
2 of 8 tasks

Incorrect detection of non-manifold edges/faces #805

danieltwagner opened this issue Oct 4, 2020 · 4 comments

Comments

@danieltwagner
Copy link

Check all platforms you experienced the issue

  • Windows
  • Mac OS
  • Linux
  • Every platform

What type of issue is?

  • bug or unexpected behavior
  • crash
  • feature request
  • other (specify...)

Describe your issue

While debugging some non-manifold STL generation over at deadsy/sdfx#18
I came across what appears to be a bug in the detection of non-manifold meshes in MeshLab_64bit_fp v2020.07, observed on Mac OS 10.15.6.

The two files in this link: https://www.dropbox.com/sh/3lncb9dl7pm4393/AAD_HWYFxy9QDG1MRKmnxbI3a?dl=0 both have thousands of edges that are non-manifold. That is to say, I can peek into the inside of the model. Here is a quick video showing what I'm seeing in Meshlab: https://www.dropbox.com/s/nb1f86rwle1djmw/Screen%20Recording%202020-10-02%20at%209.36.23%20PM.mov?dl=0

In Meshlab I load bottom-quad.stl and select Filters > Selection > Select non Manifold Edges after which Meshlab shows Selection: v: 4 f: 6 which I take to mean that it believes only 6 faces/4 vertices are involved in non-manifold edges. I obtain similar results when choosing Select non Manifold Vertices.

Repeating the above with bottom-slow.stl, Meshlab selects zero faces/vertices, but the mesh is not manifold and shows similar trouble with openings into the inside of the model.

At the issue linked above I also reproduced a Python script that uses the popular Trimesh library to parse and further inspect those files. This may or may not be useful in your diagnosis of this issue.

@alemuntoni
Copy link
Member

alemuntoni commented Oct 7, 2020

As also explained in the help of the filter Select non Manifold Edges, an edge is non-manifold if more than two faces are incident to the edge. Therefore, in the meshes you linked, the numbers of 4 vertices and 6 faces are correct.
Maybe you are looking for the select border filter, which will select all the faces and vertices with edges incident to only one face. But these are not non-manifold edges.

I don't know what function of the Trimesh library you are using, but if you called a function that declares to detect only non-manifold edges, and detects also the ones in the boundary, that's definitely a bug in the Trimesh library.

@danieltwagner
Copy link
Author

bottom-slow.stl also contains 524 edges with 4 incident faces and 2964 edges with 6 incident faces.

That aside, I'm curious how a model with any edges that have only a single incident face would be manifold. Wouldn't a single triangle be manifold by that definition?

@alemuntoni
Copy link
Member

That's not something that I made up:

(first results on a google search)... Therefore yes, a single triangle is a manifold shape, but not watertight (here you can find a proper set of definitions of watertightness and manifoldness of a mesh).

About the other edges with 4 and 6 incident faces, they are probably result of importing from STL format: STLs are not vertex-indexed and therefore, when importing these files, vertices with same coordinates should be unified.
This operation is correctly done by meshlab on the meshes you shared, and therefore 0 non-manifold edges are found on bottom-slow.stl (but with 1200 boundary faces).

@danieltwagner
Copy link
Author

Thank you for those links, it seems I did confuse water-tightness and manifoldness.

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

No branches or pull requests

2 participants