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

Invalid tetra in TetraMesh when creating TriangleMesh with alpha shapes #1829

Closed
NicoBux opened this issue May 14, 2020 · 13 comments · Fixed by #3201
Closed

Invalid tetra in TetraMesh when creating TriangleMesh with alpha shapes #1829

NicoBux opened this issue May 14, 2020 · 13 comments · Fixed by #3201

Comments

@NicoBux
Copy link

NicoBux commented May 14, 2020

When using #1621 work around for creating TraingleMesh from a point cloud with 'TriangleMesh.create_from_point_cloud_alpha_shape()', I get the following error:
[Open3D ERROR] [CreateFromPointCloudAlphaShape] invalid tetra in TetraMesh

To Reproduce

  1. Create point cloud by manually creating PointCloud() object, then adding in points from a Vector3dVector()
  2. run:
    alpha = .03
    tetra_mesh, pt_map = o3d.geometry.TetraMesh.create_from_point_cloud(pcd)
    mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, alpha, tetra_mesh, pt_map)
  3. See error

Environment (please complete the following information):

  • OS: [Windows 10.0]
  • Python version: 3.6.7
  • Open3D version: 0.9.0.0
  • Is this remote workstation?: no
  • How did you install Open3D?: conda
@griegler
Copy link
Contributor

Maybe visualize your tetra mesh and the point cloud. Probably there is a tetra that has a triangle with zero area? The problem is here that results in a 0 and would lead to a div by 0.

@LyceanEM
Copy link

I have experienced the same problem, with the same python version and Open3D version. Is there any way to work around this at present?

@NicoBux
Copy link
Author

NicoBux commented May 14, 2020

@griegler Unfortunately I am not able to visualize any type of Geometry. I get an error like Invoked with: geometry::TetraMesh with 5481 points and 34003 tetrahedra. When using o3d.visualization.draw_geometries(tetra_mesh). This happens with pointclouds. Is there another way to filter and remove zero-area tetra?

@griegler
Copy link
Contributor

@buxbomber Is it possible to share a point cloud where this problem happens?

@NicoBux
Copy link
Author

NicoBux commented May 14, 2020

@griegler Oh jeez I did not realize draw_geometries() required a list as argument. The visualization works fine. However, I still am unsure on how to clean up the tetra_mesh.

Edit: Here is a point cloud: https://drive.google.com/open?id=1wybuC6wdLL4Qx8iBuyXij4gajZ_MY7_k

@lschfr
Copy link

lschfr commented May 25, 2020

got the same problem with Open3D 0.10.0.1, Python 3.7.4, Windows 10 and a tetra-mesh built out of a point-cloud

@jaredbaggen
Copy link

Also have the same problem, Open3D 10.0.1 Python 3.8, Mac 10.15.6.

@Wuestengepard
Copy link

I also have this Problem. Drawing the Mesh and Pointcloud results in that Picture:
image

After creating the TetraMesh, i also get the error:
[Open3D ERROR] [CreateFromPointCloudAlphaShape] invalid tetra in TetraMesh

The code i use:

alpha = 0.002
print(f"alpha={alpha:.3f}")
tetra_mesh, pt_map = o3d.geometry.TetraMesh.create_from_point_cloud(pcd)
o3d.visualization.draw_geometries([pcd,tetra_mesh], mesh_show_back_face=True)
mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, alpha, tetra_mesh, pt_map)
mesh.compute_vertex_normals()
o3d.visualization.draw_geometries([mesh], mesh_show_back_face=True)

@sank96
Copy link

sank96 commented Jan 28, 2021

I have the same problem, any updates?

@halmusaibeli
Copy link

Same issue with me.
image

Code I am using:

alpha = 0.03
print(f"alpha={alpha:.3f}")
tetra_mesh, pt_map = o3d.geometry.TetraMesh.create_from_point_cloud(pcd)
o3d.visualization.draw_geometries([pcd,tetra_mesh], mesh_show_back_face=True)
mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, alpha, tetra_mesh, pt_map)
mesh.compute_vertex_normals()
o3d.visualization.draw_geometries([mesh], mesh_show_back_face=True)

Output:

mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, alpha, tetra_mesh, pt_map)
RuntimeError: [Open3D ERROR] [CreateFromPointCloudAlphaShape] invalid tetra in TetraMesh

@BenT00le
Copy link

im having the same issue is there any way to identify and remove the zero area triangles or the points that cause them before creating the tetramesh
Capture

pcd.points = o3d.utility.Vector3dVector(surface)
o3d.visualization.draw_geometries([pcd])
alpha = 0.03
print(f"alpha={alpha:.3f}")
tetra_mesh, pt_map = o3d.geometry.TetraMesh.create_from_point_cloud(pcd)
o3d.visualization.draw_geometries([tetra_mesh])
m = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, alpha, tetra_mesh, pt_map)
m.compute_vertex_normals()
o3d.visualization.draw_geometries([m], mesh_show_back_face=True)

@colinlaney
Copy link

Maybe visualize your tetra mesh and the point cloud. Probably there is a tetra that has a triangle with zero area? The problem is here that results in a 0 and would lead to a div by 0.

So, @griegler, it would be nice to exit the current iteration rather than the entire for loop, and only ignore single tetrahedron rather than the entire mesh.

@runette
Copy link
Contributor

runette commented Mar 22, 2021

any news on this - I am hitting in this in about 10 out of about 250 point clouds. All i am doing i bring in the point cloud and then

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(cluster)
pcd.estimate_normals()
try:
    mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, .3)
except Exception as e:
    print(f"Cluster {array['ClusterID'][0]} error {str(e)}")
    mesh = o3d.geometry.TriangleMesh()
return mesh

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

Successfully merging a pull request may close this issue.