问题描述
我想可视化一系列球体,每个球体都有其特定的半径。我在行中也遇到了同样的问题,但是我用@Nico vuaille的https://stackoverflow.com/users/10219194/nico-vuaille答案解决了:
import vtk
from random import uniform
points = vtk.vtkPoints()
lines = vtk.vtkCellArray()
widths = vtk.vtkDoubleArray()
widths.SetName("width")
for i in range(60):
pt1 = points.InsertNextPoint(uniform(0,100),uniform(0,0)
pt2 = points.InsertNextPoint(uniform(0,0)
w = uniform(0,3)
widths.InsertNextValue(w)
widths.InsertNextValue(w)
lines.InsertNextCell(2,[pt1,pt2])
output.SetPoints(points)
output.GetPointData().AddArray(widths)
output.SetLines(lines)
但是,由于找不到“球形”过滤器,因此我无法对球形进行相同操作。 预先感谢您的帮助, 最好的祝福, 哈米德·拉贾比。
解决方法
在ParaView中,可以使用Glyph
过滤器。它在给定点上显示预定义的几何图形。
您可以使用预定义的形状(例如球形)。或者,您也可以使用Glyph with custom Source
来使用自己的几何图形。