[vtkusers] Non uniform glyph scaling

Dr. Thomas Wolfanger t.wolfanger at tlt.de
Thu Aug 5 10:40:42 EDT 2004


Hello John,

I still was not able to solve my problem. Probably, there is some basic misunderstandig of what I want to achieve. So lets have a look at some code:

MessWerte = vtk.vtkPolyData() # here I declare my PolyData
#
MessWerte.SetPoints(MessPunktKoordinaten) #Point Coordinates
MessWerte.GetPointData().SetVectors(MessWertVelo) # Vectors i want to visualize.

As one component of the vector is very large compared to the others, I would like to manipulate the display of the vectors such that the direction of the vectors can be seen. I achieved this by simply multiplying the small components by a factor of say 100., but this manipulates for exapmle the vector norm which is undesirable. It seems to be not possible to read in another vector field for scaling...

MessWerte.GetPointData().SetScalars(MessWertPstat) # Scalar field read in
#
Arrow = vtk.vtkArrowSource() # Creation of the arrows for displaying the vectors
#
Cones = vtk.vtkGlyph3D()
Cones.SetInput(MessWerte)
Cones.SetSource(Arrow.GetOutput())
Cones.SetScaleFactor(1./150.) # this scales all components...
Cones.OrientOn()
Cones.SetVectorModeToUseVector()
#Cones.SetScaleModeToScaleByVectorComponents() # this is the command which #probably solves my problem... But how to use it?
Cones.SetColorModeToColorByVector()
Cones.Update()

Thanks for your input,
Greetings
-Thomas


                                                                                                                                                                                                                                                         
Each fieldData object (pointdata or celldata) can have scalars associated
with it. For colouring etc. You can also add an array of vectors,
Dataset->getCellData()->setVectors(...my vector array) then these vectors
will be used to scale the glyphs (apologies if syntax misleading, but you
get the idea)

JB
----- Original Message ----- 
From: "Dr. Thomas Wolfanger" <t.wolfanger at tlt.de>
To: <vtkusers at vtk.org>; <vtkusers-bounces at vtk.org>
Sent: Wednesday, August 04, 2004 8:31 AM
Subject: [vtkusers] Non uniform glyph scaling


Hi all,

there was a thread about 2 years ago on this topic, and I learned from this
that using "SetScaleModeToScalingByVectorComponents()" (in python) for
Glyph3D should do the trick (i.e. scaling one component of a glyph while
leaving the others as they are.).
So far so good.
But... where do set I set the vector with the scaling for the components? If
I set Glyph.SetScaleFactor, then only a scalar is accepted.
Sorry that this may be a trivial question but I'm quiet new to vtk
programming and totally lost at this point.

Greetings,
-Thomas
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list