STORM-IRIT / Radium-Engine

Research 3D Engine for rendering, animation and processing
https://storm-irit.github.io/Radium-Engine/
Apache License 2.0
100 stars 50 forks source link

Topological Mesh not detecting isolated singular vertices #687

Closed Beafantles closed 3 years ago

Beafantles commented 3 years ago

OS: Windows 10 64 bits version 2004 Compiler: Visual Studio 16 2019 (v16.8.5) CMake version: 3.19.4 Ninja version: 1.10.2 Radium-Engine version: I used one of the latest version of Radium, from 9th February (commit 537caae).

I tried loading a non manifold mesh and converting it to a Ra::Core::Geometry::TopologicalMesh. I was expecting to see a warning as the mesh I was trying to convert into a Ra::Core::Geometry::TopologicalMesh instance was non manifold but there wasn't such warning displayed on the console.

Here's the code I used:

#include <IO/deprecated/OBJFileManager.hpp>

int main(int argc, char *argv[])
{
    Ra::Core::Geometry::TriangleMesh mesh;
    Ra::IO::OBJFileManager           obj;

    obj.load(argv[1], mesh);
    Ra::Core::Geometry::TopologicalMesh topologicalMesh{ mesh };

    return 0;
}

I executed this program using the following command line arguments:

prog.exe non_manifold/simple.obj

Here's the content of non_manifold/simple.obj:

v 0   1   1
v 1   1   1
v 0.5 1   0
v 0.5 0.5 0.5
v 0   0   0
v 1   0   0
v 0.5 0   1

f 1 2 3
f 3 2 4
f 2 1 4
f 1 3 4
f 5 6 7
f 6 5 4
f 5 7 4
f 7 6 4

meshlab_2C1RYfF030

And here's the output of the program:

- 16:06:07 INFO: TopologicalMesh: load triMesh with 8 faces and 7 vertices.
- 16:06:07 WARNING: [TopologicalMesh] Skip badly sized attribute in_normal

non_manifold/simple.obj is a non manifold mesh which has only one topological singularity (vertice 4 is an isolated singular vertice). But this topological singularity doesn't seem to be detected.

dlyr commented 3 years ago

Well first of all, OBJLoader is deprecated, use with care. The message states that normals are not set on you mesh (you should set dummy normals with the size of the vertices, even if the data is useless for you use, normals are mandatory for mesh). Moreover, non manifold is detected at the OpenMesh level, and singular vertex is (should be) correctly handled, so no errors in your case.

nmellado commented 3 years ago

You mean that OpenMesh duplicates the non-manifold vertices ?

dlyr commented 3 years ago

Nope it's handled by the structures "Ability to handle non-manifold vertices (like two faces meeting in only one vertex)."

What is not handle is non manifold edge and faces, as well as degenerated faces. Anther way to say it is that an halfedge belongs to at most one face (0 if boundary), and has exactly one opposite halfedge.

nmellado commented 3 years ago

The best thing you can do here is to loop over all vertices of the topological mesh once it is created, and detect non-manifold vertices.