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

Excessive Vertex Duplication in cut_edges Function #152

Open
karinsifri opened this issue Dec 29, 2024 · 2 comments
Open

Excessive Vertex Duplication in cut_edges Function #152

karinsifri opened this issue Dec 29, 2024 · 2 comments

Comments

@karinsifri
Copy link

karinsifri commented Dec 29, 2024

When using the cut_edges function on a closed manifold mesh with a chain of connected edges, I noticed excessive vertex duplication. All edges in the mesh were duplicated, with most of the new vertices left unreferenced.

I followed the documentation-examples and used the following code:

import gpytoolbox as gpy

new_faces, new_vertex_idx = gpy.cut_edges(f, path_edges)
gpy.write_mesh("../meshes/debug.obj", v[new_vertex_idx, :], new_faces)

For example, the original mesh had 5389 vertices, but the length of the returned indices was 32322, even for a short path (of only 3 edges).

Upon inspecting the source code, I noticed that remove_unreferenced is already included. However, it does not appear to work effectively in reducing the excess vertices. I had to manually use:

new_v, new_f = gpy.remove_unreferenced(v[new_vertex_idx, :], new_faces)

While this workaround helps, the excessive duplication and the apparent ineffectiveness of remove_unreferenced make the process more cumbersome than necessary.

Let me know if more details or test cases are needed to help resolve the issue. I’d be happy to assist further.

@odedstein
Copy link
Collaborator

odedstein commented Dec 29, 2024

Hi @karinsifri ,
Can you suggest a fix (via PR) that includes the correct removing of unreferenced vertices?
(Please also include the example mesh you ran the code on.)

@karinsifri
Copy link
Author

Thank you for your response! I appreciate the opportunity to contribute.

I’d be happy to look into the issue and attempt to debug the root cause in the code. While I currently need some time to review and understand the source of the problem, I’ll work on identifying the issue and suggesting a fix via a PR when I’m able.

In the meantime, I’ve included the details of the mesh I worked on and the path I was trying to cut, as shared earlier. I’ll keep you updated on my progress.

The mesh I have worked on is C_r2.txt (this is .obj file but i have changed it's extension to be able to upload it)

The path I was trying to cut looks something like

path_edges = np.array([[3460, 2852],
       [2852, 1939],
       [1939,  656],
       [ 656, 4535],
       [4535, 1866],
       [1866, 2327],
       [2327, 1814],
       [1814, 3020],
       [3020, 5060],
       [5060, 1661],
       [1661, 4912]], dtype=int64)

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