python - 玛亚维 Mlab : Drawing octahedrons

标签 python mayavi

我找不到绘制八面体的方法。有人可以向我指出至少一个用于绘制三角形(半透明)表面的类吗?

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()

enter image description here

关于python - 玛亚维 Mlab : Drawing octahedrons,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24952215/

相关文章:

python - 如何使用python将图像插入特定的excel文件单元格?

python - 在单个字典理解中插入列表和切片

Python Mayavi2 @mayavi2.standalone

python - Mayavi 无法正确渲染实体表面

python - 最新 python 更新后读取长路径(>256 个字符)的文件时出现问题

python - 手动将 C 代码转换为 Python

python - 在Jupyter笔记本中的不同单元格中显示mayavi X3D图形

python - 防止轴在相机移动时更新 - mayavi python

python - 使用 Python 和具有多个矢量场的 tvtk 将数据保存到 VTK

Python 3 - ValueError : Found array with 0 sample(s) (shape=(0, 11)) 而 MinMaxScaler 要求至少为 1