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

Feature Request: Determine where genus are present in mesh #1084

Open
JeffreyWardman opened this issue Apr 4, 2024 · 2 comments
Open

Feature Request: Determine where genus are present in mesh #1084

JeffreyWardman opened this issue Apr 4, 2024 · 2 comments

Comments

@JeffreyWardman
Copy link
Collaborator

I want to be able to find where "tunnels"/"holes" are in the mesh (see below). A count of them and their bounding box would be ideal return values. For my particular use case, I want to remove them as they cause significant problems and only occur in poorly scanned regions.

image

@JeffreyWardman
Copy link
Collaborator Author

Number of genus can be counted via -(m.vertices.shape[0] - len(m.edges) + len(m.cells) - 2 - len(m.boundaries().split()))/2. Unsure about determining the location.

@marcomusy
Copy link
Owner

I think a -1 is needed in the above. Anyway consider the following:

https://en.wikipedia.org/wiki/Reeb_graph

from vedo import *

mesh = Mesh("https://discourse.paraview.org/uploads/short-url/qVuZ1fiRjwhE1qYtgGE2HGXybgo.stl")
mesh.rotate_x(10).rotate_y(15).alpha(0.5)
mesh.pointdata["scalars"] = mesh.vertices[:, 0]

printc("is_closed  :", mesh.is_closed())
printc("is_manifold:", mesh.is_manifold())
printc("euler_char :", mesh.euler_characteristic())
printc("genus      :", mesh.genus())

reeb = mesh.to_reeb_graph()
ids = reeb[0].pointdata["Vertex Ids"]
pts = Points(mesh.vertices[ids], r=10)

show([[mesh, pts], reeb], N=2, sharecam=False)

Screenshot from 2024-04-05 19-53-21

to be honest i'm not sure if that really answers the question properly, but I hope it can help.

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