[vtkusers] Using multiple Vectors

Uwe Rempler rempler at mechbau.uni-stuttgart.de
Wed Feb 25 10:56:11 EST 2004


hi list,

i'm looking for a way to visualize more than one vectorarrow per point 
(displacement-vector / another-vector) - for example somehow like this:

#------------------------------------------------------------------------------- 

firstVectorArray = vtkFloatArray()
firstVectorArray.SetName('FIRST')
secondVectorArray = vtkFloatArray()
secondVectorArray.SetName('SECOND')
unstructGrid = vtkUnstructuredGrid()
attribute = vtkAssignAttribute()
arrow = vtkArrowSource()
glyph = vtkGlyph3D()
mapper = vtkPolyDataMapper()
actor = vtkActor()
# just imagine the grid and the vetorarrays are filled with lots of data ;-)

unstructGrid.GetPointData().AddArray(firstVectorArray)
unstructGrid.GetPointData().AddArray(secondVectorArray)

attribute.SetInput(unstructGrid.GetOutput())
attribute.Assign('FIRST', 'VECTORS',  'POINT_DATA')      << here's the 
problem: either 'FIRST' or 'SECOND'
attribute.Assign('SECOND', 'VECTORS',  'POINT_DATA')      << array but 
not both at the same time...
attribute.Update()

glyph.SetInput(attribute.GetOutput())
glyph.SetSource(arrow.GetOutput())

mapper.SetInput(glyph.GetOutput())
actor.SetMapper(mapper)
 
etc...
#------------------------------------------------------------------------------- 


i know that this isn't working cause there was already a question about 
how to handle more than one vector simultaneous:
http://public.kitware.com/pipermail/vtkusers/2002-June/011932.html
and the answer said that "there can be only one active "attribute" of 
each type (scalar, vector, normal etc.) at one time" when using 
AddArray()...
does anybody know a way of showing two vectors at the same time? or 
should i just add another actor showing the second vector array arrows...?

greetings
uwe



More information about the vtkusers mailing list