[vtkusers] vtkglyph3D with arrowsource
    Brandi Pitta 
    brandimichelle415 at gmail.com
       
    Mon Aug 31 10:33:50 EDT 2009
    
    
  
Hello all,
I am trying to visualize vector data using vtkglyph3D with an arrow source.
However, I am having problems with the orienation of the arrows.  They are
only orientated correctly if placed at (0,0,0).  If I want to place ar arrow
with tail at (10,10,0) and head at (17,7,0) it is not pointing in the right
direction.  The arrow does not even pass though the horizontal.  Below is
some code.  Any help is much appreciated.
pts = vtkPoints()
pts.num = 4
pts.x = [10,10,10,10]
pts.y = [10,10,10,10]
pts.z = [0, 0, 0, 0]
pt = vtkPoints()
for i in range(0,pts.num):
    pt.InsertNextPoint(pts.x[i],pts.y[i],pts.z[i])
pts2 = vtkPoints()
pts2.num = 4
pts2.x = [17,17,13,7]
pts2.y = [13,7,17,17]
pts2.z = pts.z
vectors = vtkFloatArray()
vectors.SetNumberOfTuples(4)
vectors.SetNumberOfComponents(3)
vectors.SetComponent(0,0,pts2.x[0])
vectors.SetComponent(0,1,pts2.y[0])
vectors.SetComponent(0,2,pts2.z[0])
... for the other pts2
base = vtkPolyData()
base.SetPoints(pt)
base.GetPointData().SetVectors(vectors)
arrow = vtkArrowSource()
glyph = vtkGlyph3D()
glyph.SetInput(base)
glyph.SetSource(arrow.GetOutput())
glyph.SetVectorModeToUseVector()
Much Thanks,
Brandi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090831/68ab5d8f/attachment.htm>
    
    
More information about the vtkusers
mailing list