CoACD
CoACD copied to clipboard
Bug Report: crash when merging convex hull
Hi, @SarahWeiii,
Thank you for your excellent work!
We face a problem that coacd will crash when limit max_convex_hull to a small number.
It seems that merging process in coacd raise the segmentation fault.
import numpy as np
import open3d as o3d
import coacd
MAX_CONVEX_HULL_NUM = 1
file = "partial.ply"
mesh_o3d = o3d.io.read_triangle_mesh(file)
# is_success, preprocessed = vertices_fixing_util(mesh_o3d, 0.003)
mesh_verts = np.array(mesh_o3d.vertices, dtype=float)
mesh_faces = np.array(mesh_o3d.triangles, dtype=int)
# visualize input mesh
o3d.visualization.draw_geometries(
[mesh_o3d],
mesh_show_wireframe=True,
mesh_show_back_face=True,
window_name="Mesh before convex decomposition")
mesh_coacd = coacd.Mesh(mesh_verts, mesh_faces)
parts = coacd.run_coacd(mesh_coacd,
max_convex_hull=MAX_CONVEX_HULL_NUM,
threshold=0.05)
# visualize output mesh
mesh_num = len(parts)
mesh_list = [None for i in range(mesh_num)]
for i in range(mesh_num):
mesh_vertices_num = parts[i][0].shape[0]
mesh_list[i] = o3d.geometry.TriangleMesh(
vertices=o3d.utility.Vector3dVector(parts[i][0]),
triangles=o3d.utility.Vector3iVector(parts[i][1]))
all_mesh = o3d.geometry.TriangleMesh()
for i in range(mesh_num):
mesh_list[i].paint_uniform_color(np.random.random(size=3))
mesh_list[i].compute_vertex_normals()
all_mesh += mesh_list[i]
o3d.visualization.draw_geometries(
[all_mesh],
mesh_show_wireframe=True,
mesh_show_back_face=True,
window_name="Mesh after convex decomposition: COACD")
partial.ply : https://drive.google.com/file/d/1l5EXBAXUBZMYu70asmQR7C-82JRzxLGQ/view