如何在Python中可视化3D delaunay三角剖分? [英] How to visualize 3D delaunay triangulation in Python?
本文介绍了如何在Python中可视化3D delaunay三角剖分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一组3D点,我已使用scipy.spatial.Delaunay进行了三角剖分/四面体化.我现在拥有一组所有四面体的独特面孔,并希望将其以3D形式可视化.
I have a set of 3D points which I've used scipy.spatial.Delaunay to do the triangulation / tetrahedralization. I now have a set of unique faces of all of the tetrahedra, and would like to visualize these in 3D.
是否有任何Python库(或带有Python包装器的库)可以做到这一点?
Are there any Python libraries (or libraries with a Python wrapper) that can do this?
推荐答案
尝试mayavi.mlab.triangular_mesh()
import numpy as np
from mayavi import mlab
vertices = np.array([[0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]])
faces = np.array([[0, 1, 0, 0],[1, 2, 1, 2],[2, 3, 3, 3]])
mlab.triangular_mesh(vertices[0,:], vertices[1,:], vertices[2,:], faces.T)
mlab.show()
这篇关于如何在Python中可视化3D delaunay三角剖分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文