我找不到绘制八面体的方法。有人可以向我指出至少一个用于绘制三角形(半透明)表面的类吗?
tvtk.tools.visual
似乎只有一些基本形状。
最佳答案
The Gallery有一个如何使用 triangular_mesh 的示例:
import numpy as np
import mayavi.mlab as ML
verts = [(1,-1,0), (1,1,0), (-1,1,0), (-1,-1,0), (0,0,1), (0,0,-1)]
x, y, z = zip(*verts)
# Each triangle is a 3-tuple of indices. The indices are indices of `verts`.
triangles = [(i, (i+1)%4, j) for i in range(4) for j in (4,5)]
colorval = z
ML.triangular_mesh(x, y, z, triangles, scalars=colorval, opacity=0.75)
ML.show()
关于python - 玛亚维 Mlab : Drawing octahedrons,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24952215/