gpt4 book ai didi

python - 玛亚维 Mlab : Drawing octahedrons

转载 作者:太空宇宙 更新时间:2023-11-03 18:16:21 24 4
gpt4 key购买 nike

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

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com