Hi,
I would like to ask two questions:
-
Is it possible to bake an invalid mesh, because this method would not bake invalid mesh?
context.m_doc.AddMeshObject(mesh); context.m_doc.Redraw();
-
What do I need minimally to create a valid mesh from invalid mesh?
I was testing multiple commands in C++ Rhino SDK and took methods that seemed to do smth with good to repair the mesh. But I would like to ask how to do it properly?if(!mesh.IsValid()){ //mesh.Compact(); mesh.CombineIdenticalVertices(true,true); mesh.CullUnusedVertices(); mesh.Cleanup(true); mesh.CullDegenerateFaces(); mesh.CullDegenerates(); mesh.CullUnusedVertices(); ON_Mesh meshRebuilt(mesh.FaceCount(), mesh.VertexCount(), false, false); for(int i = 0; i < mesh.VertexCount(); i++) meshRebuilt.SetVertex(i,mesh.Vertex(i) ); for(int i = 0; i < mesh.FaceCount(); i++){ auto f = mesh.m_F[i]; int a = f.vi[0]; int b = f.vi[1]; int c = f.vi[2]; if (a != b && a != c && b != c) meshRebuilt.SetTriangle(i, a, b, c); } context.m_doc.AddMeshObject(meshRebuilt); context.m_doc.Redraw(); print = (double)meshRebuilt.VertexCount(); RhinoApp().Print(L"Cockroach: Number of Vertices = %g\n", print); print = (double)meshRebuilt.FaceCount(); RhinoApp().Print(L"Cockroach: Number of Faces = %g\n", print); print = (double)meshRebuilt.IsValid(NULL); RhinoApp().Print(L"Cockroach: ISValid = %g\n", print); }