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

_incremental KeyError #4

Open
jiapei-nexera opened this issue Jul 25, 2022 · 1 comment
Open

_incremental KeyError #4

jiapei-nexera opened this issue Jul 25, 2022 · 1 comment

Comments

@jiapei-nexera
Copy link

It looks in function _incremental of file https://github.com/yuehaowang/convex_hull_3d/blob/master/convex_hull.py, there is a bug around is_visible = vol < 0 ??

✗ python convex_hull.py --file ....../MySTL.STL --vis 

Loaded mesh file ....../MySTL.STL
#vertices: 1788
#faces: 1184
Is edge manifold: True
Is self-intersecting: True
Is watertight: False

Computing convex hull...
WARNING: coplanar tetrahedron (2-3-4-1)
WARNING: coplanar tetrahedron (1-3-4-2)
WARNING: coplanar tetrahedron (1-2-4-3)
WARNING: coplanar tetrahedron (1-2-3-4)
  0%|                                                                                                                                                                                | 0/1783 [00:00<?, ?it/s]WARNING: edge(3-165): non-manifold edge
WARNING: edge(2-165): non-manifold edge
WARNING: edge(3-165): non-manifold edge
WARNING: edge(2-165): non-manifold edge
WARNING: edge(3-165): non-manifold edge
WARNING: edge(2-165): non-manifold edge
WARNING: edge(3-165): non-manifold edge
WARNING: edge(2-165): non-manifold edge
 11%|█████████████████▍                                                                                                                                                 | 191/1783 [00:00<00:00, 20605.26it/s]
Traceback (most recent call last):
  File "....../convex_hull_3d/convex_hull.py", line 193, in <module>
    convhull = ConvexHull3D(np.asarray(mesh.vertices), show_progress=True)
  File "....../convex_hull_3d/convex_hull.py", line 42, in __init__
    self._incremental()
  File "....../convex_hull_3d/convex_hull.py", line 120, in _incremental
    elif visible_ls[edge.adj_faces[0]] or visible_ls[edge.adj_faces[1]]:
KeyError: '3-157-165'
@yuehaowang
Copy link
Owner

It seems this issue is due to the first 4 vertices of the input are coplanar. The incremental convex hall algorithm requires a non-coplanar tetrahedron initialization. I simply choose the first 4 vertices in the input model for initialization (see here). To bypass this issue, I suggest to shuffle the input vertices to make the first 4 vertices non-coplanar.

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