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
edges opening after merging of two meshes #120
Comments
Hm, this is odd. To start, we can figure out where the edges of the mesh are via the import pyvista as pv
clipped = pv.read('clipped.vtk')
print(clipped.extract_geometry().n_open_edges)
mesh = pv.read('mesh.vtk')
print(mesh.extract_geometry().n_open_edges)
merged = mesh + clipped
print(merged.extract_geometry().n_open_edges) 0 geom = merged.extract_geometry()
edges = geom.extract_edges(boundary_edges=True,
feature_edges=False,
manifold_edges=False)
p = pv.Plotter()
p.add_mesh(edges, color="red", line_width=5)
p.add_mesh(mesh, opacity=0.5, color="lightblue")
p.add_mesh(clipped, opacity=0.5, color="green")
p.camera_position = [(7.801336112237166, 251.0279128488682, 236.18977047349765),
(47.05759233540398, 50.995165371104854, 24.41602276196233),
(0.18847718989496154, -0.6962632417999844, 0.692599340894485)]
p.show() but those edges are not open in the original meshes, just the merged mesh. I believe what. is happening here is that there are duplicated nodes and thee merged = mesh.merge(clipped, merge_points=False)
print(merged.extract_geometry().n_open_edges) 0 |
Thank you for the answer. I've tried your suggestion and it has worked! But when I increase the resolution of my meshes (I try to replicate simple geological structures) I meet the strange error. In the meshes.zip are two meshes I try to merge (but with slightly higher resolution). I successfully merge them with your approach. And when I read Then, after I triangulate the result and save to the vtk file and check if with the Sfepy script that shows you if your mesh is OK it says me following:
The values of Euler characteristic and number of connected components for the volume mesh must both be equal to 1. In my case it's 16 and 27 for the volume. I don't now where to see these parameters in the pyvista, that's why I showed the result of Sfepy script. What it could be? |
Huh, I had never heard of the Euler characteristic (and we do not have a way to compute that in PyVista). As for the connected surface components... when you merge your meshes, you will have different non-connected components in the merged mesh... in order to not, you'd need to use point merging then repair the open edges with a tool like https://pymeshfix.pyvista.org |
@banesullivan The Euler Characteristic determines the type of surface in topology. In particular, it determines the number of holes an object has. In 3D, the Euler Characteristic is computed as V-E+F. For bodies of genus 0 (i.e. solid bodies without holes), V-E+F=2 (you get this for all the regular polyhedra, for example), where V=Vertices, E=Edges, and F=Faces. |
If I merge two meshes the
n_open_edges
property of resulting mesh is increasing from 0 to 4.meshes.zip
I suspect that the issue might be with these 'leafs' on the edges of the mesh:
Am I right? And if I am, how can I remove them from the "clipped" mesh.
The text was updated successfully, but these errors were encountered: