open3d读取numpy生成mesh

问题:如何设置一个空 mesh,再用 numpy 生成 vertices 和 triangles 添加到空mesh中。
代码:

import open3d
import numpy as np

mesh = open3d.geometry.TriangleMesh()
np_vertices = np.array([[2, 2, 0],
                        [5, 2, 0],
                        [5, 5, 0]])
np_triangles = np.array([[0, 1, 2]]).astype(np.int32)

mesh.vertices = open3d.utility.Vector3dVector(np_vertices)

mesh.triangles = open3d.utility.Vector3iVector(np_triangles)

open3d.visualization.draw_geometries([mesh])

参考来源:https://forum.open3d.org/t/add-triangle-to-empty-mesh/197

你可能感兴趣的:(numpy,python,机器学习)