def field_directions(field):
""" Scene the shows the directions of a vector field.
Parameters
----------
field: array (X, Y, N, 3)
the vector field to plot where N is the number of peaks.
Returns
----------
actors: list of vtkActor
the scene actors.
"""
actors = []
for x in range(field.shape[0]):
for y in range(field.shape[1]):
line = numpy.zeros((2, 3), dtype=numpy.single)
for vector in field[x, y]:
line[1] = vector
actors.append(pvtk.line(line, 0, linewidth=2))
actors[-1].SetPosition((x, y, 0))
return actors
评论列表
文章目录