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

About the function "__get_invalids" #43

Open
liangqianqian123 opened this issue Nov 10, 2019 · 8 comments
Open

About the function "__get_invalids" #43

liangqianqian123 opened this issue Nov 10, 2019 · 8 comments
Labels

Comments

@liangqianqian123
Copy link

Could you please explain the function "__get_invalids" which is defined in file "mesh_pool.py"? I want to know what will happen after these operations?
"
MeshPool.__redirect_edges(mesh, edge_id, side, update_key_a, update_side_a)
MeshPool.__redirect_edges(mesh, edge_id, side + 1, update_key_b, update_side_b)
MeshPool.__redirect_edges(mesh, update_key_a, MeshPool.__get_other_side(update_side_a), update_key_b, MeshPool.__get_other_side(update_side_b))
MeshPool.__union_groups(mesh, edge_groups, key_a, edge_id)
MeshPool.__union_groups(mesh, edge_groups, key_b, edge_id)
MeshPool.__union_groups(mesh, edge_groups, key_a, update_key_a)
MeshPool.__union_groups(mesh, edge_groups, middle_edge, update_key_a)
MeshPool.__union_groups(mesh, edge_groups, key_b, update_key_b)
MeshPool.__union_groups(mesh, edge_groups, middle_edge, update_key_b)
"
Thank you very much!

@ranahanocka
Copy link
Owner

Hi @liangqianqian123 ,

When encountering "bad" (valence 3) vertices (aka "invalids"), we clean them if possible. The issue is that these "valence 3" vertices cause many edges to be unable to be collapsed. See this illustration, on the left is a valid edge collapse, on the right is a collapse which results in a non-manifold geometry:
image
When we encounter such a vertex we clean it.

@ranahanocka ranahanocka added the question FAQ label Nov 25, 2019
@chengzg
Copy link

chengzg commented Nov 29, 2019

@ranahanocka , Thanks for the reply. I also encounter a problem about the invalid edges.
In my case, the __remove_triplete get asserted after getting the invalid_edges.
The invalid_edges = [3534, 3547, 3543].

  def __remove_triplete(mesh, mask, edge_groups, invalid_edges):
        vertex = set(mesh.edges[invalid_edges[0]])
        for edge_key in invalid_edges:
            vertex &= set(mesh.edges[edge_key])
            mask[edge_key] = False
            MeshPool.__remove_group(mesh, edge_groups, edge_key)
        mesh.edges_count -= 3
        vertex = list(vertex)
        assert(len(vertex) == 1)

The assert(len(vertex) ==1) is triggered. I debugged a little bit is that: it seems it is caused by wrong neighbour information. The label information is as below:
edge id: gemm_edge
3534 [3547 3543 3547 3543]
3543 [3547 3534 3547 3534]
3547 [3543 3534 3543 3534]

Have you encounter this problem before? What could be the reason and any recommendation to solve the problem?

Thanks & Regards,
Spencer

@chengzg
Copy link

chengzg commented Dec 4, 2019

@ranahanocka , I found the answer from #7, so it is caused due to a very small connected but isolated component. Do you have any idea that how we can solve it in programming way?

@ranahanocka
Copy link
Owner

Hi @chengzg ,

You can remove small connected components using meshlab (via scripting).

@chengzg
Copy link

chengzg commented Dec 17, 2019

Hi @ranahanocka ,

Thanks very much for your reply.

I am thinking of solving the problem in MeshCNN code. For example, in the scenario mentioned above, i could delete the whole triangle or adding another array to reduce its priority to be collapsed. Do you think will it work?

Also you added the assert there, it must be some reason. May i know what problem you have experienced before?

Thanks & Regards,
Spencer

@ranahanocka
Copy link
Owner

Hi @chengzg ,

It is certainly possible, but it is more complicated. I believe meshlab is an easier approach. Here is a script which will do it

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Remove Isolated pieces (wrt Face Num.)">
  <Param type="RichInt" value="25" name="MinComponentSize"/>
 </filter>
 <filter name="Remove Unreferenced Vertex"/>
</FilterScript>

You need to save that to a file and call it something that ends with .mlx, for example remove_island.mlx. Also, install meshlab and then you can call it from the command line:

meshlabserver -i cube.obj -s remove_island.mlx -o cube_out.obj

where cube.obj is the input file and cube_out.obj is the output file.

@ranahanocka
Copy link
Owner

Also you added the assert there, it must be some reason. May i know what problem you have experienced before?

So if the smallest connected component (a pyramid object) cannot have any more edges removed. It is the smallest genus-0 primitive that exists. Basically, removing an edge on this small object will result in non-manifold geometry.

@chengzg
Copy link

chengzg commented Dec 18, 2019

@ranahanocka ,

Again thanks very much for your reply.

Thanks & Regards,
Spencer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants